Showing a range of bars on an NStockSeries


Author
Message
David Cobbold
David Cobbold
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
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.
Reply
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K

Hi David,

Yes that works - there were several issues related to the calendar which were fixed in SP1 for 2012 - we used build number 12.5.9.12. What is the version you're currently testing with?



Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search