Hello, I need to set the horizontal date axis
to display either 6 hours ticks or date ticks.
The label format should change like in the attached file.
We want to set the zoom behavior to zoom-in to 15 days
Appreciate Help
7 Answers, 1 is accepted
Thanks for writing.
You can achieve this by using the axis.LabelValueToStringConverter property. A simple label format will not suffice because it can't decide when to display the month and when the hours.
The converter should look like something this:
public
class
Converter : Java.Lang.Object, IFunction
{
public
Java.Lang.Object Apply(Java.Lang.Object p0)
{
MajorTickModel tick = (MajorTickModel)p0;
// Use the collection index to get the correct date from your data.
// Then you can return the correct string based on that date.
return
tick.CollectionIndex().ToString();
}
}
Can you please explain what you mean by zoom in to 15 days? Is that a max zoom or data drill down. Our chart currently does not support data drill down if this is what you need.
Regards,
Victor
Telerik by Progress
Hello
We have data of 60 days each point is an hour
We want to display be default only 15 days
We use ChartPanAndZoomBehavior ,SetZoomToChart method
The scaleX = 4 , scaleY =0, the zoom is working good but the chart display the last 15 days.
How can we pan to the most recent 15 days ?
Thanks
Thanks for writing.
This should be really simple. You can calculate the pan based on the chart plot area size. You can get the plot area like this:
chart.PlotAreaClip.Width;
Regards,
Victor
Telerik by Progress
Hi Victor,
I use the SetPanOffsetToChart method without any success. See code below:
var pw = Chart.PlotAreaClip.Width;
_pzBehavior.SetZoomToChart(MaxDays / DefaultDays, 0,0 , 0);
_pzBehavior.SetPanOffsetToChart(-pw* MaxDays / DefaultDays, 0);
It seems like the pan value is too bigger then the chart width.
Do I do something wrong?
Thanks,
Roey.
Thanks for writing. Please try this:
double
zoom = 3;
chart.SetZoom(3, 1);
double
panOffset = chart.PlotAreaClip.Width * zoom;
chart.SetPanOffset(-panOffset, 0);
The difference is that the zoom and pan are set on the chart itself, not the behavior.
Regards,
Victor
Telerik by Progress
Hi Victor,
Thanks alot. It works :-)
Let us know if you need further assistance.
Meanwhile I'll fix the zoom reset.
Regards,
Victor
Telerik by Progress