Home forums Chart Support How to remove json source ?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #32408

    Hello,
    I’m trying to remove the json source from your example “synchronized charts” , the static datasource works but when I remove the json file in order to work offline, it desn’t work, Can you help ?
    I want remove this part :

       $.get("https://canvasjs.com/data/gallery/javascript/server-matrics.json", function(data) {
        for (var i = 1; i < data.length; i++) {
          systemDps.push({x: parseInt(data[i].time), y: parseFloat(data[i].system)});
          userDps.push({x: parseInt(data[i].time), y: parseFloat(data[i].user)});
          waitDps.push({x: parseInt(data[i].time), y: parseFloat(data[i].wait)});
          buffersDps.push({x: parseInt(data[i].time), y: parseFloat(data[i].buffers)});
          cacheDps.push({x: parseInt(data[i].time), y: parseFloat(data[i].cache)});
          usedDps.push({x: parseInt(data[i].time), y: parseFloat(data[i].used)});
          inboundDps.push({x: parseInt(data[i].time), y: parseFloat(data[i].inbound)});
          outboundDps.push({x: parseInt(data[i].time), y: parseFloat(data[i].outbound)});
          writeDps.push({x: parseInt(data[i].time), y: parseFloat(data[i].write)});
          readDps.push({x: parseInt(data[i].time), y: parseFloat(data[i].read)});
        }
        for( var i = 0; i < charts.length; i++){
          charts[i].options.axisX = {
            labelAngle: 0,
            crosshair: {
              enabled: true,
              snapToDataPoint: true,
              valueFormatString: "HH:mm"
            }
          }
        }
    
        syncCharts(charts, true, true, true); // syncCharts(charts, syncToolTip, syncCrosshair, syncAxisXRange)
    
        for( var i = 0; i < charts.length; i++){
          charts[i].render();
        }
    
      });  
    
    • This topic was modified 2 weeks, 2 days ago by punchilla. Reason: code
    #32410

    Hello,
    it was simple :)
    just this code works :

    
        for( var i = 0; i < charts.length; i++){
          charts[i].options.axisX = {
            labelAngle: 0,
            crosshair: {
              enabled: true,
              snapToDataPoint: true,
              valueFormatString: "HH:mm"
            }
          }
        }
    
        syncCharts(charts, true, true, true); // syncCharts(charts, syncToolTip, syncCrosshair, syncAxisXRange)
    
        for( var i = 0; i < charts.length; i++){
          charts[i].render();
        }
    
    #32418

    @punchilla,

    Glad you figured it out :)

    ___________
    Indranil Deo
    Team CanvasJS

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

You must be logged in to reply to this topic.