Jump to content
Software FX Community

How to remove a particular series


User (Legacy)

Recommended Posts

This seems like it should be simple. I am adding series to a chart one at a

time using the Open/Close methods

chart1.OpenData(SoftwareFX.ChartFX.COD.Values | ChartFx.COD.AllocHidden,

seriesInChart, xyDataCollection.XLength);

chart1.OpenData(SoftwareFX.ChartFX.COD.XValues | ChartFx.COD.AllocHidden,

seriesInChart, xyDataCollection.XLength);

... add the x and y values ...

chart1.CloseData(SoftwareFX.ChartFX.COD.Values | ChartFx.COD.AllocHidden);

chart1.CloseData(SoftwareFX.ChartFX.COD.XValues | ChartFx.COD.AllocHidden);

But I can't figure out how to delete just one of the series. I've tried

things like the following but no success:

int seriesNumber = 3;

chart1.OpenData(SoftwareFX.ChartFX.COD.Values |

SoftwareFX.ChartFX.COD.Remove, seriesNumber, xyDataCollection.XLength);

chart1.CloseData(SoftwareFX.ChartFX.COD.Values);

Can you help? Thanks.

Mitch

Attachments.zip

Link to comment
Share on other sites

When I re-arrangle (good term) my data, can I keep the attributes of each

series that is moved around. For example if I have 7 series and I want to

remove the fifth series. I delete series 7, 6 and 5, then re-add 7 and 6. Is

there a way to conveniently save 6 and 7 or do I just need to always kepp

the source data so I can build up 6 and 7 from scratch again? Can I save the

series attributes objects so I can restore those too?

Thanks

Mitch

"SoftwareFX Support" <noreply@softwarefx.com> wrote in message

news:%23%23HYxan9DHA.2804@webserver3.softwarefx.com...

> You can only physically remove the LAST series by doing:

>

> chart1.OpenData(COD.Values,chart1.NSeries-1,0);

> chart1.CloseData(COD.Values);

>

> To remove/insert other series you have to re-arrangle your data.

>

> You can also Hide/Show series by doing:

>

> chart1.Series[<index>].Visible = <true/false>;

>

> --

> FP

> Software FX

>

>

Link to comment
Share on other sites

Interesting question !

Fortunately, the series attributes are stored in a collection (unlike the

chart's data which is all stored in a big chunk of memory).

If you do:

chart.Series.RemoveAt(4); // Remove 5th series

You will get what you want.

Notice, that attributes that you have NOT set, may change when the series

are shifted. For example, the default color of a series depends on its

index, if you haven't set the color of series past the 5th, these series

will change colors as they will take the appropriate palette entry for the

series index that they now represent. If you have set the color, this will

not be the case.

--

FP

Software FX

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...