本文整理汇总了Java中lecho.lib.hellocharts.model.PieChartData.hasCenterCircle方法的典型用法代码示例。如果您正苦于以下问题:Java PieChartData.hasCenterCircle方法的具体用法?Java PieChartData.hasCenterCircle怎么用?Java PieChartData.hasCenterCircle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lecho.lib.hellocharts.model.PieChartData
的用法示例。
在下文中一共展示了PieChartData.hasCenterCircle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onChartDataChanged
import lecho.lib.hellocharts.model.PieChartData; //导入方法依赖的package包/类
@Override
public void onChartDataChanged() {
super.onChartDataChanged();
final PieChartData data = dataProvider.getPieChartData();
hasLabelsOutside = data.hasLabelsOutside();
hasLabels = data.hasLabels();
hasLabelsOnlyForSelected = data.hasLabelsOnlyForSelected();
valueFormatter = data.getFormatter();
hasCenterCircle = data.hasCenterCircle();
centerCircleScale = data.getCenterCircleScale();
centerCirclePaint.setColor(data.getCenterCircleColor());
if (null != data.getCenterText1Typeface()) {
centerCircleText1Paint.setTypeface(data.getCenterText1Typeface());
}
centerCircleText1Paint.setTextSize(ChartUtils.sp2px(scaledDensity, data.getCenterText1FontSize()));
centerCircleText1Paint.setColor(data.getCenterText1Color());
centerCircleText1Paint.getFontMetricsInt(centerCircleText1FontMetrics);
if (null != data.getCenterText2Typeface()) {
centerCircleText2Paint.setTypeface(data.getCenterText2Typeface());
}
centerCircleText2Paint.setTextSize(ChartUtils.sp2px(scaledDensity, data.getCenterText2FontSize()));
centerCircleText2Paint.setColor(data.getCenterText2Color());
centerCircleText2Paint.getFontMetricsInt(centerCircleText2FontMetrics);
onChartViewportChanged();
}
示例2: onChartDataChanged
import lecho.lib.hellocharts.model.PieChartData; //导入方法依赖的package包/类
public void onChartDataChanged() {
super.onChartDataChanged();
PieChartData data = this.dataProvider.getPieChartData();
this.hasLabelsOutside = data.hasLabelsOutside();
this.hasLabels = data.hasLabels();
this.hasLabelsOnlyForSelected = data.hasLabelsOnlyForSelected();
this.valueFormatter = data.getFormatter();
this.hasCenterCircle = data.hasCenterCircle();
this.centerCircleScale = data.getCenterCircleScale();
this.centerCirclePaint.setColor(data.getCenterCircleColor());
if (data.getCenterText1Typeface() != null) {
this.centerCircleText1Paint.setTypeface(data.getCenterText1Typeface());
}
this.centerCircleText1Paint.setTextSize((float) ChartUtils.sp2px(this.scaledDensity, data.getCenterText1FontSize()));
this.centerCircleText1Paint.setColor(data.getCenterText1Color());
this.centerCircleText1Paint.getFontMetricsInt(this.centerCircleText1FontMetrics);
if (data.getCenterText2Typeface() != null) {
this.centerCircleText2Paint.setTypeface(data.getCenterText2Typeface());
}
this.centerCircleText2Paint.setTextSize((float) ChartUtils.sp2px(this.scaledDensity, data.getCenterText2FontSize()));
this.centerCircleText2Paint.setColor(data.getCenterText2Color());
this.centerCircleText2Paint.getFontMetricsInt(this.centerCircleText2FontMetrics);
onChartViewportChanged();
}
示例3: checkTouch
import lecho.lib.hellocharts.model.PieChartData; //导入方法依赖的package包/类
@Override
public boolean checkTouch(float touchX, float touchY) {
selectedValue.clear();
final PieChartData data = dataProvider.getPieChartData();
final float centerX = originCircleOval.centerX();
final float centerY = originCircleOval.centerY();
final float circleRadius = originCircleOval.width() / 2f;
sliceVector.set(touchX - centerX, touchY - centerY);
// Check if touch is on circle area, if not return false;
if (sliceVector.length() > circleRadius + touchAdditional) {
return false;
}
// Check if touch is not in center circle, if yes return false;
if (data.hasCenterCircle() && sliceVector.length() < circleRadius * data.getCenterCircleScale()) {
return false;
}
// Get touchAngle and align touch 0 degrees with chart 0 degrees, that why I subtracting start angle,
// adding 360
// and modulo 360 translates i.e -20 degrees to 340 degrees.
final float touchAngle = (pointToAngle(touchX, touchY, centerX, centerY) - rotation + 360f) % 360f;
final float sliceScale = 360f / maxSum;
float lastAngle = 0f; // No start angle here, see above
int sliceIndex = 0;
for (SliceValue sliceValue : data.getValues()) {
final float angle = Math.abs(sliceValue.getValue()) * sliceScale;
if (touchAngle >= lastAngle) {
selectedValue.set(sliceIndex, sliceIndex, SelectedValueType.NONE);
}
lastAngle += angle;
++sliceIndex;
}
return isTouched();
}
示例4: checkTouch
import lecho.lib.hellocharts.model.PieChartData; //导入方法依赖的package包/类
public boolean checkTouch(float touchX, float touchY) {
this.selectedValue.clear();
PieChartData data = this.dataProvider.getPieChartData();
float centerX = this.originCircleOval.centerX();
float centerY = this.originCircleOval.centerY();
float circleRadius = this.originCircleOval.width() / 2.0f;
this.sliceVector.set(touchX - centerX, touchY - centerY);
if (this.sliceVector.length() > ((float) this.touchAdditional) + circleRadius) {
return false;
}
if (data.hasCenterCircle() && this.sliceVector.length() < data.getCenterCircleScale() * circleRadius) {
return false;
}
float touchAngle = ((pointToAngle(touchX, touchY, centerX, centerY) - ((float) this.rotation)) + 360.0f) % 360.0f;
float sliceScale = 360.0f / this.maxSum;
float lastAngle = 0.0f;
int sliceIndex = 0;
for (SliceValue sliceValue : data.getValues()) {
float angle = Math.abs(sliceValue.getValue()) * sliceScale;
if (touchAngle >= lastAngle) {
this.selectedValue.set(sliceIndex, sliceIndex, SelectedValueType.NONE);
}
lastAngle += angle;
sliceIndex++;
}
return isTouched();
}