Home forums Using CanvasJS Pass date ranger in Pie Chart

This topic contains 1 reply, has 2 voices, and was last updated by  Sunil Urs 2 years ago.

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

    Wahab
    Participant

    Hi,
    My CanvasJs chart loads and works perfectly. i am trying to pass date parameter to the query so that the chart loads value based on the date range i select. Below are my code ,
    ` var fromdate = $(“#frmdate”).val();
    //alert(fromdate);
    var todate = $(“#todate”).val();
    //alert(todate);

    var orderqty = $.getJSON(“samplemasterfile.php?method=getorderqty&fromdate=”+fromdate+”&todate=”+todate, function (result) {

    var chart1 = new CanvasJS.Chart(“OrderChart”,
    {
    title:{
    text: “Order Quantity”
    },
    legend:{
    verticalAlign: “bottom”,
    horizontalAlign: “center”,
    fontSize: 15,
    fontFamily: “Times New Roman”,
    fontWeight: “normal”
    },
    theme: “theme2″,
    toolTip:{
    content: function(e){
    var content;
    content = e.entries[0].dataSeries.legendText + ” “+e.entries[0].dataPoints.y + “” ;
    return content;
    }
    },
    data: [
    {
    type: “pie”,
    indexLabelFontFamily: “Times New Roman”,
    indexLabelFontSize: 15,
    //indexLabel: “{label} {y}%”,
    indexLabel: “{y}”,
    startAngle: -80,
    showInLegend: true,
    toolTipContent:”{legendText} {y}”,
    dataPoints: result
    }
    ]
    });
    chart1.render();
    });’

    here i am trying to pass fromdate and todate to the query. please throw some light.
    Many thanks

    #7589

    Sunil Urs
    Keymaster

    Wahab,

    What is the issue that you are facing here? Also can you please create jsfiddle with some dummy values so that we can have a look?


    Sunil Urs

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

You must be logged in to reply to this topic.