BarSeries change color for some bars

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
Igor
Posts: 67
Joined: Mon Sep 28, 2015 1:14 pm

BarSeries change color for some bars

Post by Igor » Fri Jun 24, 2016 12:55 pm

Hi,

is it possible to change color of each bar in BarSeries for example when a value is above a threshold.

# edited in paint
BarSeries_Bar_Color.png
BarSeries_Bar_Color.png (37.61 KiB) Viewed 10174 times
thanks
Igor

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: BarSeries change color for some bars

Post by ArctionPasi » Mon Jun 27, 2016 7:01 am

Hi Igor,

that's very difficult question. Two approaches come to my mind now:

1) Creating one bar series for each color, and setting the data items in series by the color
2) StockSeries allows coloring by CustomStockDataAppearance event. Maybe replacing BarSeries with stock series would suit your application.
LightningChart Support Team, PT

Igor
Posts: 67
Joined: Mon Sep 28, 2015 1:14 pm

Re: BarSeries change color for some bars

Post by Igor » Wed Jun 29, 2016 7:26 am

1) I've created 3 BarSeries (one for default, one for warning level => Orange, and one for error level => Red). The bar values has the same indices. Now the bars are drawn side by side. Is it possible to overlay a BarSeries with the other?
In my mind I thought I would limit the specific bar series values to the threshold value and show instead another BarSeries value.

2) What's about the performance. Could I get performance issues with about 500-800 "bars" using e.g. NVidia GTX 950 and Core i7 4.Gen.

Igor
Posts: 67
Joined: Mon Sep 28, 2015 1:14 pm

Re: BarSeries change color for some bars

Post by Igor » Wed Jun 29, 2016 9:16 am

what if I use a BarSeries for each value? So I could change the color for each bar.

ArctionKestutis
Posts: 552
Joined: Mon Mar 14, 2016 9:22 am

Re: BarSeries change color for some bars

Post by ArctionKestutis » Wed Jun 29, 2016 12:41 pm

Hi Igor,

Please modify _chart.ViewXY.BarViewOptions accordingly. For example,

Code: Select all

_chart.ViewXY.BarViewOptions.Grouping = BarsGrouping.ByLocation;

would use Location on axis for grouping. Other useful options: BarSpacing, Stacking (in your case 'None'), KeepBaseLevelAtAxisMinimum.
It should not be any problems to create 1000 bars. Although both approaches (multiple series and multiple-values in series) will work, less BarSeries should be more efficient.

All the best,
Kestutis
Last edited by ArctionKestutis on Thu Jun 30, 2016 7:15 am, edited 1 time in total.

Igor
Posts: 67
Joined: Mon Sep 28, 2015 1:14 pm

Re: BarSeries change color for some bars

Post by Igor » Thu Jun 30, 2016 5:55 am

ok, I got it :-)
2016-06-30_0749.png
2016-06-30_0749.png (14.14 KiB) Viewed 10126 times
I've create a BarSeries for each value. In the rare extreme usecase with 800 BarSeries the GPU usage of a Quadro M4000 is about 50% by 4K Resolution .. thats ok.

Code: Select all

           
            ViewXY.BarViewOptions.BarSpacing = 2;
            ViewXY.BarViewOptions.Grouping = BarsGrouping.ByIndexFitWidth;
            ViewXY.BarViewOptions.Stacking = BarsStacking.None;
            ViewXY.BarViewOptions.IndexGroupingFitGroupDistance = 1;
            ViewXY.BarViewOptions.IndexGroupingFitSideMargins = 1;

Code: Select all

            _barSeries = new BarSeries(_viewXy, _viewXy.XAxes[0], _viewXy.YAxes[0]);
            _barSeries.Title.Visible = false;
            _barSeries.Shadow.Visible = false;
            _barSeries.LabelStyle.Visible = false;
            _barSeries.Fill.GradientFill = GradientFill.Solid;
            _barSeries.Fill.Color = _colDefault;
            _barSeries.BorderWidth = 0;
thanks for your help

Post Reply