android - achartengine time chart set initial range -
solution
instead of using setinitialrange()
had set initial x-values using setxaxismin()
setxaxismax()
. little bit confusing, think.
original question
i'm working on project involving acharteninge library drawing time diagrams works excellent far. user capable of switching between various graphs (one xymultipleseriesdataset plus 1 timeseries per graph) via separate buttons. far, achartengine displays x values when graph shown.
however, asked display data captured in first 3 hours when graph shown, information relevant. nevertheless, user should still able scroll data captured after first 3 hours meaning limiting x-axis maximum value not option.
for example: there 2 curves. first curve drawn using data captured on period of 4 hours, while second curve created out of data captured on 18 hours.
in current version programme displays data of graph gets displayed meaning first curve shows 3 hours of relevant data while 1 hour of not important information shown too. "ratio" of second curve 3 15 (highly significant data vs regular data). result, different amount of high important information shown when user compares 2 curves making harder user compare data, has adjust zoom manually.
edit 01.04.2015 15:46
for setting initial range use xymultipleseriesrenderer instance's method setinitialrange(double[] initialrange);
not affect graph @ all. below can see statement (currentlyprocessedcurve.getrecordstart()
instance of joda's datetime , furhtermore it's x value of first displayed point):
public static final int chart_x_axis_initial_max = 3; public static final int chart_margin_pan = 45; ... double[] initialrange = { currentlyprocessedcurve.getrecordstart().minusminutes(applicationsettings.chart_margin_pan).todate().gettime(), currentlyprocessedcurve.getrecordstart().plushours(applicationsettings.chart_x_axis_initial_max).todate().gettime(), 0, 600 }; currentdatasetrenderer.setinitialrange(initialrange);
tide (edit end)
the screenshot below approximately shows how curve should (just making clear: please consider graphs' shapes, should equal --> i'm trying say: know x-axis , y-axis label of 2 screenshots different, don't have better pictures yet):
finally, following screenshot shows how curve looks when displayed:
for enabling user compare curves have locked y-axis zoom.
any highly appreciated. in advance!
have consider pan option?
with option can limit axis maximum, , chart show important data on start, while user can scroll left or right (wherever have less important data points).
all need is:
- set pan enabled axis need
- set pan limits (so user can't scroll past last data point)
hope helps, cheers.
Comments
Post a Comment