本文介绍了在updatepanel中更新时没有显示谷歌图表c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
var Drugresult = objdb.FetchCommonDrugGraphOnSearch(fromdate,todate);
if (Drugresult.Count > 0 )
{
StrDrug.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','DrugName');
data.addColumn('number','Drug');
data.addRows( + Drugresult.Count + ););
Int32 i;
for (i = 0 ; i < ; = Drugresult.Count - 1 ; i ++)
{
StrDrug.Append( data.setValue( + i + , + 0 + , + ' + Drugresult [i] .DrugName + '););
StrDrug.Append( data.setValue( + i + , + 1 + , + Drugresult [i] .TotalCount.ToString()+ ););
}
StrDrug.Append( var chart = new google.visualization.BarChart(document。的getElementById( 'DivDrug'));跨度>);
StrDrug.Append( chart.draw(data,{width:400,height:300,title: 'No of Drug',);
StrDrug.Append( vAxis:{title :'Drug',titleTextStyle:{color:'green'}},);
StrDrug.Append( hAxis:{title:'Drug Name',titleTextStyle:{color:'green'}});
StrDrug.Append( }););
// StrDrug.Append(google.visualization.events.addListener(chart,'select',function) (){var selection = chart.getSelection(); var row = selection [0] .row; var col = selection [0] .column; var year = data.getValue(row,0); location.href ='。 ./Report.ascx?date='+ year +'& type = 1';}););
StrDrug.Append( });
StrDrug.Append( < / script>);
LiteralDrug.Text = StrDrug.ToString()。TrimEnd(' ,')。 (' *',' ');
}
解决方案
这篇关于在updatepanel中更新时没有显示谷歌图表c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!