-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi Just running some of the ZK Charts example and I'm having difficulties setting the “PointStart”, any idea what value must it be, I've tried epoch,long,int etc.. it seems to ignore everything, samples makes use of TimeUtil, which I cannot find.
SplinePlotOptions spline = chart.getPlotOptions().getSpline(); spline.setPointStart(TimeUtil.parse("10-06-2009", "UTC"));
Thanks
Did you assign the x values for the points in a series? Refer to the javadoc, you can set Number
value to PointStart
. If no x values are given for the points in a series, pointStart defines on what value to start.
For example, area basic demo use setPointStart(1940)
to start the series from 1940.
The another example line time series demo uses datetime XAxis so that you can assign the Calendar's time value in milliseconds to express the date more specific:
XAxis xAxis = chart.getXAxis();
xAxis.setType("datetime");
...
AreaPlotOptions plotOptions = chart.getPlotOptions().getArea();
plotOptions.setPointInterval(24 * 3600 * 1000);
plotOptions.setPointStart(TimeUtil.parse("01-01-2006"));
The TimeUtil.parse()
method only parses the formatted date and returns time value in milliseconds. It's just an utility class used in the demo project:
public class TimeUtil {
private static final Calendar calendar = Calendar.getInstance();
private static final SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy");
public static long parse(String date) {
try {
format.setTimeZone(TimeZone.getTimeZone("GMT"));
calendar.setTime(format.parse(date));
} catch (ParseException e) {
e.printStackTrace();
}
return calendar.getTimeInMillis();
}
...
}
Asked: 2014-03-18 09:18:30 +0800
Seen: 15 times
Last updated: Mar 18 '14