lecho.lib.hellocharts.gesture.ZoomType Java Examples

The following examples show how to use lecho.lib.hellocharts.gesture.ZoomType. 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: BGHistory.java    From xDrip-plus with GNU General Public License v3.0 6 votes vote down vote up
private void setupCharts() {
    dateButton1.setText(dateFormatter.format(date1.getTime()));

    Calendar endDate = (GregorianCalendar) date1.clone();
    endDate.add(Calendar.DATE, noDays);
    int numValues = noDays * (60 / 2) * 24; // LimiTTer sample rate 1 per 2 minutes
    BgGraphBuilder bgGraphBuilder = new BgGraphBuilder(this, date1.getTimeInMillis(), endDate.getTimeInMillis(), numValues, false);

    chart = (LineChartView) findViewById(R.id.chart);
    chart.setZoomType(ZoomType.HORIZONTAL);
    previewChart = (PreviewLineChartView) findViewById(R.id.chart_preview);
    previewChart.setZoomType(ZoomType.HORIZONTAL);

    chart.setLineChartData(bgGraphBuilder.lineData());
    chart.setOnValueTouchListener(bgGraphBuilder.getOnValueSelectTooltipListener(this));
    previewChart.setLineChartData(bgGraphBuilder.previewLineData(chart.getLineChartData()));

    previewChart.setViewportCalculationEnabled(true);
    chart.setViewportCalculationEnabled(true);
    previewChart.setViewportChangeListener(new ViewportListener());
    chart.setViewportChangeListener(new ChartViewPortListener());

    setupStatistics(date1.getTimeInMillis(), endDate.getTimeInMillis());
}
 
Example #2
Source File: MainActivity.java    From HAPP with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onPostExecute(ArrayList<LineChartData> result) {
    //Write some code you want to execute on UI after doInBackground() completes
    bgChartLoading.setVisibility(View.GONE);
    //bgChart.setVisibility(View.VISIBLE);

    bgChart.setLineChartData(result.get(0));
    bgPreviewChart.setLineChartData(result.get(1));
    updateStuff = true;

    //refreshes data and sets viewpoint
    bgChart.setZoomType(ZoomType.HORIZONTAL);
    bgPreviewChart.setZoomType(ZoomType.HORIZONTAL);
    bgPreviewChart.setViewportCalculationEnabled(true);
    bgChart.setViewportCalculationEnabled(true);
    bgPreviewChart.setViewportChangeListener(new ViewportListener());
    bgChart.setViewportChangeListener(new ChartViewPortListener());

    setViewport();

    Log.d(TAG, "bgGraph Updated");
}
 
Example #3
Source File: Home.java    From NightWatch with GNU General Public License v3.0 6 votes vote down vote up
public void setupCharts() {
    bgGraphBuilder  = new BgGraphBuilder(this);
    updateStuff = false;
    chart = (LineChartView) findViewById(R.id.chart);
    chart.setZoomType(ZoomType.HORIZONTAL);

    previewChart = (PreviewLineChartView) findViewById(R.id.chart_preview);
    previewChart.setZoomType(ZoomType.HORIZONTAL);

    chart.setLineChartData(bgGraphBuilder.lineData());
    previewChart.setLineChartData(bgGraphBuilder.previewLineData());
    updateStuff = true;

    previewChart.setViewportCalculationEnabled(true);
    chart.setViewportCalculationEnabled(true);
    previewChart.setViewportChangeListener(new ViewportListener());
    chart.setViewportChangeListener(new ChartViewPortListener());
    setViewport();
}
 
Example #4
Source File: BGHistory.java    From xDrip-Experimental with GNU General Public License v3.0 6 votes vote down vote up
private void setupCharts() {
    dateButton1.setText(dateFormatter.format(date1.getTime()));

    Calendar endDate = (GregorianCalendar) date1.clone();
    endDate.add(Calendar.DATE, noDays);
    int numValues = noDays * (60 / 5) * 24;
    BgGraphBuilder bgGraphBuilder = new BgGraphBuilder(this, date1.getTimeInMillis(), endDate.getTimeInMillis(), numValues);

    chart = (LineChartView) findViewById(R.id.chart);
    chart.setZoomType(ZoomType.HORIZONTAL);
    previewChart = (PreviewLineChartView) findViewById(R.id.chart_preview);
    previewChart.setZoomType(ZoomType.HORIZONTAL);

    chart.setLineChartData(bgGraphBuilder.lineData());
    chart.setOnValueTouchListener(bgGraphBuilder.getOnValueSelectTooltipListener());
    previewChart.setLineChartData(bgGraphBuilder.previewLineData());

    previewChart.setViewportCalculationEnabled(true);
    chart.setViewportCalculationEnabled(true);
    previewChart.setViewportChangeListener(new ViewportListener());
    chart.setViewportChangeListener(new ChartViewPortListener());
}
 
Example #5
Source File: Home.java    From NightWatch with GNU General Public License v3.0 6 votes vote down vote up
public void setupCharts() {
    bgGraphBuilder  = new BgGraphBuilder(this);
    updateStuff = false;
    chart = (LineChartView) findViewById(R.id.chart);
    chart.setZoomType(ZoomType.HORIZONTAL);

    previewChart = (PreviewLineChartView) findViewById(R.id.chart_preview);
    previewChart.setZoomType(ZoomType.HORIZONTAL);

    chart.setLineChartData(bgGraphBuilder.lineData());
    previewChart.setLineChartData(bgGraphBuilder.previewLineData());
    updateStuff = true;

    previewChart.setViewportCalculationEnabled(true);
    chart.setViewportCalculationEnabled(true);
    previewChart.setViewportChangeListener(new ViewportListener());
    chart.setViewportChangeListener(new ChartViewPortListener());
    setViewport();
}
 
Example #6
Source File: Home.java    From xDrip with GNU General Public License v3.0 6 votes vote down vote up
public void setupCharts() {
    bgGraphBuilder = new BgGraphBuilder(this);
    updateStuff = false;
    chart = (LineChartView) findViewById(R.id.chart);
    chart.setZoomType(ZoomType.HORIZONTAL);

    previewChart = (PreviewLineChartView) findViewById(R.id.chart_preview);
    previewChart.setZoomType(ZoomType.HORIZONTAL);

    chart.setLineChartData(bgGraphBuilder.lineData());
    previewChart.setLineChartData(bgGraphBuilder.previewLineData());
    updateStuff = true;

    previewChart.setViewportCalculationEnabled(true);
    chart.setViewportCalculationEnabled(true);
    previewChart.setViewportChangeListener(new ViewportListener());
    chart.setViewportChangeListener(new ChartViewPortListener());
    setViewport();
}
 
Example #7
Source File: BGHistory.java    From xDrip with GNU General Public License v3.0 6 votes vote down vote up
private void setupCharts() {
    dateButton1.setText(dateFormatter.format(date1.getTime()));

    Calendar endDate = (GregorianCalendar) date1.clone();
    endDate.add(Calendar.DATE, noDays);
    int numValues = noDays * (60 / 2) * 24; // LimiTTer sample rate 1 per 2 minutes
    BgGraphBuilder bgGraphBuilder = new BgGraphBuilder(this, date1.getTimeInMillis(), endDate.getTimeInMillis(), numValues, false);

    chart = (LineChartView) findViewById(R.id.chart);
    chart.setZoomType(ZoomType.HORIZONTAL);
    previewChart = (PreviewLineChartView) findViewById(R.id.chart_preview);
    previewChart.setZoomType(ZoomType.HORIZONTAL);

    chart.setLineChartData(bgGraphBuilder.lineData());
    chart.setOnValueTouchListener(bgGraphBuilder.getOnValueSelectTooltipListener(this));
    previewChart.setLineChartData(bgGraphBuilder.previewLineData(chart.getLineChartData()));

    previewChart.setViewportCalculationEnabled(true);
    chart.setViewportCalculationEnabled(true);
    previewChart.setViewportChangeListener(new ViewportListener());
    chart.setViewportChangeListener(new ChartViewPortListener());

    setupStatistics(date1.getTimeInMillis(), endDate.getTimeInMillis());
}
 
Example #8
Source File: BasalProfileEditor.java    From xDrip with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_basal_profile_editor);
    JoH.fixActionBar(this);
    //  getSupportActionBar().setCustomView(R.layout.custom_action_bar_title);
    //  getSupportActionBar().setDisplayShowCustomEnabled(true);

    chart = (ColumnChartView) findViewById(R.id.basalChart);
    basalSelectSpinner = findViewById(R.id.basalProfileSpinner);
    basalStepSpinner = findViewById(R.id.basalStepSpinner);
    setValue = (EditText) findViewById(R.id.basalSetText);
    setButton = (Button) findViewById(R.id.basalSetButton);
    plusButton = (Button) findViewById(R.id.basalPlusButton);
    minusButton = (Button) findViewById(R.id.basalMinusButton);

    chart.setDataAnimationListener(this);
    chart.setOnValueTouchListener(new ValueTouchListener());
    chart.setColumnChartData(BasalChart.columnData());

    autoSetViewPort(true);
    refreshScreenElements();
    chart.setZoomType(ZoomType.HORIZONTAL);
    chart.setContainerScrollEnabled(true, ContainerScrollType.HORIZONTAL);
    //chart.setZoomLevel(0,0,1);
    chart.setMaxZoom(4f);
    chart.setZoomLevel(getNewMaxViewport().centerX(), getNewMaxViewport().centerY(), 1f);
    chart.setTapZoomEnabled(false);

    populateBasalStepSpinner();

}
 
Example #9
Source File: PreviewColumnChartActivity.java    From hellocharts-android with Apache License 2.0 5 votes vote down vote up
private void previewX(boolean animate) {
    Viewport tempViewport = new Viewport(chart.getMaximumViewport());
    float dx = tempViewport.width() / 4;
    tempViewport.inset(dx, 0);
    if (animate) {
        previewChart.setCurrentViewportWithAnimation(tempViewport);
    } else {
        previewChart.setCurrentViewport(tempViewport);
    }
    previewChart.setZoomType(ZoomType.HORIZONTAL);
}
 
Example #10
Source File: PreviewColumnChartActivity.java    From hellocharts-android with Apache License 2.0 5 votes vote down vote up
private void previewY() {
    Viewport tempViewport = new Viewport(chart.getMaximumViewport());
    float dy = tempViewport.height() / 4;
    tempViewport.inset(0, dy);
    previewChart.setCurrentViewportWithAnimation(tempViewport);
    previewChart.setZoomType(ZoomType.VERTICAL);
}
 
Example #11
Source File: PreviewColumnChartActivity.java    From hellocharts-android with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.action_reset) {
        generateDefaultData();
        chart.setColumnChartData(data);
        previewChart.setColumnChartData(previewData);
        previewX(true);
        return true;
    }
    if (id == R.id.action_preview_both) {
        previewXY();
        previewChart.setZoomType(ZoomType.HORIZONTAL_AND_VERTICAL);
        return true;
    }
    if (id == R.id.action_preview_horizontal) {
        previewX(true);
        return true;
    }
    if (id == R.id.action_preview_vertical) {
        previewY();
        return true;
    }
    if (id == R.id.action_change_color) {
        int color = ChartUtils.pickColor();
        while (color == previewChart.getPreviewColor()) {
            color = ChartUtils.pickColor();
        }
        previewChart.setPreviewColor(color);
        return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example #12
Source File: Home.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onViewportChanged(Viewport newViewport) {
    if (!updatingChartViewport) {
        updatingPreviewViewport = true;
        chart.setZoomType(ZoomType.HORIZONTAL);
        chart.setCurrentViewport(newViewport, false);
        tempViewport = newViewport;
        updatingPreviewViewport = false;
    }
    if (updateStuff == true) {
        holdViewport.set(newViewport.left, newViewport.top, newViewport.right, newViewport.bottom);
    }
}
 
Example #13
Source File: PreviewLineChartActivity.java    From hellocharts-android with Apache License 2.0 5 votes vote down vote up
private void previewX(boolean animate) {
    Viewport tempViewport = new Viewport(chart.getMaximumViewport());
    float dx = tempViewport.width() / 4;
    tempViewport.inset(dx, 0);
    if (animate) {
        previewChart.setCurrentViewportWithAnimation(tempViewport);
    } else {
        previewChart.setCurrentViewport(tempViewport);
    }
    previewChart.setZoomType(ZoomType.HORIZONTAL);
}
 
Example #14
Source File: Home.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onViewportChanged(Viewport newViewport) {
    if (!updatingPreviewViewport) {
        updatingChartViewport = true;
        previewChart.setZoomType(ZoomType.HORIZONTAL);
        previewChart.setCurrentViewport(newViewport, false);
        updatingChartViewport = false;
    }
}
 
Example #15
Source File: LineColumnDependencyActivity.java    From hellocharts-android with Apache License 2.0 5 votes vote down vote up
/**
 * Generates initial data for line chart. At the begining all Y values are equals 0. That will change when user
 * will select value on column chart.
 */
private void generateInitialLineData() {
    int numValues = 7;

    List<AxisValue> axisValues = new ArrayList<AxisValue>();
    List<PointValue> values = new ArrayList<PointValue>();
    for (int i = 0; i < numValues; ++i) {
        values.add(new PointValue(i, 0));
        axisValues.add(new AxisValue(i).setLabel(days[i]));
    }

    Line line = new Line(values);
    line.setColor(ChartUtils.COLOR_GREEN).setCubic(true);

    List<Line> lines = new ArrayList<Line>();
    lines.add(line);

    lineData = new LineChartData(lines);
    lineData.setAxisXBottom(new Axis(axisValues).setHasLines(true));
    lineData.setAxisYLeft(new Axis().setHasLines(true).setMaxLabelChars(3));

    chartTop.setLineChartData(lineData);

    // For build-up animation you have to disable viewport recalculation.
    chartTop.setViewportCalculationEnabled(false);

    // And set initial max viewport and current viewport- remember to set viewports after data.
    Viewport v = new Viewport(0, 110, 6, 0);
    chartTop.setMaximumViewport(v);
    chartTop.setCurrentViewport(v);

    chartTop.setZoomType(ZoomType.HORIZONTAL);
}
 
Example #16
Source File: Home.java    From NightWatch with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onViewportChanged(Viewport newViewport) {
    if (!updatingChartViewport) {
        updatingPreviewViewport = true;
        chart.setZoomType(ZoomType.HORIZONTAL);
        chart.setCurrentViewport(newViewport);
        tempViewport = newViewport;
        updatingPreviewViewport = false;
    }
    if (updateStuff) {
        holdViewport.set(newViewport.left, newViewport.top, newViewport.right, newViewport.bottom);
    }
}
 
Example #17
Source File: Home.java    From NightWatch with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onViewportChanged(Viewport newViewport) {
    if (!updatingPreviewViewport) {
        updatingChartViewport = true;
        previewChart.setZoomType(ZoomType.HORIZONTAL);
        previewChart.setCurrentViewport(newViewport);
        updatingChartViewport = false;
    }
}
 
Example #18
Source File: PreviewLineChartActivity.java    From hellocharts-android with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.action_reset) {
        generateDefaultData();
        chart.setLineChartData(data);
        previewChart.setLineChartData(previewData);
        previewX(true);
        return true;
    }
    if (id == R.id.action_preview_both) {
        previewXY();
        previewChart.setZoomType(ZoomType.HORIZONTAL_AND_VERTICAL);
        return true;
    }
    if (id == R.id.action_preview_horizontal) {
        previewX(true);
        return true;
    }
    if (id == R.id.action_preview_vertical) {
        previewY();
        return true;
    }
    if (id == R.id.action_change_color) {
        int color = ChartUtils.pickColor();
        while (color == previewChart.getPreviewColor()) {
            color = ChartUtils.pickColor();
        }
        previewChart.setPreviewColor(color);
        return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example #19
Source File: MainActivity.java    From HAPP with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onViewportChanged(Viewport newViewport) {
    if (!updatingChartViewport) {
        updatingPreviewViewport = true;
        bgChart.setZoomType(ZoomType.HORIZONTAL);
        bgChart.setCurrentViewport(newViewport);
        tempViewport = newViewport;
        updatingPreviewViewport = false;

        if (iobcobFragmentObject.getView() != null) {                                       //Fragment is loaded
            LineChartView iobcobPastChart = (LineChartView) findViewById(R.id.iobcobPast);
            iobcobPastChart.setCurrentViewport(newViewport);
            Viewport iobv = new Viewport(iobcobPastChart.getMaximumViewport());             //Update the IOB COB Line Chart Viewport to stay inline with the preview
            iobv.left   = newViewport.left;
            iobv.right  = newViewport.right;
            iobv.top    = iobcobPastChart.getMaximumViewport().top;
            iobv.bottom = iobcobPastChart.getMaximumViewport().bottom;
            iobcobPastChart.setMaximumViewport(iobv);
            iobcobPastChart.setCurrentViewport(iobv);
        }
        if (basalvsTempBasalObject.getView() != null){
            LineChartView bvbChart = (LineChartView) findViewById(R.id.basalvsTempBasal_LineChart);
            Viewport bvbv = new Viewport(bgChart.getMaximumViewport());
            bvbv.left = newViewport.left;
            bvbv.right = newViewport.right;
            bvbv.top    = bvbChart.getMaximumViewport().top;
            bvbv.bottom = bvbChart.getMaximumViewport().bottom;
            bvbChart.setMaximumViewport(bvbv);
            bvbChart.setCurrentViewport(bvbv);

        }
    }
    if (updateStuff) {
        holdViewport.set(newViewport.left, newViewport.top, newViewport.right, newViewport.bottom);
    }
}
 
Example #20
Source File: MainActivity.java    From HAPP with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onViewportChanged(Viewport newViewport) {
    if (!updatingPreviewViewport) {
        updatingChartViewport = true;
        bgPreviewChart.setZoomType(ZoomType.HORIZONTAL);
        bgPreviewChart.setCurrentViewport(newViewport);
        updatingChartViewport = false;

        if (iobcobFragmentObject.getView() != null) {                                       //Fragment is loaded
            LineChartView iobcobPastChart = (LineChartView) findViewById(R.id.iobcobPast);
            Viewport iobv = new Viewport(bgChart.getMaximumViewport());                       //Update the IOB COB Line Chart Viewport to stay inline with the preview
            iobv.left   = newViewport.left;
            iobv.right  = newViewport.right;
            iobv.top    = iobcobPastChart.getMaximumViewport().top;
            iobv.bottom = iobcobPastChart.getMaximumViewport().bottom;
            iobcobPastChart.setMaximumViewport(iobv);
            iobcobPastChart.setCurrentViewport(iobv);
        }
        if (basalvsTempBasalObject.getView() != null){
            LineChartView bvbChart = (LineChartView) findViewById(R.id.basalvsTempBasal_LineChart);
            Viewport bvbv = new Viewport(bgChart.getMaximumViewport());
            bvbv.left   = newViewport.left;
            bvbv.right  = newViewport.right;
            bvbv.top    = bvbChart.getMaximumViewport().top;
            bvbv.bottom = bvbChart.getMaximumViewport().bottom;
            bvbChart.setMaximumViewport(bvbv);
            bvbChart.setCurrentViewport(bvbv);
        }
    }
}
 
Example #21
Source File: PreviewLineChartActivity.java    From hellocharts-android with Apache License 2.0 5 votes vote down vote up
private void previewY() {
    Viewport tempViewport = new Viewport(chart.getMaximumViewport());
    float dy = tempViewport.height() / 4;
    tempViewport.inset(0, dy);
    previewChart.setCurrentViewportWithAnimation(tempViewport);
    previewChart.setZoomType(ZoomType.VERTICAL);
}
 
Example #22
Source File: Home.java    From NightWatch with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onViewportChanged(Viewport newViewport) {
    if (!updatingPreviewViewport) {
        updatingChartViewport = true;
        previewChart.setZoomType(ZoomType.HORIZONTAL);
        previewChart.setCurrentViewport(newViewport);
        updatingChartViewport = false;
    }
}
 
Example #23
Source File: BGHistory.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onViewportChanged(Viewport newViewport) {
    if (!updatingChartViewport) {
        updatingPreviewViewport = true;
        chart.setZoomType(ZoomType.HORIZONTAL);
        chart.setCurrentViewport(newViewport);
        updatingPreviewViewport = false;
    }
}
 
Example #24
Source File: BasalProfileEditor.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_basal_profile_editor);
    JoH.fixActionBar(this);
    //  getSupportActionBar().setCustomView(R.layout.custom_action_bar_title);
    //  getSupportActionBar().setDisplayShowCustomEnabled(true);

    chart = (ColumnChartView) findViewById(R.id.basalChart);
    basalSelectSpinner = findViewById(R.id.basalProfileSpinner);
    basalStepSpinner = findViewById(R.id.basalStepSpinner);
    setValue = (EditText) findViewById(R.id.basalSetText);
    setButton = (Button) findViewById(R.id.basalSetButton);
    plusButton = (Button) findViewById(R.id.basalPlusButton);
    minusButton = (Button) findViewById(R.id.basalMinusButton);

    chart.setDataAnimationListener(this);
    chart.setOnValueTouchListener(new ValueTouchListener());
    chart.setColumnChartData(BasalChart.columnData());

    autoSetViewPort(true);
    refreshScreenElements();
    chart.setZoomType(ZoomType.HORIZONTAL);
    chart.setContainerScrollEnabled(true, ContainerScrollType.HORIZONTAL);
    //chart.setZoomLevel(0,0,1);
    chart.setMaxZoom(4f);
    chart.setZoomLevel(getNewMaxViewport().centerX(), getNewMaxViewport().centerY(), 1f);
    chart.setTapZoomEnabled(false);

    populateBasalStepSpinner();

}
 
Example #25
Source File: Home.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
@Override
public synchronized void onViewportChanged(Viewport newViewport) {
    if (!updatingPreviewViewport) {
        updatingChartViewport = true;
        previewChart.setZoomType(ZoomType.HORIZONTAL);
        previewChart.setCurrentViewport(newViewport);
        updatingChartViewport = false;
    }
}
 
Example #26
Source File: BGHistory.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onViewportChanged(Viewport newViewport) {
    if (!updatingPreviewViewport) {
        updatingChartViewport = true;
        previewChart.setZoomType(ZoomType.HORIZONTAL);
        previewChart.setCurrentViewport(newViewport);
        updatingChartViewport = false;
    }
}
 
Example #27
Source File: Home.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
@Override
public synchronized void onViewportChanged(Viewport newViewport) {
    if (!updatingChartViewport) {
        updatingPreviewViewport = true;
        chart.setZoomType(ZoomType.HORIZONTAL);
        chart.setCurrentViewport(newViewport);
        tempViewport = newViewport;
        updatingPreviewViewport = false;
    }
    if (updateStuff) {
        holdViewport.set(newViewport.left, newViewport.top, newViewport.right, newViewport.bottom);
    }
}
 
Example #28
Source File: Home.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
@Override
public synchronized void onViewportChanged(Viewport newViewport) {
    if (!updatingPreviewViewport) {
        updatingChartViewport = true;
        previewChart.setZoomType(ZoomType.HORIZONTAL);
        previewChart.setCurrentViewport(newViewport);
        updatingChartViewport = false;
    }
}
 
Example #29
Source File: Home.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
@Override
public synchronized void onViewportChanged(Viewport newViewport) {
    if (!updatingChartViewport) {
        updatingPreviewViewport = true;
        chart.setZoomType(ZoomType.HORIZONTAL);
        chart.setCurrentViewport(newViewport);
        tempViewport = newViewport;
        updatingPreviewViewport = false;
    }
    if (updateStuff) {
        holdViewport.set(newViewport.left, newViewport.top, newViewport.right, newViewport.bottom);
    }
}
 
Example #30
Source File: BGHistory.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onViewportChanged(Viewport newViewport) {
    if (!updatingPreviewViewport) {
        updatingChartViewport = true;
        previewChart.setZoomType(ZoomType.HORIZONTAL);
        previewChart.setCurrentViewport(newViewport);
        updatingChartViewport = false;
    }
}