Hello,
I have a chart which has to draw a value serie vs. time. So I need a axe X which represent a day, with grid line each hour. Axe Y has numeric values.
My problem is that datapoints are irregular on one day period. I could have 3 points with 5 minutes interval then the next one 15 minutes later. My line must not be broken. I read that I'm supposed to use ScatterLine chart, but I've not been able to make it work.
Could you help me ? I attach a sample with a fake line to draw my grid line every hour, and a real line with random intervals.
Patrick.
Hello Patrick,
I have been reading though the functionality that you are looking for and after some investigation I have created a sample application which demonstrates how you can implement functionality similar the one that you described. I have created a data source that contains three properties: one from type double that represents the Y values, one from type DateTime and the last property returns the double representation of DateTime property using the ToOADate method of the DAteTime class.
I have created a collection of the objects that I have described and use it as a DataSource for a Scatter Line Series. I have used the first double property to map it to the Y Value of the DataPoitns and for the X Value I have used the double representation of the DateTime property. By using this approach the XamChart will arrange the DataPoints on the X axis based on the DateTime.
I have created a Converter, and bind the Minimum, Maximum and Interval properties of the Primary X axis to the data context of the chart using the converter. In the Convert method of the Converter I am setting the Minimum and Maximum properties to the minimum and maximum values of the double representation of the DateTime of the data source and I am also calculating what the interval should be in order for the XamChart to display vertical gridlines for each hour. By following this approach you will be able to achieve the same appearance as show in the screenshot that you have attached. Since the XamChart does not currently support styling and templating the labels on the axis, when following this approach, the XamChart will display double representation of the DateTime instead of the hour.
Please let me know if you need any further assistance on the matter.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
Hello Ekaterina,
Unfortunately we do not yet have access to Visual Studio 2010, so we can't use WPF4 Infragistics librairies. I have to work with XamChart, so I will say to my customer his request is not possible with current version of Visual Studio and Infragistics librairies.
Thank you for your support, your explanation will be useful later.
Regards,
Patrick
Thank you for your answer I now understand your requirements.
In order to implement the needed functionality you have to convert you Time values to doubles so you will enable the control to place it’s datePoints according to the double coordinate values provided by the properties from the control’s data source. There is a chart control that is more suitable for this purpose.
The xamChart control is now retired, so we strongly advice our customers to use the new control that intend to replace xamChart – this is the xamDataChart. I am attaching you a sample project that implements the needed scenario using xamDataChart.
Please do not hesitate to contact us in case of future concerns regarding the discussed matter.
Ekaterina
Infragistics, Inc.
What I really need is a chart with different interval in the same serie. I can have data (always in the same serie) spaced by 5, 10 or 30 minutes, I need a continuous line, with labels each hour.
For the label, I found a trick to made that, like in my sample, I put a serie not displayed, with right scale, so I have my gridline every hour.
But for my real serie, I can't put points with different spaces, and linked. If I create virtual points with null value, line is broken. If I just add them, the space between two points is always the same, regardless of the time interval between the two.
I made a Excel chart to illustrate my goal. In this one, I have 12 points between 0:00 and 1:00, for a five minutes interval, but only two between 2:00 and 3:00, which represents a 30 minutes interval.
Thanks for your support,
I have been looking into your question but I am not sure I understood your requirements well enough.
As far as I see from your sample you are trying to set up two line series, not a scatter series, and your second one does not appears – is this your issue?
Also I did not quite get the issue with the irregularly updated value – if your question if you can give something like 3minutes, 5minutes and then 4 minutes, and keep this order, you can achieve that using line series because they arrange their items via object index and the first in the collection will go first. However scatter series will arrange them in exponential order – 3,4,5.
So in order for me to investigate more efficiently your case, can you please explain me with more details what are your requirements, what is the issue within your sample and what kind of series would you like to have, if you have such a requirement.
Perhaps you can include a screenshot or some other graphical item that illustrates your goal, if possible.
I will be looking forward to hearing from you.