[download_header]
License
[license]
Issues Resolved
There is now a
Quickstart project under Examples with pre-configured project files IntelliJ and Eclipse ADT evironments.
The
AndroidPlot API Demos App is now compatible with tablet devices running Honeycomb, ICS or Jellybean.
It is now possible to use localized strings as AndroidPlot xml attributes:
<com.androidplot.xy.XYPlot
android:id="@+id/mySimpleXYPlot"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
androidplot.title="@string/myPlotTitle"/>
Fixed.
Added.
Not a bug.
Example project files have all been updated for SDK r14.
Done
Lots of changes here .See Issue work log for details.
Done
Implemented a background thread and a ping-pong buffer. See either the issue worklog or api change notes below for further details.
No code changes were necessary. Added an example of how it's done to the Demo Apps. (DemoAppWidgetProvider.java)
Fixed
It's gone! Creating and using custom renderers should be much simpler now and no longer requires a recompile of AndroidPlot-Core.
API Changes
Improved XML Configuration
This is a big one. Plots declared in XML can now be styled more extensively. Any String, int, float, boolean or Enum parameter (includes colors and dimensions) with a public setter can now be set via XML. We've also added support for configuring Formatters or pretty much anything else you'd care to style in XML via Configurator.configure(...) methods. See the Configurator javadoc for usage details. What this means for you the developer is vastly improved facilities for localization and setting layout styles based on screen size and orientation.
Here's a quick example:
(
view/download sample project in Bitbucket here)
/res/xml/f1.xml:
<?xml version="1.0" encoding="utf-8"?>
<config vertexPaint.color="#00FF00"
linePaint.color="#00FF00"
linePaint.strokeWidth="2dp"/>
/res/layout/main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.androidplot.xy.XYPlot
android:id="@+id/mySimpleXYPlot"
android:layout_width="fill_parent"
android:layout_height="150px"
android:layout_marginTop="10px"
android:layout_marginLeft="10px"
android:layout_marginRight="10px"
andsroidplot.title="A Simple XYPlot Example"
androidplot.ticksPerRangeLabel="4"
androidplot.ticksPerDomainLabel="2"
androidplot.gridPadding="4dp|4dp|4dp|4dp"/>
</LinearLayout>
MyActivity.java
public class MyActivity extends Activity
{
private XYPlot plot;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// initialize our XYPlot reference:
plot = (XYPlot) findViewById(R.id.mySimpleXYPlot);
// add a new series
XYSeries mySeries = new SimpleXYSeries(
Arrays.asList(new Integer[]{0, 25, 55, 2, 80, 30, 99, 0, 44, 6}),
SimpleXYSeries.ArrayFormat.Y_VALS_ONLY, "series1");
plot.addSeries(mySeries, new LineAndPointFormatter(
getApplicationContext(), R.xml.f1));
// reposition the domain label to look a little cleaner:
plot.position(plot.getDomainLabelWidget(), // the widget to position
45, // x position value, in this case 45 pixels
XLayoutStyle.ABSOLUTE_FROM_LEFT, // how the x position value is applied, in this case from the left
0, // y position value
YLayoutStyle.ABSOLUTE_FROM_BOTTOM, // how the y position is applied, in this case from the bottom
AnchorPosition.LEFT_BOTTOM); // point to use as the origin of the widget being positioned
plot.centerOnRangeOrigin(60);
plot.centerOnDomainOrigin(5);
}
}
Deprecated: Plot.disableAllMarkup()
Markup is now disabled by default and can be enabled by calling Plot.setMarkupEnabled(true). We've left Plot.disableAllMarkup() in 0.5.1 for backwards compatibility but it does absolutely nothing and will be completely removed in 0.5.2.
title attribute name change and is no longer mandatory
When defining the title of a plot in XML use androidplot.title instead of title as the attribute name. If title is omitted, "My Plot" will be used as the default. This change was made in order to leverage Configurator's new functionality. See the "Improved XML Configuration" section above.
Configurable Render Mode
AndroidPlot can now be configured to use either the main thread or a background thread to do rendering. The default is to use the main thread. In most applications which plot trivial amounts of data, using the main thread for rendering can provide a higher frame rate. Where the line between "trivial" and "non-trivial" lies is arbitrary and varies by device, however we feel that ~150 points is a good rule of thumb. Note that once a plot has been initialized, the rendering mode cannot currently be changed.
Configuring render mode via XML:
TODO
Configuring render mode programmatically:
XYPlot myPlot = new XYPlot(context "MyPlot", Plot.RenderMode.USE_MAIN_THREAD);
See Javadoc for com.androidplot.Plot for further details.
Removed: Plot.redraw(boolean)
Due to synchronization issues between background rendering and calling redraw(true), this method had to be removed. Note that it is now up to the user to synchronize modifications to their series data with calls to redraw. AndroidPlot provides a synchronized implementation of XYSeries in the form of SimpleXYSeries.
Removed: Plot.postRedraw()
It is no longer necessary to use Plot.postRedraw() when updating AndroidPlot from a non-ui thread. Call Plot.redraw() instead.