Jump to content
Software FX Community

Legend Not Clearing Out Correctly.


IDalton
 Share

Recommended Posts

I am trying to refresh the grid and legend. When I try to refresh the grid it clears fine and the new data shows up but the legend keeps on adding more series and not matter what I do I can't seem to stop it adding more series instead of just showing one which is what I want.

I'm using chart1.Data.Clear() to clear the grid and legend,but the legend is not getting cleared.  what syntax do I need to get this to work?

Thanks

Ian

Link to comment
Share on other sites

I added that line of code and it didn't help my issue.  Everytime I rerun the process to load the chart it just adds another series.  Here is my code please let me know what I am missing (for some reason everytime I paste my code it duplicates!)

chartWARF.Data.Clear()

chartWARF.Series.Clear()

chartWARF.Gallery = ChartFX.WinForms.Gallery.Lines

chartWARF.DataSourceSettings.Fields.Add(New FieldMap("StartDate", FieldUsage.XValue))

chartWARF.DataSourceSettings.Fields.Add(New FieldMap("Result", FieldUsage.Value))

chartWARF.AxisY.Step = 50

chartWARF.AxisY.Min = Min - 100

chartWARF.AxisY.Max = Max + 100

chartWARF.DataSource = dsChartWARF.Tables("Data")

chartWARF.AxisY.Step = 50

chartWARF.AxisY.Min = Min - 100

chartWARF.AxisY.Max = Max + 100

chartWARF.DataSource = dsChartWARF.Tables("Data")

chartWARF.DataSourceSettings.Fields.Add(New FieldMap("Result", FieldUsage.Value))

chartWARF.AxisY.Step = 50

chartWARF.AxisY.Min = Min - 100

chartWARF.AxisY.Max = Max + 100

chartWARF.DataSource = dsChartWARF.Tables("Data")

chartWARF.AxisY.Step = 50

chartWARF.AxisY.Min = Min - 100

chartWARF.AxisY.Max = Max + 100

chartWARF.DataSource = dsChartWARF.Tables("Data")

Link to comment
Share on other sites

Here is the problem:

chartWARF.DataSourceSettings.Fields.Add(New FieldMap("StartDate", FieldUsage.XValue))

chartWARF.DataSourceSettings.Fields.Add(New FieldMap("Result", FieldUsage.Value))

You are adding these every time. You need to clear the Fields Collection.

chartWARF.DataSourceSettings.Fields.Clear();

If you want to start over.

 

Link to comment
Share on other sites

  • 5 months later...

How about for a statistics legend because I can clear everything but the legend?  I end up with two legends on my postback:

my code:

ControlChart.DataSourceSettings.Fields.Clear()

ControlChart.Series.Clear()

Dim statisticsControl As Statistics = New Statistical.Statistics

statisticsControl.Studies.Clear()

statisticsControl.Chart = ControlChart

statisticsControl.Chart.Data.Clear()

statisticsControl.LegendBox.Visible =

True

 

ControlChart.Data.Clear()

ControlChart.Titles.Clear()

ControlChart.LegendBox.Visible = False

 Please help?

 

Link to comment
Share on other sites

Hi all,

 I Have some pb with Legend when I change my binding object

I'm doing like that :

chart1.Reset();

chart1.Data.Clear();chart1.Series.Clear();

chart1.AxesX.Clear();

chart1.AxesY.Clear();

 

chart1.DataSourceSettings.Fields.Clear();

chart1.Extensions.Clear();ChartFX.WinForms.DataProviders.ListProvider l = new ListProvider(list);

CrosstabDataProvider cfxCT = new CrosstabDataProvider();cfxCT.DataSource = l;

 

chart1.DataSourceSettings.Fields.Add(new FieldMap("name", FieldUsage.ColumnHeading));

chart1.DataSourceSettings.Fields.Add(new FieldMap("date", FieldUsage.RowHeading));

chart1.DataSourceSettings.Fields.Add(new FieldMap("Last", FieldUsage.Value));

chart1.DataSourceSettings.DataSource = cfxCT;

 

but I have always the same Legend :)

Thank you for any help

 

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.

 Share

×
×
  • Create New...