Home Forums Chart Support Graphics not displayed in iOS7

Graphics not displayed in iOS7

Viewing 2 posts - 1 through 2 (of 2 total)
  • #5654

    Dear all,

    I have a code to display a line-graph which is display correctly in a Mac/PC but not in an iPhone/iPad.
    The code is this:

    
    <script type="text/javascript">
    window.onload = function () 
    	{
    		var chart = new CanvasJS.Chart("chartContainer",
    		{
    			zoomEnabled: true,
    			panEnabled: true, 
    			title:{ text: "Consum" },
    			legend: { horizontalAlign: "center", verticalAlign: "bottom" },
    			axisY:{ includeZero: false, interlacedColor: "rgba(144,238,144,0.2)", title: "KW", gridThickness: 0 },
    			data: data,  // random generator below
    		});
    		chart.render();
    	}
        var data = []; 
            var dataPoints = [
        { x: new Date('2014-01-21 11:52:34'), y: 0.23 },
    { x: new Date('2014-01-21 11:54:34'), y: 0.23 },
    { x: new Date('2014-01-21 11:56:34'), y: 0.23 },
    { x: new Date('2014-01-21 11:58:34'), y: 0.23 },
    ...
    { x: new Date('2014-01-23 08:49:34'), y: 0.14 },
    { x: new Date('2014-01-23 08:50:34'), y: 0.14 },
    ];
        	var dataSeries = { type: "line", showInLegend: true, legendText: "Consum P1 (12.02 KWh)" };
         dataSeries.dataPoints = dataPoints;
         data.push(dataSeries);
                   var dataSeries = { type: "line", showInLegend: true, legendText: "Mitjana de consum" };
        var dataPoints = [
        { x: new Date('2014-01-21 11:52:34'), y: 0.28 },
    { x: new Date('2014-01-21 11:54:34'), y: 0.28 },
    { x: new Date('2014-01-21 11:56:34'), y: 0.28 },
    ...
    { x: new Date('2014-01-23 08:49:34'), y: 0.28 },
    { x: new Date('2014-01-23 08:50:34'), y: 0.28 },
        	];
         dataSeries.dataPoints = dataPoints;
         data.push(dataSeries);            
      	</script>
    <script type="text/javascript" src="canvasjs.min.js"></script>
    <div id="chartContainer" style="height: 300px; width: 100%;"></div>
    

    As I mention, the code works fine in PC/Mac but not in iPhone/iPad. Could you give me a hint on what am I doing wrong?
    Thank you.

    #5655

    Pol,

    I just figured out the issue. Problem is that safari on iPhone/iPad doesn’t support dateString format that you are providing. Please refer this thread for various solutions available.

    Simplest solution would be to replace – with /
    So “2014-01-21 11:52:34” would become “2014/01/21 11:52:34”


    Sunil Urs

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

You must be logged in to reply to this topic.