50061

How to update/remove/insert new series/data in Shinobi Line Chart in android?

Question:

<strong>I am updating the chart but it showing old series also.</strong> How to update/remove/insert new series/data in Shinobi Line Chart in android?

<strong>I am using this code:</strong>

CategoryAxis xAxis = new CategoryAxis(); xAxis.enableGesturePanning(true); xAxis.enableGestureZooming(true); xAxis.setRangePaddingHigh(0.3); xAxis.setRangePaddingLow(0.1); shinobiChart.setXAxis(xAxis); NumberAxis yAxis = new NumberAxis(); yAxis.setMajorTickFrequency(200.0); yAxis.enableGesturePanning(true); yAxis.enableGestureZooming(true); shinobiChart.setYAxis(yAxis); yAxis.setDefaultRange(new NumberRange(-50.0, 1024.0));

Answer1:

There are several ways in which you can add / remove / update data in a LineSeries.

To change the data that the LineSeries is showing you can add or remove data points from the series' underlying DataAdapter. As data is added or removed a redraw of the chart will take place and as such you will immediately see the changes to the series on the chart.

To add data points to the DataAdapter you can use one of the add methods such as that described below:

<a href="http://www.shinobicontrols.com/docs/ShinobiControls/ShinobiChartsAndroid/1.5.1/Premium/Normal/apidocs/docs/reference/com/shinobicontrols/charts/DataAdapter.html#add(com.shinobicontrols.charts.Data" rel="nofollow">http://www.shinobicontrols.com/docs/ShinobiControls/ShinobiChartsAndroid/1.5.1/Premium/Normal/apidocs/docs/reference/com/shinobicontrols/charts/DataAdapter.html#add(com.shinobicontrols.charts.Data</a>)

To remove data points from the DataAdapter you can use one of the remove methods such as that described below:

<a href="http://www.shinobicontrols.com/docs/ShinobiControls/ShinobiChartsAndroid/1.5.1/Premium/Normal/apidocs/docs/reference/com/shinobicontrols/charts/DataAdapter.html#remove(int)" rel="nofollow">http://www.shinobicontrols.com/docs/ShinobiControls/ShinobiChartsAndroid/1.5.1/Premium/Normal/apidocs/docs/reference/com/shinobicontrols/charts/DataAdapter.html#remove(int)</a>

Your second option, which is maybe a little more severe is to remove the existing series completely and replace it with a new one.

There are numerous examples of how to add a series to a chart within the sample apps which are bundled with ShinobiCharts for Android. If you do add a new series and wish to no longer see the previous, old series it is very important that you remember to remove the old series using the method described below:

<a href="http://www.shinobicontrols.com/docs/ShinobiControls/ShinobiChartsAndroid/1.5.1/Premium/Normal/apidocs/docs/reference/com/shinobicontrols/charts/ShinobiChart.html#removeSeries(com.shinobicontrols.charts.Series" rel="nofollow">http://www.shinobicontrols.com/docs/ShinobiControls/ShinobiChartsAndroid/1.5.1/Premium/Normal/apidocs/docs/reference/com/shinobicontrols/charts/ShinobiChart.html#removeSeries(com.shinobicontrols.charts.Series</a>)

I hope this helps. If you need further help by all means post back.

Thanks, Kai. Disclaimer - I work for ShinobiControls.

Recommend

  • continue the line drawing on dotnet highchart
  • What is the best way to send many buffers with Boost::Asio method async_send_to
  • Don't Display the Axis line in bar chart using core plot
  • Catastrophic failure in xaml binding
  • Creating buttons with an Array
  • Why is my OpenGL code not working
  • JavaFX - ScrollPane with StackPane - StackPane's children not layouted when viewportBounds chan
  • iCarousel not scrolling smoothly
  • How to explain scheme expression '(a 'b)
  • MySQL Custom Function to Turn Roman Numeral Into Arabic
  • Prolog - Count all patient's symptoms
  • linked list program
  • How can I increase size of array automatically as per user/programmer need at run time? [closed]
  • Caesar Cipher validation
  • If decimal value, convert to two decimals AND dot separated value to comma separated
  • Passing integer by reference in python
  • How to delete node from linked list?
  • R rbind - unexpected symbol error when merging rows from two data frames
  • Formatting Number in javascript using decimal
  • How to sum a row of numbers from text file— Bash Shell Scripting
  • VBA, TRIM part of a Path
  • Automatic chart update with new data entry
  • Method to get to the middle of the file for Binary Search
  • HTML5 canvas animation and rotation
  • PHP MySQL generating unique random number
  • What does “+=” (plus equals) mean in Ruby? [closed]
  • Is there a way of querying or accessing the structure of a Z3 expression via the API
  • How to update javascript variable value in html without a page refresh
  • Leading Zero on Single Digits (Flash)
  • scipy.ndimage.zoom result depends on image size
  • In BASH convert a string with . in float
  • How to personalize a timeline with R?
  • Why does this use of getImageData leak memory
  • How to check a string does not start with a number in Batch?
  • Exporting SAS DataSet on to UNIX as a text file…with delimiter '~|~'
  • Fraction length
  • What exactly is the height of modalPresentationStyle - FormSheet on iPad?
  • pandas computation in each group
  • MySQL WHERE-condition in procedure ignored
  • Do I've to free mysql result after storing it?