I would like to know if it is possible to ensure that the labels along my x-axis (time) are drawn every half hour. I'm not sure how UltraChart decides to draw the gridlines and labels (it seems to be using the first data point) I would like to force it to show only half hours exactly.
As an aside, if this is not possible, if it is possible to draw my own labels this would work for me as well. (In order to get gridlines at every half hour, I had to use the FillSceneGraph event to calculate and draw them)
I was able to accomplish my desired labels by using the FillSceneGraph event, and created my new labels like this
aLabel - new label (new Point(aComputedXal, aYStartingval + mChart.Axis.X.Extent), string "label");
glad to hear you found a solution. alternatively, if you have a true DateTime axis, you should be able to set TickmarkInterval = 30, TickmarkIntervalType = Hours, TickmarkStyle = DataInterval, RangeType = Manual, RangeMin = DateTime.Today.Ticks, RangeMax = DateTime.Today.AddHours(3).Ticks using the axis properties.
Thanks, I might have to try your answer, do you think there'd be a performace hit using fillscenegraph versus using the properties of the axis?
a small one. FillSceneGraph runs each time the chart is painted, but then again so does the normal labelling code.
While I haven't tried this yet, I was able to get some sort of markings from the labels automatically, but I want them every half hour, on the half hour, which was the problem I was having, i think the code you gave me will work the same as what I was seeing, it would label the very first poing on the x-axis regardless of time and every half hour thereafter, I want it to ignore all points except for the hours and half hours exactly. Will the code you sent me accomplish this? Secondly I also need some help with tooltips. I have a LineChart, with my data loaded into a DataTable with two columns, one for the DataPoint, and one for the DataTime (which is being stored AS a DateTime)... I want my tooltip to show up as follows
(DataValue, HH:MM:SS)
I get the following (DataValue, FullDateTimeString) (i.e. 3.4, 2/17/09 12:00:00)
Currently my tooltip formatstring is listed as <DATA_VALUE:0.00,#,##>, \n <SERIES_LABEL: T>
What am I doing wrong and how can I accomplish the desired tooltips?
some of the properties I suggested can be used to force the axis minimum to be a certain time, which can be rounded to the hour or half-hour:
Axis.X.RangeType = Custom
Axis.X.RangeMin = DateTime.Parse("1/1/2001 2:00:00 AM").Ticks;
Axis.X.RangeMax = DateTime.Parse("1/1/2001 4:00:00 AM").Ticks;
as for the tooltip getting values from another column... to do this you need to create a class that implements the IRenderLabel interface. You can store a copy of your DataTable as a private field on an instance of this class, and use it to output the tooltip string, something like this:
string IRenderLabel.ToString(Hashtable context)
{
int dataRow = int.Parse(context["DATA_ROW"].ToString());
return this.myTable.Rows[dataRow]["FullDateTimeString"];
}