Learn the technique for creating line drawings with SVG elements or by utilizing HTML div elements

In my app, users can easily generate a request for creating an email with the organization's domain instead of filling out forms manually on paper. Once the form is filled out and submitted, it goes through an approval process starting with HR department approval, then moving to IT department approval before the email is created by IT staff. I want to give users the ability to track the status of their request by searching for it using a unique ID provided upon submission. To visualize this status, I plan to display flags indicating whether the request is in HR or IT approval process. While I have database checks for all approvals, such as HR approval or IT approval properties, I am struggling to find an API or JavaScript library that can provide the visual representation I need. My core technologies include .NET MVC, SQL, and entity framework. I attempted to use an SVG line on x-axis to represent the process flow but it did not meet my requirements. If there is a better way to achieve this effect, I would appreciate guidance and code snippets. I also tried another method, which involved displaying different departments like IT, HR, VP, FH, and SR each with its own icon. However, this approach also did not work effectively.

<svg height="210" width="500" xmlns="http://www.w3.org/2000/svg" version="1.1">
 <line x1="40" x2="120" y1="100" y2="100" stroke="black" stroke-width="20" stroke-linecap="round"/>
</svg>
https://i.sstatic.net/cI9Ha.jpg

Answer №1

If you're looking to enhance your web development project, have you considered incorporating a canvas element? HTML Canvases offer great flexibility and can be easily managed through JavaScript. With the ability to load images and text onto the canvas, it provides a versatile solution for displaying visual elements on your webpage. If you're interested in exploring this further, you can find helpful tutorials on using canvases at https://www.w3schools.com/graphics/default.asp.

For any specific questions or concerns regarding canvas usage, Stack Overflow is a valuable resource where you can seek additional guidance.

I've included a code snippet showcasing basic functionality of a canvas. While the snippet may appear slightly blurry due to its format, implementing it on an actual webpage should yield clear results. I recommend referring to the canvas tutorial linked above for a more comprehensive understanding of utilizing canvases efficiently.

window.onload = function() {
        var canvas = document.getElementById("myCanvas");
        var ctx = canvas.getContext("2d");
        
        // Incorporate your desired title using text or image.
        ctx.font = "15px Arial";
        let text = "Email Request Process Live Tracking";
        ctx.fillStyle = "#0000ff";
        ctx.fillText(text,canvas.width/2 - ctx.measureText(text).width/2,20);
        
        /* Create a progress bar (consider using an image here),
        represented by a gray rectangle placeholder in this case. */
        ctx.fillStyle = "#a2a2a2";
        let startX = 40;
        let startY = canvas.height - 50;
        let width = canvas.width - 80;
        let height = 10;
        ctx.fillRect(startX, startY, width, height);
        
        /* Position an indicator along the progress bar using JSON coordinates,
        allowing for easy adjustment based on specified intervals. Ideal
        for representing data points with precision. */
        var progress = "it";
        let locations = {
          function: {x: startX, y: startY},
          hr: {x: startX + width/5, y: startY},
          it: {x: startX + 2 * (width/5), y: startY},
          processed: {x: startX + 3 * (width/5), y: startY},
          actionPerformed: {x: startX + 4 * (width/5), y: startY},
          handedoverClosed: {x: startX + width, y: startY}
        };
        let img = new Image;
        /* Use an appropriate flag image associated with your project.
        The provided link offers a sample image for illustration purposes. */
        img.src = "https://static.goshopping.dk/products/300/kay-bojesen-flag-til-garder-39021-6382-1.jpg";
        let x = locations[progress].x
        let y = locations[progress].y
        ctx.drawImage(img, locations[progress].x, locations[progress].y - 40, 20, 40)
        
}
#myCanvas {
  border:1px solid #d3d3d3;
  width:100%;
  height:100%;
}

#invis {
  display:none
}
<canvas id="myCanvas"></canvas>
<!–– The inclusion of this image tag assists in rendering the canvas correctly within the snippet. Ideally, it's unnecessary for standard implementation and remains hidden for optimization.-->
<img src="https://static.goshopping.dk/products/300/kay-bojesen-flag-til-garder-39021-6382-1.jpg" id="invis">

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Displaying a div after a successful form submission using Jquery

I created two popup windows. One is used to ask the user whether they want to submit the form, and if they click 'yes', the form is submitted. The issue I encountered is that the other popup window should be shown after the form is successfully s ...

How can I use JavaScript to create a drop-down menu that only appears after selecting the previous one?

<div class="row"> <div class="col-md-4"> <label for="selectCustomers">Customer Select</label> <select class="form-control pointer" name="tableCustomers" id=" ...

What causes the button's frame color to change when I click on it?

I am facing an issue with a button I created. When I click the button, the frame color changes and I cannot figure out why. I have attached images showing the button before and after it is clicked. Before: https://i.sstatic.net/5jpB1.png After: https://i ...

Unable to retrieve the following element in a JavaScript array

I am a beginner in JavaScript and I am attempting to access the next element of an array using an onclick function but so far I have not been successful. var i, len; function quiz() { var quiz_questions = [ "who is the founder of Fa ...

Which is better: using multiple makeStyles or just one in Material UI?

Uncertain about the best approach in this situation. Is it acceptable to generate styles using makeStyles for each component individually, or would it be better to create one in the base component and simply pass down class names? ...

What's the best way to make sure an image in CSS respects the height of its parent flexbox section?

This question addresses a clear problem: Flexbox - Img height conflict. However, the accepted answer does not meet my specific needs. One potential solution involves using absolute and relative positioning. While this resolves sizing issues, it interferes ...

Changing the border color of an HTML input is easy with these simple steps:

As part of an educational project, I am developing a login-registration system using HTML, CSS, and PHP. The system will include various HTML text boxes and elements. My goal is to change the border color of a textbox to green when I input something into ...

Verify if a checkbox is selected using an if statement in a Django template

I am currently working on a registration form that requires the user to check a checkbox in order to accept the terms and conditions before they can submit the form. The submit button should be disabled until the checkbox is checked, at which point the but ...

Prevent double-click selection functionality

In my code, I have a CSS class called .noselect that disables text selection using various browser-specific properties. However, I am now looking to modify it so that the text can still be selected, but not when the user double-clicks on it. Is there a wa ...

Curious as to why body.scrollTop functions differently in Google Chrome and Firefox compared to Microsoft Edge

Up until recently, the code body.scrollTop was functioning correctly in my Chrome browser. However, I've noticed that now it is returning 0 in both Firefox and Chrome, but still giving the proper value in Microsoft Edge. Is there anyone who can assis ...

Tips for creating a textfield with height that responds dynamically in Material UI

I am trying to create a textfield with a responsive height that adjusts itself based on the size of its parent grid when the browser window is resized. I have been searching for a solution and came across this helpful post on Stack Overflow about creating ...

Issue with Django JQuery datatable ajax refresh: sorting buttons not displaying and function calls not working

Currently, I am utilizing Django along with JQuery and jquery-datatables-bs3 to generate a table for my models. The functionality allows users to add or remove table rows, which in turn creates or deletes model instances within the database. Each row featu ...

Images with full-width will scroll horizontally

Is there a way to fix the horizontal scroll issue? <!DOCTYPE html> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="stylesheet" href="https:// ...

What are the steps to execute a filter operation on a table by utilizing two select box values with jQuery?

I have a challenge with two dropdown menus. One contains names and the other subjects, along with a table displaying information in three columns: name, subject, and marks. I would like to implement a filter based on the selections in these two dropdowns. ...

The functionality of Javascript stops working once an ajax call is made

My attempt to make an Ajax call to fetch additional data upon clicking a button was successful on the first click. However, subsequent clicks on the button do not trigger the action, and the data retrieved does not apply any JavaScript functionalities like ...

The issue arises when I try to retrieve information from MySQL using Ajax, as it appears

I am currently working on developing an ecommerce website. In order to display products, I am fetching data from a database. My goal is to allow users to add products to their cart without having to refresh the page. I have attempted to use AJAX for this ...

The problem with the Image Gallery carousel not functioning properly in a right-to-left direction arises when attempting to modify

I have been developing an image gallery that functions perfectly in the English version of the website. Now, I am tasked with replicating the same functionality for another version of the website that requires right-to-left (RTL) direction. However, when I ...

The nav bar in the React CSS is being populated with elements

Currently, I am in the process of developing a React app that includes a navigation bar. The issue at hand is that the content within my h1 tags and other elements are overlapping with the navigation bar - meaning that they are not properly contained withi ...

The sub-menu options are constantly shifting... How can I keep them in place?

Here we go again... I'm having trouble with my sub-menu elements moving when I hover over them. I've searched for a solution but haven't found anything helpful. The previous advice I received about matching padding and adding transparent bo ...

Is there a copyright concern regarding CSS?

There are countless websites that spark my creativity. If I am inspired by a particular design, CSS, or JavaScript on one of these sites, am I allowed to copy it to my local folder and use it? For instance, let's say I come across a website called xy ...