private void chart_bind() { DataTable dt = new DataTable(); try { dt = GetData(); str.Append(@"<script type=text/javascript> google.load( *visualization*, *1*, {packages:[*corechart*]}); google.setOnLoadCallback(drawChart); function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('string', 'time'); data.addColumn('number', 'price'); data.addRows(" + dt.Rows.Count + ");"); Int32 i; for (i = 0; i <= dt.Rows.Count - 1; i++) { str.Append("data.setValue( " + i + "," + 0 + "," + "'" + dt.Rows[i]["time"].ToString() + "');"); str.Append("data.setValue(" + i + "," + 1 + "," + dt.Rows[i]["price"].ToString() + ") ;"); } str.Append(" var chart = new google.visualization.LineChart(document.getElementById('chart_div'));"); str.Append(" chart.draw(data, {width: 660, height: 300,title: '',"); str.Append("hAxis: {title: 'Time', titleTextStyle: {color: 'green'}}"); str.Append("}); }"); str.Append("</script>"); lt.Text = str.ToString().TrimEnd(',').Replace('*', '"'); } catch { } }
str.Append(" chart.draw(data, {backgroundColor: 'black', width: 660, height: 300,title: '',");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)