Bar series

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Arction_LasseP

CLON
Posts: 5
Joined: Wed Nov 15, 2017 12:34 pm

Bar series

Post by CLON » Thu Jun 21, 2018 7:37 am

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 ?

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

Re: Bar series

Post by ArctionKestutis » Thu Jun 21, 2018 10:52 am

You need to set grouping 'ByLocation' for location field to be taken into account:

Code: Select all

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

CLON
Posts: 5
Joined: Wed Nov 15, 2017 12:34 pm

Re: Bar series

Post by CLON » Thu Jun 21, 2018 11:58 am

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