Hi. I am attempting to produce a pie chart with support for negative values (I know this doesn't make sense but there we go..).
The pie itself does not need to have a segment for the series with a negative value though it does need a legend item.
I have tried two different methods of getting this to work and I have had some success but both have problems;
Solution #1 - Implement a second LegendItemSource that just returns a LegendItemCollection containing only LegendItem objects for the negative value(s).
The problem with this is that I need to offset the negative legend item(s) from the positive ones slightly (ie, have a couple lines of whitespace between them). Is there an easy way to do this apart from overriding the LegendTitle draw methods? See image below;
Solution #2 - Define a second LegendTitle object just for the negative values.
This solves the above problem of offsetting the legend items and makes it easier to treat them as a seperate 'group'. The problem however is that, when I want to left-align both LegendTitle objects, they appear side by side instead of on top of one another. I guess this makes sense but there is a easily enough room for them to be rendered on top of each other. From looking at hte source it seems that the first LegendTitle's rectangle extends right down to the bottom of the chart rather than just to where the list of legend items ends. Is there any way to achieve what I want to without too much pain?
Thanks.
Multiple LegendTitles or Mutliple LegendSource?
-
- Posts: 513
- Joined: Wed Sep 12, 2007 3:18 pm
Re: Multiple LegendTitles or Mutliple LegendSource?
You may be able to use the approach cited here.
-
- Posts: 1634
- Joined: Sat Feb 17, 2007 1:51 pm
Re: Multiple LegendTitles or Mutliple LegendSource?
You probably need to create a CompositeTitle.
Create a BlockContainer with a ColumnArrangement (so that the added Titles are stacked), add the two LegendTitles to the container, and finally use the BlockContainer to create a CompositeTitle.
Create a BlockContainer with a ColumnArrangement (so that the added Titles are stacked), add the two LegendTitles to the container, and finally use the BlockContainer to create a CompositeTitle.
Re: Multiple LegendTitles or Mutliple LegendSource?
Thanks to you both. I will have a look at both solutions and see which is the most appropriate for my case but both look like they will do the job.