Profile Picture

How to draw custom object with value of datetime

Posted By Xiaolong Zhu 12 Years Ago
Author
Message
Xiaolong Zhu
Posted 12 Years Ago
View Quick Profile
Junior Member

Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 18, Visits: 1

Hi experts

i need to draw thousands of line segments in one chart. Currently i get two ways to do this:

1> Create one line series for one line segment. so the num of the line series is same as the line segments. it has been proved to be works but with very low performance.

2> using GDI to draw these line segments by the API of INPaintCallBack. But the x value of the line segment is the type of datetime i don't know how to do the transformation from model space to client space. you can see the code snippet below:

var dataSeries = series as TimeBasedLineSeries;

vecModelStartPoint.X = (float)dataSeries.XValues[0].ToOADate();

vecModelStartPoint.Y = (float) dataSeries.YValues[0];

vecModelStartPoint.Z = 0;

vecModelEndPoint.X = (float)dataSeries.XValues[1].ToOADate();

vecModelEndPoint.Y = (float)dataSeries.YValues[1];

vecModelEndPoint.Z = 0;

_chart.TransformModelToClient(_chartCtrl.View.Context, vecModelStartPoint, ref vecClientStartPoint);

_chart.TransformModelToClient(_chartCtrl.View.Context, vecModelEndPoint, ref vecClientEndPoint);

graphics.DrawLine(new NStrokeStyle(1, dataSeries.Colors[0]), new NPointF(vecClientStartPoint.X, vecClientStartPoint.Y),new NPointF(vecClientEndPoint.X, vecClientEndPoint.Y));

So how to do the conversion? or is there any other solution to this case? thanks in advance.

 






Similar Topics


Reading This Topic