Home forums Using CanvasJS Multiple charts Json datas not

Tagged: ,

This topic contains 5 replies, has 2 voices, and was last updated by  Suyash Singh 1 week, 2 days ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #17849

    cancmgz
    Member

    my used chart : https://canvasjs.com/javascript-charts/spline-chart-legends/
    how to json datas ? I search but I could not find.

    var dbs = [];
            $.getJSON("/Reports/TrendReport", function (data_points) {
                for (var i = 0; i < data_points.length; i++) {
                    chart.options.data[0].dbs.push(data_points[i]);
                }
    
                chart.render();
            });

    please help. i ate my head :/

    #17850

    cancmgz
    Member

    i need to:

    data: [
                    {
                        type: "spline",
                        showInLegend: true,
                        name: "Test1",
                        xValueFormatString: "DD MMM, YYYY",
                        color: "#F08080",
                        dataPoints: [
                             { label: "13.11.2017", y: 101 },
                            { label: "14.11.2017", y: 103 },
                            { label: "15.11.2017", y: 102 }
    
                        ]
                    },
                    {
                        type: "spline",
                        showInLegend: true,
                        name: "Test55",
                        xValueFormatString: "DD MMM, YYYY",
                        color: "#4280f4",
                        dataPoints: [
                            { label: "13.11.2017", y: 101 },
                            { label: "14.11.2017", y: 103 },
                            { label: "15.11.2017", y: 102 }
    
                        ]
                    }
    ]

    thanks in advance.

    #17860

    Suyash Singh
    Moderator

    @cancmgz,

    Please have a look at this jsfiddle.

    ___
    Suyash Singh
    Team CanvasJS

    #17871

    cancmgz
    Member

    @Suyash Singh

    Thank you but will be more than 2, it needs to be dynamic :/

    #17876

    cancmgz
    Member

    i ask you ` data: [
    {
    type: “spline”,
    dataPoints: dps1
    },
    {
    type: “spline”,
    dataPoints: dps2
    }
    ]` this block have to dynamic. How to create another dynamic block and how to declare a name in this block.

     {
                        type: "spline",
                        showInLegend: true,
                        name: "Test1",
                        xValueFormatString: "DD MMM, YYYY",
                        color: "#F08080",
                        dataPoints: [
                             { label: "13.11.2017", y: 101 },
                            { label: "14.11.2017", y: 103 },
                            { label: "15.11.2017", y: 102 }
    
                        ]
                    }

    this my format but i have to extend too many blocks in Data: block

    #17879

    Suyash Singh
    Moderator

    @cancmgz,

    Please take a look at this jsfiddle on creating Dynamic Chart from JSON. You can add as many data series as required by adding it to the data array.

    ___
    Suyash Singh
    Team CanvasJS

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

You must be logged in to reply to this topic.