Home forums Using CanvasJS Display HTML values in canvas chart

This topic contains 1 reply, has 2 voices, and was last updated by  Vishwas R 7 months, 3 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10110

    I’ve recently started looking into canvasjs and i think it’s great. I’m using the following JavaScript and HTML code. I currently have the bar chart displaying set results. How can i change this to display the values which are displayed in the HTML div’s (test and duration). I want to try and put these values into the chart? these values come from local storage and i have them displaying on the HTML page. Can someone please help me?

    	
          data: [
          {        
            type: "bar",
            showInLegend: true,
            name: "Black",
            color: "#000000",
            dataPoints: [
            { y: 0.18, label: "Test"},
            { y: 0.12, label: "Test 1"},
            { y: 0.59, label: "Test 2"},        
            { y: 1.15, label: "Test 3"},        
    
            ]
          },
          ]
        });
    
    chart.render();
    }
    </script>
    
        </head>
    
        <body>
            <div id="bar">
          
                <span>History</span>
            </div>
       
    		
    			<div id="chartContainer" style="height: 300px; width: 100%;"></div>
    		
    		
    		  <div id="startTime">
            </div>
    		<div id="startDate">
            </div>
    		<div id="duration">
            </div>
    		<div id="test">
            </div>
    
        </body>
    </html>
    #10142

    Vishwas R
    Keymaster

    Here is an example where you can access data from HTML and pass it to chart.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.