Home forums Using CanvasJS Passing the data to Canvas -Javascript+html

This topic contains 1 reply, has 1 voice, and was last updated by  thenvk 6 months, 2 weeks ago.

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



    I am trying to build a small page, where I will connect to the MS access data base using javascript and the results will be displayed in a grid format and canvas as well. I was able to generate the data points in the required format for the graph, but the graph is not getting generated. Can some one help for this.

    <body background="Common/BG.jpg" leftmargin=0 rightmargin=0 topmargin=0
    <Table><tr><td width=33%><font face="helvetica" size=2 color=navy><b>Count<input type="text" id="count" value="" /></tr>
    <tr><td><input type="Submit" value="Search" style="width: 175px" onclick="return GetSearchData2('count')"/></tr>
    <div id="dvResults" style="width: 2000px; height: 1000px;></div>
    <div id="chartContainer" style="height: 800px; width: 100%;"></div>
    <! Begin server side script here>
    <script type="text/javascript" src="Common/Database/CommonJs.js"></script>
    <script type="text/javascript" src="Common/Database/canvasjs.min.js"></script>
    <script type="text/javascript">
    function GetSearchData2(count)
    	var strHtml="sql query results in table format";
    	document.getElementById("dvResults").innerHTML = strHtml;  // This is to show the data in table format
    	var finaldata; // this is the data input for the chart in the format from the query . Ex:- { x: 10, y: 71 }, { x: 20, y: 55}, { x: 30, y: 50 }
    //Now passing this data to the chart to render it in the same function
    	var chart = new CanvasJS.Chart("chartContainer",
          data: [
            type: "column",
            [dataPoints:  finaldata
    document.getElementById("dvResults").innerHTML = strHtml;




    Just to add more info , the chart is taking my data as input . When I alerted before chart.render(); , I can see [object Object]. But the chart is not getting rendered in the page. Can some one please help.

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

You must be logged in to reply to this topic.