Profile Picture

Showing a range of bars on an NStockSeries

Posted By David Cobbold 12 Years Ago
Author
Message
David Cobbold
Posted 12 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: Forum Members
Last Active: 12 Years Ago
Posts: 7, Visits: 1
Hi,

I'm having a bit of trouble with NStockSeries and i'm hoping someone can help. I'm trying to figure out how to automatically focus the x axis on a specific range of bars in the chart. This is how I'm populating the chart:

NCartesianChart cartChart = (NCartesianChart)_chart.Charts[0];
NStockSeries stockSeries = (NStockSeries)cartChart.Series[0];

for (int i = stockSeries.XValues.Count; i < _marketData.Bars.Length; ++i)
{
MarketData.Bar bar = _marketData.Bars[i];
stockSeries.AddDataPoint(new NStockDataPoint(bar.Open, bar.High, bar.Low, bar.Close, bar.DateTime));
}


.. And I then try to set the paging view on the x axis to the last 4 months worth of data (_marketData.Bars is already sorted by date).

DateTime endDate = _marketData.Bars.Last().DateTime;
DateTime viewBegin = endDate.AddMonths(-4);
NNumericAxisPagingView dateAxis = new NNumericAxisPagingView(new NRange1DD(viewBegin.ToOADate(), endDate.ToOADate()));
dateAxis.Enabled = true;
cartChart.Axis(StandardAxis.PrimaryX).PagingView = dateAxis;


When I run this the view seems to have scrolled to some date much further in the future than any bar of market data I have, although it's difficult to tell the exact date. I've also tried using the NDateTimeAxisPagingView with similar results.

Another point is when I change the logic to attempt to keep the first 4 months of data in focus, it tends to scroll to somewhere roughy in the middle.

One other question I have is is it possible to discover which bars are in the view after the user zooms + scrolls? This is so that I can set the y axis paging view to the min and max value of the visible bars, in order to zoom the y axis in on what is visible.

Thanks for any help
David.




Similar Topics


Reading This Topic