Hi,
I am using a SciStockChart and trying to add Trade Markers as outlined here https://www.scichart.com/annotations-adding-trade-markers-to-a-chart/. However, I am not getting a proper xCoordinate from the coordinate calculator. I believe SciStockChart is using a CategoryCoordinateCalculator and I must do an extra step in order to get the proper result from the DateTime input. Here is the line that is not working correctly. double xCoord = xCoordCalculator.GetCoordinate(trade.ExecutionTime.Value); Is there another step I need to take in order to get the proper xCoord value?
thanks,
Dewey
- Dewey Brooks asked 9 years ago
- You must login to post comments
ok, I seem to have solved this. I’m casting the current x coordinate calculator to a category calculator like this.
var xCoordCalculator = PriceChart.XAxis.GetCurrentCoordinateCalculator() as ICategoryCoordinateCalculator;
Then I get the index of the DateTime object and use the index as input to the coordinate calculator.
var index = xCoordCalculator.TransformDataToIndex(trade.ExecutionTime.Value);
double xCoord = xCoordCalculator.GetCoordinate(index);
This is working for me.
- Dewey Brooks answered 9 years ago
-
Hi Dewey, yes that's exactly right. CategoryDateTimeAxis expects indices and so the category axis is a slightly special case. This is also covered in our article on Converting Pixel to Data Coordinates http://support.scichart.com/index.php?/Knowledgebase/Article/View/17207/31/convert-pixel-to-data-coordinates Best regards, Andrew
- You must login to post comments
Please login first to submit.