<com.db.chart.view.ChartView
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"
/>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
--
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</td>
|
chart.setLabels(NONE/OUTSIDE/INSIDE)
chart.setLabelColor(color)
chart.setFontSize(integer)
chart.setTypeface(typeface)
chart.setGrid(paint)
chart.setHorizontalGrid(paint)
chart.setVerticalGrid(paint)
chart.setThresholdLine(float, paint)
chart.setMaxAxisValue(integer, integer)
chart.setStep(integer)
chart.setTopSpacing(dimen)
chart.setBorderSpacing(dimen)
chart.setAxisX(boolean)
chart.show()
chart.updateValues(int, array)
chart.notifyDataUpdate()
chart.showTooltip(view)
chart.dismissTooltip(view)
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
LineChart(跟上面相同的部分用省略號)
1
2
3
</td>
|
<com.db.chart.LineChartView
...
/>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
java代碼:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</td>
|
LineChartView chartView= new LineChartView()
LineSet lineSet = new LineSet()
lineSet.addPoint( new Point(string, float)
lineSet.setDots(boolean)
lineSet.setDotsColor(color)
lineSet.setDotsRadius(dimen)
lineSet.setDotsStrokeThickness(dimen)
lineSet.setDotsStrokeColor(color)
lineSet.setLineThickness(dimen)
lineSet.setLineColor(color)
lineSet.setFill(boolean)
lineSet.setFillColor(color)
lineSet.setDashed(boolean)
lineSet.setSmooth(boolean)
chartView.addData(lineSet)
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
BarChart & StackBarChart
1
2
3
4
5
</td>
|
<com.db.chart.BarChartView
...
chart:chart_barSpacing= "dp"
chart:chart_setSpacing= "dp"
/>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
java代碼
1
2
3
4
5
6
7
8
9
10
11
</td>
|
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)
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
Listener的設置
1
2
3
4
5
6
</td>
|
chart.setOnEntryClickListener( new OnEntryClickListener(){
@Override
public void onClick(int setIndex, int entryIndex, Rect entryRect) {
}
});
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
動畫
| | | | | |