KevinUK Posted June 19, 2007 Report Share Posted June 19, 2007 Hi Frank I have another problem. When using RenderFormat="Image" the chart (in IE7 and Firefox 2) renders successfully as a PNG with clientside imagemap. Howvever when I mopuseover the chart image and right click the mouse and toggle on the Toolbar I get 'duplicate series' displaye din the legend. For example for a have two series called 'Series 1' and 'Series 2' then after toggling on the toolbar I get four items in the legend box, my normal Series 1 & 2 and a further Series 1 & 2. At this point I only have two series charted as prior to toggling on the toolbar. If I now right mouse click again and toggle on the datagrid I then get two further entries displayed in the legend box i.e. three 'Series 1' items and three 'Series 2' items. I also puzzlingly at this point get a further series displaye don the chart but ONLY for Series 1. Any ideas as to what is happening here and how to avoid it? Regards KevinUK Quote Link to comment Share on other sites More sharing options...
KevinUK Posted June 19, 2007 Author Report Share Posted June 19, 2007 Frank I just read a thread where someone is having a similar problem. Herte a snippet from my code behind file for the page string mySelectQuery = SQLstring; string dataPath = Path.Combine(Server.MapPath("App_Data"), "TrackData.mdb"); string myConnectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0; Data Source={0};", dataPath); System.Data.OleDb.OleDbConnection myConnection = new System.Data.OleDb.OleDbConnection(myConnectionString); System.Data.DataSet ds = new System.Data.DataSet(); System.Data.OleDb.OleDbDataAdapter adapter = new System.Data.OleDb.OleDbDataAdapter(mySelectQuery, myConnection); adapter.Fill(ds, "Trackdata"); Chart1.DataSourceSettings.Fields.Add(new FieldMap("Yards", FieldUsage.XValue)); if (selRunDate1 == selRunDate2) { Chart1.DataSourceSettings.Fields.Add(new FieldMap(selChannel1, FieldUsage.Value)); Chart1.DataSourceSettings.Fields.Add(new FieldMap(selChannel2, FieldUsage.Value)); } else { Chart1.DataSourceSettings.Fields.Add(new FieldMap(ddlRunDate1.Text, FieldUsage.Value)); Chart1.DataSourceSettings.Fields.Add(new FieldMap(ddlRunDate2.Text, FieldUsage.Value)); } // Assign the data source to the chart Chart1.DataSource = ds.Tables[0]; // This setting instructs Chart FX to use 2 decimals for the data labels Chart1.AxisY.DataFormat.Decimals = 2; As you can see I'm using a OleDb Dataset/DataAdapter as the source for the Chart (using very similar code to that in the PassThru sample). This code comes from a function called UpdateChart which is called when I click a button on the web form called 'Update chart'. Prior to calling this UpdateChart function I call another function called ResetChart which contains the following code snippet string tempChartPath = Path.Combine(Server.MapPath("App_Data"), "tempChart.bin"); Chart1.Import(FileFormat.Binary, tempChartPath); Chart1.Data.Clear(); Hope this helps to identify the problem.Regards KevinUK Quote Link to comment Share on other sites More sharing options...
Frank Posted June 19, 2007 Report Share Posted June 19, 2007 You are missing: Chart1.DataSourceSettings.Fields.Clear(); Otherwise you will be adding more fields every time this method runs. Quote Link to comment Share on other sites More sharing options...
KevinUK Posted June 19, 2007 Author Report Share Posted June 19, 2007 Once again thanks Frank That did the trick! Regards KevinUK Quote Link to comment Share on other sites More sharing options...
Frank Posted June 23, 2007 Report Share Posted June 23, 2007 Yes. Data.Clear clears the data currently in the chart, it dos not clear the Fields collection, which is going to be used in the next databinding. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.