Page 1 of 1
BarSeries change color for some bars
Posted: Fri Jun 24, 2016 12:55 pm
by Igor
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 (37.61 KiB) Viewed 10226 times
thanks
Igor
Re: BarSeries change color for some bars
Posted: Mon Jun 27, 2016 7:01 am
by ArctionPasi
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.
Re: BarSeries change color for some bars
Posted: Wed Jun 29, 2016 7:26 am
by Igor
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.
Re: BarSeries change color for some bars
Posted: Wed Jun 29, 2016 9:16 am
by Igor
what if I use a BarSeries for each value? So I could change the color for each bar.
Re: BarSeries change color for some bars
Posted: Wed Jun 29, 2016 12:41 pm
by ArctionKestutis
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
Re: BarSeries change color for some bars
Posted: Thu Jun 30, 2016 5:55 am
by Igor
ok, I got it
- 2016-06-30_0749.png (14.14 KiB) Viewed 10178 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