google-code-export / googlevisualizationsdotnet

Automatically exported from code.google.com/p/googlevisualizationsdotnet
1 stars 0 forks source link

Error when GviColors is specified on GVAreaChart #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Bind DataTable with 4 columns to the chart: 
   dt.Columns.Add("Month");
   dt.Columns.Add("Consumption", typeof(double));
   dt.Columns.Add("Goal", typeof(double));
   dt.Columns.Add("Baseline", typeof(double));
   this.GVAreaChart1.ChartData(dt);
2. Create a nullable System.Drawing.Color array and assign it to the GviColors 
property:
   System.Drawing.Color?[] colors = new    System.Drawing.Color?[3];
   colors[0] = System.Drawing.Color.Blue;
   colors[1] = System.Drawing.Color.Green;
   colors[2] = System.Drawing.Color.Yellow;
   this.GVAreaChart1.GviColors = colors;
3. Run the project

What is the expected output? What do you see instead?
I expect to get a chart with the colors specified in the array, instead I get 
an Invalid Cast Exception

What version of the product are you using? On what operating system?
Latest on Windows 7

Please provide any additional information below.

[InvalidCastException: La conversión especificada no es válida.]
   GoogleChartsNGraphsControls.BaseGVI.RenderGVIConfigOptions(WebControl PageControl) in C:\Documents and Settings\kingj5\My Documents\Visual Studio 2008\Projects\googlevisualizationsdotnet\GoogleChartsNGraphsControls\BaseGVI.cs:341
   GoogleChartsNGraphsControls.BaseGVI.RegisterGVIScriptsEx(BaseWebControl PageControl, DataTable dt, GOOGLECHART CHARTTYPE) in C:\Documents and Settings\kingj5\My Documents\Visual Studio 2008\Projects\googlevisualizationsdotnet\GoogleChartsNGraphsControls\BaseGVI.cs:194
   GoogleChartsNGraphsControls.GVAreaChart.RenderContents(HtmlTextWriter output) in C:\Documents and Settings\kingj5\My Documents\Visual Studio 2008\Projects\googlevisualizationsdotnet\GoogleChartsNGraphsControls\GVAreaChart.cs:264
   System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +32
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
   System.Web.UI.Control.Render(HtmlTextWriter writer) +10
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
   System.Web.UI.Control.Render(HtmlTextWriter writer) +10
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
   System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +163
   System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32
   System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +51
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
   System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +40
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
   System.Web.UI.Control.Render(HtmlTextWriter writer) +10
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
   System.Web.UI.Page.Render(HtmlTextWriter writer) +29
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266

Original issue reported on code.google.com by carlosol...@gmail.com on 4 Nov 2011 at 5:23

GoogleCodeExporter commented 9 years ago
I see that you marked this as fixed.  Did you fix the code?  If so lets check 
your fix in.  If not let me know and ill try to fix it.

Original comment by hoolmank@gmail.com on 7 Nov 2011 at 9:05

GoogleCodeExporter commented 9 years ago
Nevermind the last comment.  Just learning this system myself.  Thank you for 
the write up I will try and fix this.

Original comment by hoolmank@gmail.com on 8 Nov 2011 at 12:05

GoogleCodeExporter commented 9 years ago
Fixed.  You can now do this:  this.GVBarChart1.GviColors = new 
System.Drawing.Color?[] { Color.MediumAquamarine, Color.LightCyanh };

or do 

GviColorsByName="Red Green Blue Orange" 

thanks for using it!!!

Original comment by hoolmank@gmail.com on 8 Nov 2011 at 12:53

GoogleCodeExporter commented 9 years ago
Thank you!

Original comment by carlosol...@gmail.com on 8 Nov 2011 at 1:02