Page 1 of 1

Bar series

Posted: Thu Jun 21, 2018 7:37 am
by CLON
Hi,

i'm having trouble trying to add bar values to the bar series of my lightning chart.

Here is how i do it :

Code: Select all

this.<myChart>.BeginUpdate();
this.<myChart>.ViewXY.BarSeries[0].Values.Clear();
this.<myChart>.ViewXY.BarSeries[0].Values.Add(new BarSeriesValues {
    Value = 150,
    Location = 22
});;

this.<myChart>.ViewXY.BarSeries[0].Values.Add(new BarSeriesValues {
    Value = 150,
    Location = 40
});;

this.<myChart>.EndUpdate();
The chart displays well with two bars, but their position on the X axis is completely irrelevant compared to the given location set in the code.
I've set a fixed minimum and a fixed maximum for the X Axis but it seems the more bar values i'm trying to add, the more irrelevant are the bars locations.
It looks like the chart is trying to fit all the bars in the min/max range i've set even if it needs to change bar locations to do so...

What i want is a fixed X scale and a bar series that displays at the exact location on the X Axis as specified by code.

Any suggestion ?

Re: Bar series

Posted: Thu Jun 21, 2018 10:52 am
by ArctionKestutis
You need to set grouping 'ByLocation' for location field to be taken into account:

Code: Select all

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

Re: Bar series

Posted: Thu Jun 21, 2018 11:58 am
by CLON
ArctionKestutis wrote:You need to set grouping 'ByLocation' for location field to be taken into account:

Code: Select all

    _chart.ViewXY.BarViewOptions.Grouping = BarsGrouping.ByLocation;
Works perfectly :)

Thanks