Home Forums Chart Support number after the decimal point

number after the decimal point

Viewing 6 posts - 1 through 6 (of 6 total)
  • #44063

    Hi, on my dynamic temperature graph I only have numbers without commas displayed, it goes from 9 to 10 for example without putting 9.2. Thanks for your help.

    #44086

    @rafdu01,

    You can set valueFormatString: "#0.0" to show 1 decimal value in the axis labels. Please refer to our documentation page for more customization options available.

    —-
    Manoj Mohan
    Team CanvasJS

    #44099

    Thanks for your help but it doesn’t work.

    Link graph

    Here is my code:

    window.onload = function () {
    	var chart = new CanvasJS.Chart("chartContainer",
    	{ backgroundColor: "#D5DBDB",
     interactivityEnabled: false,	 
    	 zoomEnabled: false,
          zoomType: "x",
          title:{
            text: "Graphique vent "
          },
    		title:{
    			text:"Graphique Vent",
    		},
    		axisX: {
    		labelAutoFit: true,				
            interval: 50,
    		title: "",
    		crosshair: {
            enabled: false
          }
    	},
    	axisY: {
    		valueFormatString: "#0.0",		
    		title: "Km/h",
    		 interval: 0.1,
    	},
    
    		data: [{
    			type: "spline",
     color: "red",
    			dataPoints : [],
    		},
    		]
    	});
    
    	function updateChart() {
    		$.getJSON("service2.php", function(data) {		
    			chart.options.data[0].dataPoints = [];
    			$.each((data), function(key, value){
    			
    				chart.options.data[0].dataPoints.push({label: value[0], y: parseInt(value[1])
    				})
    				if (chart.options.data[0].dataPoints.length > 350 ) {
       chart.options.data[0].dataPoints.shift();
     };					
    			});	
    
    			chart.render();
    			
    			updateChart();
    		});
    	}
    
    	setInterval(function(){updateChart()}, 2000);
    		 
    }
    #44105

    @rafdu01,

    Can you kindly brief us more about your requirements, the format in which you would like to show the labels (9.0, 9.2, 9.4,…, 10 or 9, 10, 11,…) so that we can understand your scenario better and help you out?

    —-
    Manoj Mohan
    Team CanvasJS

    #44108

    I want my graph to display numbers with a decimal point, for example 9.6, 9.7. currently the line on my graph goes from 6 to 7 even if my figure is 6.4.

    #44121

    @rafdu01,

    To display numbers after decimal point in the axis labels, you can use valueFormatString. Also, if you are looking to format the values in the tooltip, you can use yValueFormatString.

    If you are still facing the issue, can you kindly share the pictorial representation of your requirement so that we can understand your scenario better and help you out?

    —-
    Manoj Mohan
    Team CanvasJS

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

You must be logged in to reply to this topic.