instructions on adding a marker to a progress bar

Currently, I have some table data that utilizes Angular UI Bootstrap and Bootstrap classes. My goal is to display a bar graph in a separate tab which reflects the data shown in the table tab. However, when using a progress bar for this purpose, it does not indicate the expected value with a marker. You can view the desired bar design here. Is there a way to incorporate a distinct marker (such as a triangle or vertical line) to differentiate the values?

var app = angular.module('app', ['ui.bootstrap']);

app.controller('MainCtrl', ['$scope', function ($scope) {


$scope.data =
[{"transactionName":"Store Document GDR","actualVolume":251.0,"expectedVolume":500.0,"actualResponseTime":96.0,"expectedRT1":150.0,"expectedRT2":200.0},{"transactionName":"Submit Staging Doc","actualVolume":36.0,"expectedVolume":50.0,"actualResponseTime":86.0,"expectedRT1":200.0,"expectedRT2":250.0},{"transactionName":"Get Documents","actualVolume":7.0,"expectedVolume":50.0,"actualResponseTime":1293.0,"expectedRT1":1300.0,"expectedRT2":1500.0}];
  
  }]);
<html ng-app="app">
  <head>
    <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular-animate.js"></script>
    <script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-1.2.4.js"></script>
    <link href="//netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
  </head>
  <body ng-controller='MainCtrl'>
    <div class="panel-body">

       <uib-tabset>
            <uib-tab>
            <uib-tab-heading><b> Table </b></uib-tab-heading>
            <div class="col-md-12">
                <table class="table table-bordered table-striped text-center" style="font-size:130%;font-weight: bold;" >
                    <thead>
                    <tr bgcolor="#00008b" ; style="color: #bce8f1">
                        <th class ="text-center" rowspan="2" style="vertical-align:middle">Transaction Name</th>
                        <th class ="text-center" colspan="2">Volume</th>
                    </tr>
                    <tr>
                        <td class ="text-center"><b>Actual</b></td>
                        <td class ="text-center"><b>Expected</b></td>
                        
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="record in data">
                        <td>{{record.transactionName}}</td>
                        <td>{{record.actualVolume}}</td>
                        <td>{{"0 - "}}{{record.expectedVolume}}</td>
                    </tr>
                    </tbody>
                </table>
            </div>
            </uib-tab>
            <uib-tab>
            <uib-tab-heading><b> Graph </b></uib-tab-heading>
              <div class="col-md-12">
                <table class="table table-bordered table-striped text-center" style="font-size:130%;font-weight: bold;" >
                    <thead>
                    <tr bgcolor="#00008b" ; style="color: #bce8f1">
                        <th class ="text-center" style="vertical-align:middle">Transaction Name</th>
                        <th class ="text-center">Graph</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="record in data">
                        <td>{{record.transactionName}}</td>
                        <td>
                    </tr>
                    </tbody>
                </table>
            </div>
            </uib-tab>
         </uib-tabset>
        </div>
  </body>
  </html>

Answer №1

To include a progress bar, you can utilize the W3School Tag Progress tag.

Here is an example:

progress {
  background: #000;
  }
<progress value="22" max="100">

Answer №2

Within the relative positioned container, the progress bar is located along with an arrow that uses position:absolute. To position the arrow accurately, simply set left:expected% by subtracting half of the arrow image's width.

var currentvalue = document.getElementById("value1").innerHTML;
var currentexpected = document.getElementById("expected1").innerHTML;
var thetarget = document.getElementById("theprogress");

thetarget.setAttribute("aria-valuenow", currentvalue);
thetarget.style.width = currentvalue + "%";
thetarget.innerHTML = currentvalue + "%";
document.getElementById("arrow").style.left = currentexpected + "%";
body {
  background-color: lavender !important;
}

.progress {
  position: relative !important;  
}

#arrow {
  position: absolute;
  margin-left: -16px;
}

table tr td {
  border: 1px solid #ccc;
  padding: 10px;
  text-align: center;
  background-color: white;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

<table>
<tr><td>value</td><td>expected</td></tr> 
<tr><td id=value1>70</td><td id=expected1>90</td></tr>
</table><br>

<div class="progress">
  <div id=theprogress class="progress-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100"></div>
  <img src="http://i.imgur.com/q2BqI65.png" id=arrow alt=arrow>
</div>

Visit codepen link for reference

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

What is the best way to validate a value with the help of the $.post functions in JavaScript?

An example of a script: <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.min.js"></script> <script type="text/javascript"> $(document).ready( function() { function validateInput( value ) { ...

Relentless Recursion in Angular's Parent Component

Take a look at the Stackblitz to replicate the issue Hey there! I have an Angular7 application with a parent component named timesheet, and a child component called row. What I'm trying to achieve is having the parent component, timesheet, dynamicall ...

Combine functions from two objects that share the same properties into an array for each property

I need help combining the methods from two objects into one, resulting in an array of methods for each property in the parent object: obj1 = {"prop1":"method1","prop2":"method2"} obj2 = {"prop1":"method3","prop2":"method4"} Expected result: obj1 = {"pro ...

Ways to determine if a class is a part of the bootstrap framework

Is there a way to verify if a class like mt-3 or table-left is part of the bootstrap framework? Are there any online resources, tools, or plugins in VSCode that can assist me in determining if a class is a predefined bootstrap keyword? ...

Guide to retrieving the compiled HTML content of a Vue.js component

I have a component structured like this <AgentCard :agent="agent" />, with the object agent containing properties such as FirstName, LastName, Recent Orders, and more. My current challenge involves displaying this component inside a Google ...

Find the maximum width of an element within a Div that is larger than the widths of the other three elements using jQuery

After implementing a Dialog using JqueryUI, I noticed that inside the dialog there is a <div>. Within this <div>, there are three <button> elements labeled "Delete", "Cancel", and "Ok". Interestingly, the widths of these elements are auto ...

Is it better to use 'fs' or 'node:fs' when importing in Bun?

Currently, I am in the process of transitioning my Node.js project to Bun. Throughout my project, the 'fs' package is used extensively. In various Bun migration examples, I have noticed that the 'fs' package is imported as 'node:fs ...

Tips for explaining the structure of a basic Just functor in TypeScript

I am embarking on my first attempt to create a simple interface in TypeScript, and I find myself questioning every step along the way. The core question that troubles me is: How can I best describe this straightforward Jest matcher extension? /** * @par ...

Crafting hover effects in Dreamweaver

Looking for a hover-over tutorial that divides the page in half? Check out these two diagrams below: https://i.sstatic.net/bkR1f.jpg https://i.sstatic.net/bqClq.png Basically, when hovering over any of the 3 buttons, I want to display another list of but ...

Tips for adjusting text to perfectly fit within a DIV's width

I'm facing an issue where the contents in my DIV are not wrapping correctly when the width changes. Specifically, whenever the content includes a long string of characters like "______________________________________________________________" with no s ...

What are the steps to execute AngularJS on JSFiddle?

I am currently experiencing an issue when trying to run an example in JSFiddle. The code is fairly simple, involving an AngularJS module, but I keep encountering an error with module injection. Here is the Javascript code: angular .module('App&apo ...

Tips for creating a perfectly centered line using a button

How can I create a CSS drawing of an <hr> line with a button positioned at the center that cuts the line in half? ...

When using CSS text-indent on an input field, the caret position does not update until you begin typing in the field

When I apply the text-indent property in CSS, my expectation is that when the focus is on the text input area, the text cursor icon/caret will appear indented. However, it seems like the indentation does not take effect until you type the first character. ...

A blank screen of errors pops up when attempting to update through a form

Encountering a white error screen when attempting to add an item using a form in Python / Django. I'm currently debugging the issue but lacking information. Any guidance on where to look next would be greatly appreciated.https://i.sstatic.net/daavn.pn ...

Are the jQuery selectors provided by the client safe to use?

Is it secure to let users input jQuery selectors for selection? I am considering taking a selector string submitted by users, which could potentially be malicious, and using it in $('') to target elements on the webpage. ...

Having trouble retrieving the Excel spreadsheet containing data from the backend using the outputstream

What is the REST method used to return outputStream data for downloading an Excel spreadsheet? @RequestMapping(value = "/downloadxls", method = RequestMethod.GET) public @ResponseBody void getRecordsAndExportExcel(@RequestParam("search_param") String stud ...

Steps for choosing the nth HTML row with jQuery

I'm facing a situation where I need to be able to select the nth row of an HTML table based solely on the id of the selected row. You can see exactly what I mean by checking out this JSFiddle Demo <table class="mytable1"> <tr><td i ...

Encountering a router issue when trying to export using Express middleware

New to this and encountering a router error when trying to export in Express. How can I resolve this issue for both the router and the mongo model? Hoping for a successful export process in both the router and the mongo model. ...

Utilizing JQuery to merge variable identifiers

Imagine a scenario where the variables are structured this way: localStorage.var1a = 0; localStorage.varnum = 1000; Now, consider the following code snippet: for(x = 1; x < localStorage.varnum; x++){ if(localStorage.var.x.a > 0){ localStora ...

What could be causing the inner container to not fit within the outer container?

.main { background-color:#669; width:1200px; margin-left:auto; margin-right:auto; height:1000px; } .content { background-color: #CCF; width:100%; height:1000px; margin-top:5%; position: absolute; } Despite setting ...