Android chart Class Library: William chart,
William chart is an Android chart class library based on Views. It helps developers implement line charts, bar charts, and Stacked column charts in Android applications. When the value changes, the chart also changes with the animation effect.
At the moment it provides:
Instructions for use:
To create a new chart, you must inherit the coordinate axes of the ChartView and implement some necessary methods. I think these methods are enough for you to draw any effect you want.
Xml file
?
12345678910111213141516171819 |
< com.db.chart.view.ChartView xmlns:chart = "http://schemas.android.com/apk/res-auto" android:layout_width = "match_parent" android:layout_height = "dp" ... chart:chart_shadowDx = "dp" chart:chart_shadowDy = "dp" chart:chart_shadowRadius = "dp" chart:chart_shadowColor = "color" chart:chart_fontSize = "dp" chart:chart_typeface = "typeface" chart:chart_axisBorderSpacing = "dp" chart:chart_axisThickness = "dp" chart:chart_axisTopSpacing = "dp" chart:chart_axisColor = "color" chart:chart_axisX = "boolean" chart:chart_label = "boolean" chart:chart_labelColor = "color" /> |
?
123456789101112131415161718192021222324 |
// Customize labels chart.setLabels(NONE/OUTSIDE/INSIDE) chart.setLabelColor(color) chart.setFontSize(integer) chart.setTypeface(typeface) // Define grid chart.setGrid(paint) chart.setHorizontalGrid(paint) chart.setVerticalGrid(paint) // Show threshold line chart.setThresholdLine( float , paint) chart.setMaxAxisValue(integer, integer) chart.setStep(integer) chart.setTopSpacing(dimen) chart.setBorderSpacing(dimen) chart.setAxisX( boolean ) chart.show() // Update values of a given set chart.updateValues( int , array) // Notify chart about updated values chart.notifyDataUpdate() // Tooltip support chart.showTooltip(view) chart.dismissTooltip(view) |
LineChart(Use ellipsis for the same part as above)
?
123 |
< com.db.chart.LineChartView ... /> |
Java code:
?
12345678910111213141516171819 |
LineChartView chartView= new LineChartView() LineSet lineSet = new LineSet() lineSet.addPoint( new Point(string, float ) // Style dots lineSet.setDots( boolean ) lineSet.setDotsColor(color) lineSet.setDotsRadius(dimen) lineSet.setDotsStrokeThickness(dimen) lineSet.setDotsStrokeColor(color) // Style line lineSet.setLineThickness(dimen) lineSet.setLineColor(color) // Style background fill lineSet.setFill( boolean ) lineSet.setFillColor(color) // Style type lineSet.setDashed( boolean ) lineSet.setSmooth( boolean ) chartView.addData(lineSet) |
BarChart & StackBarChart
?
12345 |
< com.db.chart.BarChartView ... chart:chart_barSpacing = "dp" chart:chart_setSpacing = "dp" /> |
Java code
?
1234567891011 |
BarChartView chartView = new BarcChartView() barChart.setBarSpacing(dimen) barChart.setSetSpacing(dimen) barChart.setBarBackground( boolean ) barChart.setBarBackgroundColor(color) barChart.setRoundCorners(dimen) BarSet barSet = new BarSet() Bar bar = new Bar(string, float ) bar.setColor(color) barSet.addBar(bar) chartView.addData(barSet) |
Listener settings
?
123456 |
chart.setOnEntryClickListener( new OnEntryClickListener(){ @Override public void onClick( int setIndex, int entryIndex, Rect entryRect) { //Do things } }); |
Animation
?
123456789101112 |
Animation anim = new Animation() anim.setDuration(integer) anim.setEasing(easingFunction) anim.setEndAction(runnable) // Animation overlap between entries anim.setOverlap( float ) // Animation starting point anim.setStartPoint( float , float ) // Include alpha transition anim.setAlpha( int ) // Starts animation chart.animate(animation) |
Project homepage:Http://www.open-open.com/lib/view/home/1413855326965
Diogobernardino/William amchartwatch1561 Fork295
Project Description:Android library to create charts.-view more...
Problem list: |
#69 |
Set Dots missing |
By douglasd3Septem |
#61 |
Not showing anything at all |
By Ph1b |
#50 |
Can I set YAxis Label to right? |
By xu6148152 |
#29 |
Support CandleStickChart view |
By ArchinamonSeptem |
#28 |
Consider support for pie charts |
By tuliohmendes2015-07-29 |
MasterBranch code updated on:
Development language: Java
ZIP file download