Jump to content
Software FX Community

Problem in stack bar with line graph.


biswajit.bora

Recommended Posts

Hi I have encountered a problem while trying to set stack bar graph with line graph.

My problem is --> I have plotted a graph with...first 3 series with stack bar as gallery. Then 4 th series with line as gallery. And then again 5 th and 6 th series again with stack bar as gallery.

Now the problem is the last two bar graph i.e., 5 th and 6 th bar is comming as a seperate stack bar instead of a single one consisting of 1 st to 6 th.

 I can work around the problem by setting the last i.e. 6 th series as line one. But I want to mentain the order as is it, so that it won't effect the Legend order.

Please help.

 

Link to comment
Share on other sites

This is working as designed. A change in the gallery type will cause an automatic break in the stacked groups.

You need to put the line series as the first or last.

If you want to control the legend box so that it displays something different than what's on the chart, you can create your own Custom Items. The following code removes the standard series legend items from the legend box and adds custom items in a different order:

 

private void CustomizeLegendBox ()

{

// Remove standard series legend from legend boxchart1.LegendBox.ItemAttributes[chart1.Series].Visible = false;

AddSeriesAsCustomItem(chart1.Series[1]);

AddSeriesAsCustomItem(chart1.Series[2]);

AddSeriesAsCustomItem(chart1.Series[3]);

AddSeriesAsCustomItem(chart1.Series[4]);

AddSeriesAsCustomItem(chart1.Series[5]);

AddSeriesAsCustomItem(chart1.Series[0]);

// First series displayed last

private void AddSeriesAsCustomItem (SeriesAttributes series)

{

CustomLegendItem ci = new CustomLegendItem();

ci.Attributes = series;

ci.Color = series.Color;

chart1.LegendBox.CustomItems.Add(ci);

}

 

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...