Home Forums Chart Support line graph with values inside data points

line graph with values inside data points

Viewing 5 posts - 1 through 5 (of 5 total)
  • #24393

    Hi,
    is it possible to put the value of the data inside the point on a line graph? I can change the size / colour and shape, but not put the value inside?

    #24394

    I’ve got this so far… but as you can see the index labels are not in the middle of the circles….
    any ideas?

    <!DOCTYPE HTML>
    <html>
    <head>  
    <script>
    window.onload = function () {
    
    var chart = new CanvasJS.Chart("chartContainer", {
    	theme: "light2",
    	title:{
    		text: "Attendance"
    	},
    	axisY:{
    		includeZero: false,
        	interval: 2
    	},
    	data: [{        
    		type: "line",  
          indexLabel: "{y}%",
          markerType: "circle",
          markerColor: "orange",
          markerSize: 36,
          indexLabelFontSize: 16,
          indexLabelFontColor: "white",
          lineColor: "orange",
    		dataPoints: [
    			{ label: 'SEP', y: 95 },
              	{ label: 'OCT', y: 95 },
              	{ label: 'NOV', y: 95 },
              	{ label: 'DEC', y: 95 }
    				]
    	},
          {        
    		type: "line",  
          indexLabel: "{y}%",
          markerType: "circle",
          markerColor: "blue",
          markerSize: 36,
          indexLabelFontSize: 16,
          indexLabelFontColor: "white",
          lineColor: "blue",
    		dataPoints: [
    			{ label: 'SEP', y: 98 },
              	{ label: 'OCT', y: 92 },
              	{ label: 'NOV', y: 93 },
              	{ label: 'DEC', y: 97 }
    				]
    	}    
              
              ],
      
    });
    chart.render();
    
    }
    </script>
    </head>
    <body>
    <div id="chartContainer" style="height: 300px; width: 100%;"></div>
    <script src="https://cdn.canvasjs.com/canvasjs.min.js"></script>
    </body>
    </html>
    #24409

    @haverer,

    You can achieve the above requirement by adding an extra series of bubble chart and displaying indexLabel for the same as shown in this JSFiddle.

    ____
    Shashi Ranjan
    Team CanvasJS

    #24417

    hey @shashiranjan can you plesae help me, here is my question https://canvasjs.com/forums/topic/stacked-histogram-with-zoom-capability-ans-numeric-x-axis/
    please have a look and let me know if it is possible. its really urgent

    • This reply was modified 5 years, 8 months ago by mynktpt.
    #24444

    @mynktpt,

    We have addressed the issue over this thread Stacked Histogram with zoom capability and numeric x-axis. Please check/revert back in the same thread.

    ____
    Shashi Ranjan
    Team CanvasJS

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

You must be logged in to reply to this topic.