Android圖表類庫:WilliamChart,

來源:互聯網
上載者:User

Android圖表類庫:WilliamChart,

WilliamChart是基於Views的Android圖表類庫,協助開發人員在Android應用中實現折線圖、柱狀圖和堆疊柱狀圖。數值發生變化時圖表也會以動畫的效果發生變化。

At the moment it provides:

  • LineChartView

  • BarChartView

  • StackBarChartView

使用說明: 
建立一個新的chart需要繼承自ChartView的座標軸,同時實現一些必要的方法。我覺的這些方法足以讓你繪製出任何你想要的效果。 
xml檔案

 

?
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(跟上面相同的部分用省略符號)

?
123 <com.db.chart.LineChartView.../>
 java代碼:

 

?
12345678910111213141516171819 LineChartView chartView= new LineChartView()LineSet lineSet = new LineSet()lineSet.addPoint(new Point(string, float)// Style dotslineSet.setDots(boolean)lineSet.setDotsColor(color)lineSet.setDotsRadius(dimen)lineSet.setDotsStrokeThickness(dimen)lineSet.setDotsStrokeColor(color)// Style linelineSet.setLineThickness(dimen)lineSet.setLineColor(color)// Style background filllineSet.setFill(boolean)lineSet.setFillColor(color)// Style typelineSet.setDashed(boolean)lineSet.setSmooth(boolean)chartView.addData(lineSet)

BarChart & StackBarChart

?
12345 <com.db.chart.BarChartView...chart:chart_barSpacing="dp"chart:chart_setSpacing="dp"/>

java代碼

?
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的設定

?
123456 chart.setOnEntryClickListener(new OnEntryClickListener(){     @Override     public void onClick(int setIndex, int entryIndex, Rect entryRect) {         //Do things     } });

動畫

?
123456789101112 Animation anim = new Animation()anim.setDuration(integer)anim.setEasing(easingFunction)anim.setEndAction(runnable)// Animation overlap between entriesanim.setOverlap(float)// Animation starting pointanim.setStartPoint(floatfloat)// Include alpha transitionanim.setAlpha(int)// Starts animationchart.animate(animation)
  

項目首頁:http://www.open-open.com/lib/view/home/1413855326965

diogobernardino / WilliamChartWatch1561 Fork295

項目描述:Android library to create charts. — 查看更多內容...

 


問題列表:
#69 Set Dots missing 由 douglasd3  2015-08-19
#61 Not showing anything at all 由 Ph1b  2015-08-16
#50 Can I set YAxis Label to right? 由 xu6148152  2015-06-07
#29 Support CandleStickChart view 由 Archinamon  2015-01-14
#28 Consider support for pie charts 由 tuliohmendes  2015-07-29
 

分支代碼更新時間:2015-08-16

開發語言:Java

ZIP檔案下載

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.