Draw params are missing

Feb 18, 2011 at 9:23 PM
Edited Feb 18, 2011 at 9:24 PM

Hello,

I am using VS 2010. I just copied you sample to content page:

 <gvapi:googlevisualization ID="GVAPI" runat="server" />

<gvapi:googlecontainer ID="visLineChart" ClassName="visualization" runat="server" />

 

            DataTable dt1 = new DataTable();
            dt1.AddDataColumn(new DataColumn() { DataType = DataType.String, Name = "Date" });
            dt1.AddDataColumn(new DataColumn() { DataType = DataType.Number, Name = "Russia" });
            dt1.AddDataColumn(new DataColumn() { DataType = DataType.Number, Name = "Usa" });
            dt1.AddDataColumn(new DataColumn() { DataType = DataType.Number, Name = "Germany" });
            dt1.AddDataCell(new DataCell() { Caption = "01/03/2009", Value = new List<string> { "123", "30", "144" } });
            dt1.AddDataCell(new DataCell() { Caption = "01/06/2009", Value = new List<string> { "50", "60", "40" } });
            dt1.AddDataCell(new DataCell() { Caption = "01/09/2009", Value = new List<string> { "80", "180", "80" } });
            dt1.AddDataCell(new DataCell() { Caption = "01/12/2009", Value = new List<string> { "150", "50", "120" } });
            GVAPI.Visualization.Add(new Visualization() { Package = VisualizationPackage.LineChart, DataTable = dt1, DestObjectName = this.visLineChart.ID });

But on page source draw parameters are missing, and chart don't come up.:

 

<script type="text/javascript">
  function drawVisualization() {
  var data0 = new google.visualization.DataTable();
  data0.addColumn('string', 'Date');
  data0.addColumn('number', 'Russia');
  data0.addColumn('number', 'Usa');
  data0.addColumn('number', 'Germany');
  data0.addRows(4);
  data0.setCell(0, 0, '01/03/2009');
  data0.setCell(0, 1, 123);
  data0.setCell(0, 2, 30);
  data0.setCell(0, 3, 144);
  data0.setCell(1, 0, '01/06/2009');
  data0.setCell(1, 1, 50);
  data0.setCell(1, 2, 60);
  data0.setCell(1, 3, 40);
  data0.setCell(2, 0, '01/09/2009');
  data0.setCell(2, 1, 80);
  data0.setCell(2, 2, 180);
  data0.setCell(2, 3, 80);
  data0.setCell(3, 0, '01/12/2009');
  data0.setCell(3, 1, 150);
  data0.setCell(3, 2, 50);
  data0.setCell(3, 3, 120);
  new google.visualization.LineChart(document.getElementById('visLineChart')).draw(data0, );
  }
  google.setOnLoadCallback(drawVisualization);
  </script>
Thank you.

 

Feb 18, 2011 at 9:35 PM

Dont know what you do in your project, but in my sample all working fine.

I can only advise: see my code carefully

Feb 18, 2011 at 9:57 PM

I added your sample to new project, result is same: last {} is missing.

new google.visualization.LineChart(document.getElementById('visLineChart')).draw(data0, );

new google.visualization.PieChart(document.getElementById('visPieChart')).draw(data1, );

new google.visualization.OrgChart(document.getElementById('visOrgChart')).draw(data2, );

new google.visualization.AnnotatedTimeLine(document.getElementById('visAnnotatedTimeLine')).draw(data3, );

 

Is any problem using VS 2010?

Feb 18, 2011 at 9:59 PM

i just download and run sample project at vs2010 all working fine.

Feb 18, 2011 at 10:06 PM
Edited Feb 18, 2011 at 10:10 PM

Alexander,

Is any parameter is missing in 

GVAPI.Visualization.Add(new Visualization() { Package = VisualizationPackage.LineChart, DataTable = dt1, DestObjectName = this.visLineChart.ID });

like DisplayOptions

in Visualization class? What values it takes?

public string DisplayOptions { get; set; }


Feb 18, 2011 at 10:15 PM

i make patch, download new binary here:

http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=gvapi4aspnet&DownloadId=209264

if it helps you, i update source.

Feb 18, 2011 at 10:18 PM

Yep, it helped. Thanks.

Spasibochki.