-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Miscellaneous
Philipp Jahoda edited this page Sep 15, 2015
·
9 revisions
Chart content
-
clear(): Clears the chart of all data (by setting the data object to null). Callsinvalidate()to refresh the chart. -
clearValues(): Clears the chart of all DataSet objects and thereby all Entries. Does not remove the provided x-values from the chart. Callsinvalidate()to refresh the chart. -
isEmpty(): Will return true if the charts data object is null, or if it contains no entries.
Useful getter methods
-
getData(): Will return the data object you set for the chart. -
getViewPortHandler(): Will returnViewPortHandlerobject of the chart that contains information about the charts size and bounds (offsets, content-area), as well as about the charts current scale (zoom) and translation (scrolling) state. -
getRenderer(): Returns the mainDataRendererthat is responsible for drawing the chart data. -
getCenter(): Returns the center point of the whole chart-view. -
getCenterOffsets(): Returns the center point of the chart drawing-area. -
getPercentOfTotal(float value): Returns the percentage the provided value makes up of the total value-sum inside the chart. -
getYMin(): Returns lowest value the chart holds. -
getYMax(): Returns biggest value the chart holds. -
getLowestVisibleXIndex(): Returns the lowest x-index (value on the x-axis) that is still visible on the chart. -
getHighestVisibleXIndex(): Returns the highest x-index (value on the x-axis) that is still visible on the chart.
Some more methods (of the Chart class)
-
saveToGallery(String title): Saves the current chart state as an image to the gallery. Don't forget to add "WRITE_EXTERNAL_STORAGE" permission to your manifest. -
saveToPath(String title, String pathOnSD): Saves the current chart state as an image to the specified path. Don't forget to add "WRITE_EXTERNAL_STORAGE" permission to your manifest. -
getChartBitmap(): Returns theBitmapobject that represents the chart, thisBitmapalways contains the latest drawing state of the chart. -
setHardwareAccelerationEnabled(boolean enabled): Allows to enable/disable hardware acceleration for the chart, only API level 11+.