Maven Central Sonatype Snapshot Source License

Library under development. Backward compatibility not guaranteed before version 1.0.

Dependencies

To use charts core library in an Android project, include the following dependencies:

dependencies {

    // Charts core library dependency:
    implementation "it.czerwinski.android:charts-core:$android_charts_version"

    // Material Design styles for charts core library: 
    implementation "it.czerwinski.android:charts-core-material:$android_charts_version"
}

See also Material Design styles for core library.

Styling

Available Attributes

Text Paint

TextPaing has the following attributes:

Attribute Description
android:textSize Text size
android:textColor Text color
android:textStyle Text style: normal, bold, italic
android:typeface Typeface: normal, sans, serif, monospace
android:fontFamily Min SDK 16. Font family name or font resource
fontFamily Font family name or font resource
textAllCaps If true, text will be converted to all caps

Provided Styles

See also Material Design styles.

Dark Text

Style: AndroidCharts.TextAppearance.Dark

Attribute Value
android:textSize 12sp
android:textColor #000000 (black)
android:fontFamily Min SDK 16. sans-serif-medium
fontFamily sans-serif-medium

Light Text

Style: AndroidCharts.TextAppearance.Light

Attribute Value
android:textSize 12sp
android:textColor #FFFFFF (white)
android:fontFamily Min SDK 16. sans-serif-medium
fontFamily sans-serif-medium

Defining Lists Of Colors

TypedArray.getColors() extension allows for defining lists of ColorStateList objects in resources.

The list can be provided as:

Examples:

<style name="MyStyle">
    <item name="colors1">#ff000000</item>
    <item name="colors2">@color/black</item>
    <item name="colors3">?attr/colorPrimary</item>
    <item name="colors4">@color/my_color_state_list</item>
    <item name="colors5">@array/my_colors</item>
</style>

where my_color_state_list.xml:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_selected="false" android:color="?attr/colorPrimary" />
    <item android:state_selected="true" android:color="?attr/colorPrimaryVariant" />
</selector>

and colors.xml:

<resources>
    <array name="my_colors">
        <item>#ff000000</item>
        <item>@color/black</item>
        <item>@color/my_color_state_list</item> <!-- Note: attributes are not allowed in typed array -->
    </array>
</resources>