Saturday 15 May 2010

android - How to draw a vertical line on a CubicLineChart? -


I am displaying a beautiful chart that contains two XYSeries in each series, there are 24 values ​​in the x-position 0 to 23 Are plotted till A series reflects the temperature in a 24-hour period, the second series shows the rainfall probability in the same 24 hours.

The problem when I try to add a third series to illustrate a single vertical line (used as a "cursor", with a OnTouchListener ) . This idea is to attract a 2-Datapoint series which will be presented as a single vertical line that I can use for my cursor.

XYSeries cursorLine = new XYSeries ("", 2); Cursor Lean.ad (5, 0); CursorLine.add (5, 100); Dataset.addSeries (cursorLine);

It does not display anything.

I also tried to use two very close X values ​​suggested by ACE donation:

  XYSeries cursor lines = new XYSeries ("", 2); CursorLine.add (5.00000, 0); CursorLine.add (5.00001, 100); Dataset.addSeries (cursorLine); Unfortunately, it spreads the "cursor" line across the entire width of the chart, as if it assumes that it is made up of 24 data points instead of the specified 24 digits. Example:  

Enter image details here

I also add Attempted 24 data points, 23 of which have a Y value of 0 and only one (on x position 5) is the Y value of 100. Since it is a cubic line chart, so my cursor appears with the "heel" below; On the lower part of the chart, other 23-digit cursors are also visible. Example:

shows cursor line heel

I have settings The nearest data indicates the x value of +/- 0.00001, but does not remove the high heel - which is as small as the smallest until I set it horizontally to the cursor position. .

I am playing with this for the last hour or so, but I can not find a simple vertical line shown. any idea?

The problem is that you are using scale = 2 for the vertical line series. Each scale calculates the visible data range and attempts to fit the data as it appears completely, I suggest that you add your vertical line data to a scale already present.

No comments:

Post a Comment