Hi,
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.
————————————————————————————-
<form>
<body background="Common/BG.jpg" leftmargin=0 rightmargin=0 topmargin=0
<div>
<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>
</table>
</div>
<div id="dvResults" style="width: 2000px; height: 1000px;></div>
<div id="chartContainer" style="height: 800px; width: 100%;"></div>
</form>
<! 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;
chart.render();
}
</script>
——————————————————————–