How to draw custom object with value of datetime


Author
Message
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 Xialong,

The problem in this case is that the chart does not have valid data points - therefore the axes will not be scaled. We would recommend to use the CustomSeries in the new version for this purpose.



Best Regards,
Nevron Support Team


Xiaolong Zhu
Xiaolong Zhu
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
Posts: 18, Visits: 1
Thanks for your answer. So could you please take a look at the attached code?
Attachments
WindowsFormsApplication1.zip (127 views, 2.00 MB)
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 Xiaolong,

You're doing the conversion correctly (ToOADate will get the double equivalent of the date time). What's not working exactly? Can you send a complete app replicating the problem to support@nevron.com ?

You can also use the regular line series with different appearance settings per data point.



Best Regards,
Nevron Support Team


Xiaolong Zhu
Xiaolong Zhu
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
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.

 


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