This project is read-only.
1
Vote

RectangleBarSeries rendered on top layer

description

Hello

I'm using the RectangleBarSeries as a trick to display columns on a DateTimeAxis. It works fairly well but it seems these series are drawn on top of every other series. So if you mix LineSeries and RectangleBarSeries, the rectangles appear to be on top and prevent any tracker event on the LineSeries.

As it works fine with AreaSeries instead of RectangleBarSeries, I guess this shouldn't be too big of a problem. I don't know if there's a way to specify a layer for series, like there is for annotations...

comments

CyberLoupGarou wrote Jul 30, 2014 at 12:56 PM

Forgot to say that I'm using the WPF version.

objo wrote Aug 6, 2014 at 10:01 AM

Can you provide code that shows the error? I tried the following code and cannot reproduce:
        [Example("#10236: RectangleBarSeries rendered on top layer")]
        public static PlotModel RectangleBarSeriesRenderedOnTopLayer()
        {
            var plotModel1 = new PlotModel
            {
                Title = "Issue 10236",
            };
            var lineSeries1 = new LineSeries();
            lineSeries1.Points.Add(new DataPoint(0, 1));
            lineSeries1.Points.Add(new DataPoint(1, 0));
            plotModel1.Series.Add(lineSeries1);
            var rectangleBarSeries1 = new RectangleBarSeries();
            rectangleBarSeries1.Items.Add(new RectangleBarItem(0.25, 0.25, 0.75, 0.75));
            plotModel1.Series.Add(rectangleBarSeries1);
            var lineSeries2 = new LineSeries();
            lineSeries2.Points.Add(new DataPoint(0, 0));
            lineSeries2.Points.Add(new DataPoint(1, 1));
            plotModel1.Series.Add(lineSeries2);
            return plotModel1;
        }
The rectangleBarSeries1 is shown above lineSeries1 and below lineSeries2, as expected.

objo wrote Aug 7, 2014 at 9:49 AM

I added the example to ExampleLibrary -> Issues

CyberLoupGarou wrote Aug 7, 2014 at 10:34 AM

I tweaked my code a bit, making sure I add the RectangleBarSeries first so they are "under" the other series. And I think they are correctly rendered.

But the tracker (that I've set to appear on mouseover) seems confused about the series to show. It is true it's over two different series. As I type this, I think I have the idea why it always show the RectangleBarSeries. It always "enters" the RectangleBarSeries first, and doesn't leave it before going over the LineSeries. That might explain why it always choose to show the series "behind". I might be stretching things a bit with what I'm trying to do ;)

I'll test it with the default tracker behaviour (the click) to see if the problem remains.

Do you think I should post in the discussions the way I "trick" to display columns series on a LinearAxis? I've also managed to do bubble series. Your library is really something well done.

CyberLoupGarou wrote Aug 8, 2014 at 7:16 AM

Ok, it is indeed the tracker event and not the rendering that causes the problem. Sorry to have wrongly identified the problem.

Once I set the tracker to behave as usual, if I click on the line when it is not over the rectangle, the tracker is able to follow the LineSeries over RectangleBarSeries.