突出饼图切片当AChartEngine点击了 [英] Highlighting Pie Chart Slice When Clicked in AChartEngine
本文介绍了突出饼图切片当AChartEngine点击了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想,当用户点击以突出饼图特定切片(变色)。
我可以在样品中找到(在$ C $下面三),这是可能的,显示切片的索引和确切点。但对重新着色的切片什么?
mChartView.setOnClickListener(新View.OnClickListener(){
@覆盖
公共无效的onClick(视图v){
SeriesSelection seriesSelection = mChartView.getCurrentSeriesAndPoint();
如果(seriesSelection == NULL){
烤面包
.makeText(PieChartBuilder.this,无图表元素被点击了,Toast.LENGTH_SHORT)
。显示();
}其他{
Toast.makeText(
PieChartBuilder.this,
图表元素数据点指数+ seriesSelection.getPointIndex()
+被点击+点值=+ seriesSelection.getValue()
Toast.LENGTH_SHORT).show();
}
}
});
解决方案
这会做你需要的东西:
mRenderer.getSeriesRendererAt(seriesSelection.getPointIndex())的setColor(彩色)。
mChartView.repaint();
I want to highlight (change color) of a pie graph specific slice when clicked by the user. I can find in the samples (the code below) that it is possible to show the index of the slice and the exact point. but what about recoloring the slice ?
mChartView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SeriesSelection seriesSelection = mChartView.getCurrentSeriesAndPoint();
if (seriesSelection == null) {
Toast
.makeText(PieChartBuilder.this, "No chart element was clicked", Toast.LENGTH_SHORT)
.show();
} else {
Toast.makeText(
PieChartBuilder.this,
"Chart element data point index " + seriesSelection.getPointIndex()
+ " was clicked" + " point value=" + seriesSelection.getValue(),
Toast.LENGTH_SHORT).show();
}
}
});
解决方案
This will do the stuff you need:
mRenderer.getSeriesRendererAt(seriesSelection.getPointIndex()).setColor(color);
mChartView.repaint();
这篇关于突出饼图切片当AChartEngine点击了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文