tradingChart update

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
huzhong
Posts: 4
Joined: Wed Apr 19, 2023 12:51 pm

tradingChart update

Post by huzhong » Wed Apr 19, 2023 12:59 pm

I only see that the chart is assigned to the ohlcdata array with setdata, but I don't see what efficient method is used to refresh the last candlestick close and only add a new candlestick, what should be the way this refresh the last cell and add a new cell? Where is this sample code?
I find this method, SetBinding(DependencyProperty, BindingBase)
Attaches a binding to this element, based on the provided binding object.
(Inherited from FrameworkElement.)
but no samples

Thank you

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

Re: tradingChart update

Post by ArctionKestutis » Thu Apr 20, 2023 7:37 am

TradingChart has AddData() method, which adds 1 or more points to the end of existing data array. The demonstration of usage is in ExampleTraderPerformance from our Demo (Interactive Examples App).
If you would be using LightningChart .NET control directly, then stockSeries.AddPoints() method does the same thing (add points to the end of array).

huzhong
Posts: 4
Joined: Wed Apr 19, 2023 12:51 pm

Re: tradingChart update

Post by huzhong » Thu Apr 20, 2023 10:36 am

Thank your reply!
for update close of last OhlcData , i still use SetData or other?

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

Re: tradingChart update

Post by ArctionKestutis » Mon Apr 24, 2023 8:53 am

At the moment, there is no better way than reading existing data-array, changing any item in array and setting Data-array again to the chart:
 

Code: Select all

            var data = _chart.GetOhlcData();
            data[i].Close = newValue;
            _chart.SetData(data, "", "value update");
Hope this helps.

Post Reply