Java Code Examples for lecho.lib.hellocharts.model.PointValue#setTarget()

The following examples show how to use lecho.lib.hellocharts.model.PointValue#setTarget() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UserInfoFragment.java    From OmniList with GNU Affero General Public License v3.0 5 votes vote down vote up
private void outputNotesStats(List<Integer> notes) {
    for (Line line : getBinding().lcv.getLineChartData().getLines()) {
        int length = line.getValues().size();
        PointValue pointValue;
        for (int i=0; i<length; i++) {
            pointValue = line.getValues().get(i);
            pointValue.setTarget(pointValue.getX(), notes.get(i));
        }
    }
    getBinding().lcv.startDataAnimation();
}
 
Example 2
Source File: StatisticsFragment.java    From OmniList with GNU Affero General Public License v3.0 5 votes vote down vote up
private void outputNotesStats(List<Integer> notes) {
    for (Line line : getBinding().lcvNote.getLineChartData().getLines()) {
        int length = line.getValues().size();
        PointValue pointValue;
        for (int i=0; i<length; i++) {
            pointValue = line.getValues().get(i);
            pointValue.setTarget(pointValue.getX(), notes.get(i));
        }
    }
    getBinding().lcvNote.startDataAnimation();
}
 
Example 3
Source File: LineChartActivity.java    From hellocharts-android with Apache License 2.0 5 votes vote down vote up
/**
 * To animate values you have to change targets values and then call {@link Chart#startDataAnimation()}
 * method(don't confuse with View.animate()). If you operate on data that was set before you don't have to call
 * {@link LineChartView#setLineChartData(LineChartData)} again.
 */
private void prepareDataAnimation() {
    for (Line line : data.getLines()) {
        for (PointValue value : line.getValues()) {
            // Here I modify target only for Y values but it is OK to modify X targets as well.
            value.setTarget(value.getX(), (float) Math.random() * 100);
        }
    }
}
 
Example 4
Source File: LineColumnDependencyActivity.java    From hellocharts-android with Apache License 2.0 5 votes vote down vote up
private void generateLineData(int color, float range) {
    // Cancel last animation if not finished.
    chartTop.cancelDataAnimation();

    // Modify data targets
    Line line = lineData.getLines().get(0);// For this example there is always only one line.
    line.setColor(color);
    for (PointValue value : line.getValues()) {
        // Change target only for Y value.
        value.setTarget(value.getX(), (float) Math.random() * range);
    }

    // Start new data animation with 300ms duration;
    chartTop.startDataAnimation(300);
}