Home forums Chart Support Can store the information related to the drawing according to certain condition

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #30844

    I hope to help me … The problem is that I want the user to enter a literal string that contains only 0 and 1 .. and a function that begins to process this string .. If it finds 0, it stores certain data and if it finds 1 other data .. How is this done? ?? ..

    `function start() {
    var chart = new CanvasJS.Chart(“chartContainer”);

    chart.options.title = { text: “Fruits sold in First & Second Quarter” };

    var series1 = { //dataSeries – first quarter
    type: “column”,
    name: “First Quarter”,
    showInLegend: true
    };

    var series2 = { //dataSeries – second quarter
    type: “column”,
    name: “Second Quarter”,
    showInLegend: true
    };

    chart.options.data = [];
    chart.options.data.push(series1);
    chart.options.data.push(series2);

    series2.dataPoints = [
    //Here I want to put the condition to fill in the information
    ];

    chart.render();
    }
    start();

    #30871

    @mouhadz44,

    You can iterate through the string and use JavaScript chartAt method to find the character at a given index. You can parse it to float / integer, before passing it to datapoint y-value.

    If you are still facing the issue, kindly create JSFiddle reproducing the issue you are facing along with sample data and share it with us so that we can look into the code / chart-options being used, run it at our end to understand the use-case better and help you out.

    —-
    Manoj Mohan
    Team CanvasJS

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

You must be logged in to reply to this topic.