Jump to content
Software FX Community

SeriesAttributes.Text not refreshing correctly


Arys

Recommended Posts

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;
}
}

Link to comment
Share on other sites

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;
}

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...