0

ZK Charts - spline.setPointStart

asked 2014-03-18 09:18:30 +0800

neels gravatar image neels
0

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

delete flag offensive retag edit

1 Answer

Sort by » oldest newest most voted
0

answered 2014-03-18 16:21:59 +0800

RaymondChao gravatar image RaymondChao
386 1 4
ZK Team

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();
    }
    ...
}
link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2014-03-18 09:18:30 +0800

Seen: 15 times

Last updated: Mar 18 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More