当前位置: 首页>>代码示例>>Java>>正文


Java SelectedValueType类代码示例

本文整理汇总了Java中lecho.lib.hellocharts.model.SelectedValue.SelectedValueType的典型用法代码示例。如果您正苦于以下问题:Java SelectedValueType类的具体用法?Java SelectedValueType怎么用?Java SelectedValueType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SelectedValueType类属于lecho.lib.hellocharts.model.SelectedValue包,在下文中一共展示了SelectedValueType类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkTouch

import lecho.lib.hellocharts.model.SelectedValue.SelectedValueType; //导入依赖的package包/类
@Override
public boolean checkTouch(float touchX, float touchY) {
    selectedValue.clear();
    final LineChartData data = dataProvider.getLineChartData();
    int lineIndex = 0;
    for (Line line : data.getLines()) {
        if (checkIfShouldDrawPoints(line)) {
            int pointRadius = ChartUtils.dp2px(density, line.getPointRadius());
            int valueIndex = 0;
            for (PointValue pointValue : line.getValues()) {
                final float rawValueX = computator.computeRawX(pointValue.getX());
                final float rawValueY = computator.computeRawY(pointValue.getY());
                if (isInArea(rawValueX, rawValueY, touchX, touchY, pointRadius + touchToleranceMargin)) {
                    selectedValue.set(lineIndex, valueIndex, SelectedValueType.LINE);
                }
                ++valueIndex;
            }
        }
        ++lineIndex;
    }
    return isTouched();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:LineChartRenderer.java

示例2: getValueForAngle

import lecho.lib.hellocharts.model.SelectedValue.SelectedValueType; //导入依赖的package包/类
/**
 * Returns SliceValue that is under given angle, selectedValue (if not null) will be hold slice index.
 */
public SliceValue getValueForAngle(int angle, SelectedValue selectedValue) {
    final PieChartData data = dataProvider.getPieChartData();
    final float touchAngle = (angle - rotation + 360f) % 360f;
    final float sliceScale = 360f / maxSum;
    float lastAngle = 0f;
    int sliceIndex = 0;
    for (SliceValue sliceValue : data.getValues()) {
        final float tempAngle = Math.abs(sliceValue.getValue()) * sliceScale;
        if (touchAngle >= lastAngle) {
            if (null != selectedValue) {
                selectedValue.set(sliceIndex, sliceIndex, SelectedValueType.NONE);
            }
            return sliceValue;
        }
        lastAngle += tempAngle;
        ++sliceIndex;
    }
    return null;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:PieChartRenderer.java

示例3: checkTouch

import lecho.lib.hellocharts.model.SelectedValue.SelectedValueType; //导入依赖的package包/类
public boolean checkTouch(float touchX, float touchY) {
    this.selectedValue.clear();
    int valueIndex = 0;
    for (BubbleValue bubbleValue : this.dataProvider.getBubbleChartData().getValues()) {
        float rawRadius = processBubble(bubbleValue, this.bubbleCenter);
        if (ValueShape.SQUARE.equals(bubbleValue.getShape())) {
            if (this.bubbleRect.contains(touchX, touchY)) {
                this.selectedValue.set(valueIndex, valueIndex, SelectedValueType.NONE);
            }
        } else if (ValueShape.CIRCLE.equals(bubbleValue.getShape())) {
            float diffX = touchX - this.bubbleCenter.x;
            float diffY = touchY - this.bubbleCenter.y;
            if (((float) Math.sqrt((double) ((diffX * diffX) + (diffY * diffY)))) <= rawRadius) {
                this.selectedValue.set(valueIndex, valueIndex, SelectedValueType.NONE);
            }
        } else {
            throw new IllegalArgumentException("Invalid bubble shape: " + bubbleValue.getShape());
        }
        valueIndex++;
    }
    return isTouched();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:23,代码来源:BubbleChartRenderer.java

示例4: getValueForAngle

import lecho.lib.hellocharts.model.SelectedValue.SelectedValueType; //导入依赖的package包/类
public SliceValue getValueForAngle(int angle, SelectedValue selectedValue) {
    float touchAngle = (((float) (angle - this.rotation)) + 360.0f) % 360.0f;
    float sliceScale = 360.0f / this.maxSum;
    float lastAngle = 0.0f;
    int sliceIndex = 0;
    for (SliceValue sliceValue : this.dataProvider.getPieChartData().getValues()) {
        float tempAngle = Math.abs(sliceValue.getValue()) * sliceScale;
        if (touchAngle < lastAngle) {
            lastAngle += tempAngle;
            sliceIndex++;
        } else if (selectedValue == null) {
            return sliceValue;
        } else {
            selectedValue.set(sliceIndex, sliceIndex, SelectedValueType.NONE);
            return sliceValue;
        }
    }
    return null;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:20,代码来源:PieChartRenderer.java

示例5: checkTouch

import lecho.lib.hellocharts.model.SelectedValue.SelectedValueType; //导入依赖的package包/类
@Override
public boolean checkTouch(float touchX, float touchY) {
    selectedValue.clear();
    final BubbleChartData data = dataProvider.getBubbleChartData();
    int valueIndex = 0;
    for (BubbleValue bubbleValue : data.getValues()) {
        float rawRadius = processBubble(bubbleValue, bubbleCenter);

        if (ValueShape.SQUARE.equals(bubbleValue.getShape())) {
            if (bubbleRect.contains(touchX, touchY)) {
                selectedValue.set(valueIndex, valueIndex, SelectedValueType.NONE);
            }
        } else if (ValueShape.CIRCLE.equals(bubbleValue.getShape())) {
            final float diffX = touchX - bubbleCenter.x;
            final float diffY = touchY - bubbleCenter.y;
            final float touchDistance = (float) Math.sqrt((diffX * diffX) + (diffY * diffY));

            if (touchDistance <= rawRadius) {
                selectedValue.set(valueIndex, valueIndex, SelectedValueType.NONE);
            }
        } else {
            throw new IllegalArgumentException("Invalid bubble shape: " + bubbleValue.getShape());
        }

        ++valueIndex;
    }

    return isTouched();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:30,代码来源:BubbleChartRenderer.java

示例6: checkTouch

import lecho.lib.hellocharts.model.SelectedValue.SelectedValueType; //导入依赖的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();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:36,代码来源:PieChartRenderer.java

示例7: callTouchListener

import lecho.lib.hellocharts.model.SelectedValue.SelectedValueType; //导入依赖的package包/类
public void callTouchListener() {
    SelectedValue selectedValue = this.chartRenderer.getSelectedValue();
    if (!selectedValue.isSet()) {
        this.onValueTouchListener.onValueDeselected();
    } else if (SelectedValueType.COLUMN.equals(selectedValue.getType())) {
        this.onValueTouchListener.onColumnValueSelected(selectedValue.getFirstIndex(), selectedValue.getSecondIndex(), (SubcolumnValue) ((Column) this.data.getColumnChartData().getColumns().get(selectedValue.getFirstIndex())).getValues().get(selectedValue.getSecondIndex()));
    } else if (SelectedValueType.LINE.equals(selectedValue.getType())) {
        this.onValueTouchListener.onPointValueSelected(selectedValue.getFirstIndex(), selectedValue.getSecondIndex(), (PointValue) ((Line) this.data.getLineChartData().getLines().get(selectedValue.getFirstIndex())).getValues().get(selectedValue.getSecondIndex()));
    } else {
        throw new IllegalArgumentException("Invalid selected value type " + selectedValue.getType().name());
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:13,代码来源:ComboLineColumnChartView.java

示例8: checkTouch

import lecho.lib.hellocharts.model.SelectedValue.SelectedValueType; //导入依赖的package包/类
public boolean checkTouch(float touchX, float touchY) {
    this.selectedValue.clear();
    LineChartData data = this.dataProvider.getLineChartData();
    int lineIndex = 0;
    float imageValueY = (float) (this.lineChartView.getMeasuredHeight() - ChartUtils.dp2px(this.density, 30));
    int imgRadius = ChartUtils.dp2px(this.density, data.getImgRadius()) + 10;
    for (Line line : data.getLines()) {
        int pointRadius = ChartUtils.dp2px(this.density, line.getPointRadius());
        int valueIndex = 0;
        for (PointValue pointValue : line.getValues()) {
            float rawValueX = this.computator.computeRawX(pointValue.getX());
            float rawValueY = this.computator.computeRawY(pointValue.getY());
            if (isInArea(rawValueX, rawValueY, touchX, touchY, (float) (this.touchToleranceMargin + pointRadius))) {
                this.pointIndex = valueIndex;
                this.selectedValue.set(lineIndex, valueIndex, SelectedValueType.LINE, 0);
            } else {
                if (isInArea(rawValueX, imageValueY, touchX, touchY, (float) imgRadius)) {
                    this.selectedValue.set(lineIndex, valueIndex, SelectedValueType.LINE, 1);
                } else {
                    if (isInArea(rawValueX, rawValueY - ((float) ChartUtils.dp2px(this.density, 40)), touchX, touchY, (float) ChartUtils.dp2px(this.density, 40)) && this.pointIndex == valueIndex) {
                        this.selectedValue.set(lineIndex, valueIndex, SelectedValueType.LINE, 2);
                    }
                }
            }
            valueIndex++;
        }
        lineIndex++;
    }
    return isTouched();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:31,代码来源:LineChartRenderer.java

示例9: checkTouch

import lecho.lib.hellocharts.model.SelectedValue.SelectedValueType; //导入依赖的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();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:28,代码来源:PieChartRenderer.java

示例10: checkRectToDraw

import lecho.lib.hellocharts.model.SelectedValue.SelectedValueType; //导入依赖的package包/类
private void checkRectToDraw(int columnIndex, int valueIndex) {
    if (drawRect.contains(touchedPoint.x, touchedPoint.y)) {
        selectedValue.set(columnIndex, valueIndex, SelectedValueType.COLUMN);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:ColumnChartRenderer.java

示例11: checkRectToDraw

import lecho.lib.hellocharts.model.SelectedValue.SelectedValueType; //导入依赖的package包/类
private void checkRectToDraw(int columnIndex, int valueIndex) {
    if (this.drawRect.contains(this.touchedPoint.x, this.touchedPoint.y)) {
        this.selectedValue.set(columnIndex, valueIndex, SelectedValueType.COLUMN);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:6,代码来源:ColumnChartRenderer.java


注:本文中的lecho.lib.hellocharts.model.SelectedValue.SelectedValueType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。