Arys Posted September 3, 2008 Report Share Posted September 3, 2008 Basically i create the fields and bind the datasource, all perfect, but then i want to loop thru the series to change their name and put the columns.caption. The first time the chart loads the names appear perfectly, but the rest of times the chart loads another datasource and/or goes back to the original datasource, i shows the name of the columns as the serie.text property. Do you know what should i do? I leave u here the code for better understanding //Create Fields MyChart.DataSourceSettings.Fields.Clear();MyChart.DataSourceSettings.Fields.Add(new FieldMap(data.Table.Columns[0].ColumnName, FieldUsage.NotUsed));MyChart.DataSourceSettings.Fields.Add(new FieldMap(data.Table.Columns[1].ColumnName, FieldUsage.Label));MyChart.DataSourceSettings.Fields.Add(new FieldMap(data.Table.Columns[2].ColumnName, FieldUsage.NotUsed));MyChart.DataSourceSettings.Fields.Add(new FieldMap(data.Table.Columns[3].ColumnName, FieldUsage.NotUsed));MyChart.DataSourceSettings.Fields.Add(new FieldMap(data.Table.Columns[4].ColumnName, FieldUsage.NotUsed));MyChart.DataSourceSettings.Fields.Add(new FieldMap(data.Table.Columns[5].ColumnName, FieldUsage.NotUsed)); //Every column from now on is Value //Analyzer.Columnar.ColumnsToSkipBeforeSeries = 6 (for u to know), that way i skip the first 6 columns that are not used, only 1 field for display AxisX names. for (int i = Analyzer.Columnar.ColumnsToSkipBeforeSeries; i < data.Table.Columns.Count; i++){MyChart.DataSourceSettings.Fields.Add(new FieldMap(data.Table.Columns.ColumnName, FieldUsage.Value));} //General Info and DataBinding MyChart.Gallery = Gallery.Bar;MyChart.LegendBox.Visible = false;MyChart.AxisX.Step = 3;MyChart.AxisX.Staggered = true;MyChart.DataSourceSettings.DataSource = data; //Change of the text property for (int i = 0; i < data.Table.Columns.Count; i++){ int iCounter = i + Analyzer.Columnar.ColumnsToSkipBeforeSeries;ChartFX.WinForms.SeriesAttributes serie = MyChart.Series;// === Set Series Legend ===serie.Text = data.Table.Columns[iCounter].Caption;}} Quote Link to comment Share on other sites More sharing options...
Arys Posted September 4, 2008 Author Report Share Posted September 4, 2008 Found the solution. At the moment of the field creation i modify the DisplayName of it and works great. for (int i = Analyzer.ColumnarFarmLoad.ColumnsToSkipBeforeSeries; i < data.Table.Columns.Count; {MyChart.DataSourceSettings.Fields.Add(new FieldMap(data.Table.Columns.ColumnName, FieldUsage.Value));MyChart.DataSourceSettings.Fields.DisplayName = data.Table.Columns.Caption;} 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.