Home

Awesome

ChartView

ChartView icon

Usage

Please refer to the example. for seeing it in action.

Shortcut to attrs.xml.

XML

Add library dependency to your build.gradle file then copy this code to layout

  <com.example.library.BarChartView
            android:id="@+id/chart"
            android:layout_marginTop="25dp"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:axisColor="@color/colorPrimary"
            app:hideGirdLine="false"
            app:barColor="@color/colorPrimary"
            app:max="300"
            app:type="line"
            app:radius="15"
            app:yAxisTxtColor="@color/colorAccent" />

Attributes(布局中调用)

Attributesformatdescribe
axisColorcolor设置xy轴颜色
axisWidthinteger设置轴的宽度
xAxisTxtColorcolor设置x轴label的字体颜色
yAxisTxtColorcolor设置y轴label的字体颜色
barColorcolor设置chart的颜色
hideGirdLinecolor是否隐藏背景表格
maxcolor设置y轴的最大值
barPressEnablecolor设置chart点击是否有反应(变色)
radiuscolor设置折线图圆形半径
typecolor设置chart样式

Method(代码中调用)

methodNamedescribe
setHideGirdLine(boolean)设置隐藏背景表格
setBarPressEnable(boolean)设置chart点击事件
setBarChartList(float[])设置数据
setCharType(int)设置chart类型