Java Code Examples for lecho.lib.hellocharts.view.LineChartView#setViewportCalculationEnabled()
The following examples show how to use
lecho.lib.hellocharts.view.LineChartView#setViewportCalculationEnabled() .
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: LineCharts.java From MetalDetector with GNU General Public License v3.0 | 6 votes |
/** * 初始化视图 * */ protected void initView(LineChartView lineChartView) { pointValueList = new ArrayList<>(); linesList = new ArrayList<>(); //初始化坐标轴 axisY = new Axis(); axisX = new Axis(); lineChartData = initData(null); lineChartView.setLineChartData(lineChartData); Viewport port = initViewPort(0, 50,150); lineChartView.setCurrentViewportWithAnimation(port); lineChartView.setInteractive(false); lineChartView.setScrollEnabled(true); lineChartView.setValueTouchEnabled(true); lineChartView.setFocusableInTouchMode(true); lineChartView.setViewportCalculationEnabled(false); lineChartView.setContainerScrollEnabled(true, ContainerScrollType.HORIZONTAL); lineChartView.startDataAnimation(); points = new ArrayList<>(); }
Example 2
Source File: BGHistory.java From xDrip with GNU General Public License v3.0 | 6 votes |
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 3
Source File: BGHistory.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
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 4
Source File: BGHistory.java From xDrip-Experimental with GNU General Public License v3.0 | 6 votes |
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 |
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 NightWatch with GNU General Public License v3.0 | 6 votes |
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: Home.java From xDrip with GNU General Public License v3.0 | 6 votes |
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 8
Source File: LineChartActivity.java From hellocharts-android with Apache License 2.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { setHasOptionsMenu(true); View rootView = inflater.inflate(R.layout.fragment_line_chart, container, false); chart = (LineChartView) rootView.findViewById(R.id.chart); chart.setOnValueTouchListener(new ValueTouchListener()); // Generate some random values. generateValues(); generateData(); // Disable viewport recalculations, see toggleCubic() method for more info. chart.setViewportCalculationEnabled(false); resetViewport(); return rootView; }
Example 9
Source File: ExampleChartPreferenceView.java From xDrip with GNU General Public License v3.0 | 5 votes |
protected void refreshView(View view) { LineChartView chart = (LineChartView) view.findViewById(R.id.example_linechart); BgGraphBuilder bgGraphBuilder = new BgGraphBuilder(getContext()); chart.setLineChartData(bgGraphBuilder.lineData()); Viewport viewport = chart.getMaximumViewport(); chart.setViewportCalculationEnabled(false); chart.setInteractive(false); chart.setCurrentViewport(viewport); chart.setPadding(0, 0, 0, 0); chart.setLeft(0); chart.setTop(0); Log.d(TAG, "onBindExampleChart: refreshview " + chart.getHeight()); }
Example 10
Source File: ExampleChartPreferenceView.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
protected void refreshView(View view) { LineChartView chart = (LineChartView) view.findViewById(R.id.example_linechart); BgGraphBuilder bgGraphBuilder = new BgGraphBuilder(getContext()); chart.setLineChartData(bgGraphBuilder.lineData()); Viewport viewport = chart.getMaximumViewport(); chart.setViewportCalculationEnabled(false); chart.setInteractive(false); chart.setCurrentViewport(viewport); chart.setPadding(0, 0, 0, 0); chart.setLeft(0); chart.setTop(0); Log.d(TAG, "onBindExampleChart: refreshview " + chart.getHeight()); }
Example 11
Source File: Home.java From xDrip-Experimental with GNU General Public License v3.0 | 4 votes |
private void setupCharts() { bgGraphBuilder = new BgGraphBuilder(this); updateStuff = false; chart = (LineChartView) findViewById(R.id.chart); chart.setZoomType(ZoomType.HORIZONTAL); //Transmitter Battery Level final Sensor sensor = Sensor.currentSensor(); if (sensor != null && sensor.latest_battery_level != 0 && sensor.latest_battery_level <= Constants.TRANSMITTER_BATTERY_LOW && ! mPreferences.getBoolean("disable_battery_warning", false)) { Drawable background = new Drawable() { @Override public void draw(Canvas canvas) { DisplayMetrics metrics = getApplicationContext().getResources().getDisplayMetrics(); int px = (int) (30 * (metrics.densityDpi / 160f)); Paint paint = new Paint(); paint.setTextSize(px); paint.setAntiAlias(true); paint.setColor(Color.parseColor("#FFFFAA")); paint.setStyle(Paint.Style.STROKE); paint.setAlpha(100); canvas.drawText("transmitter battery", 10, chart.getHeight() / 3 - (int) (1.2 * px), paint); if(sensor.latest_battery_level <= Constants.TRANSMITTER_BATTERY_EMPTY){ paint.setTextSize((int)(px*1.5)); canvas.drawText("VERY LOW", 10, chart.getHeight() / 3, paint); } else { canvas.drawText("low", 10, chart.getHeight() / 3, paint); } } @Override public void setAlpha(int alpha) {} @Override public void setColorFilter(ColorFilter cf) {} @Override public int getOpacity() {return 0;} }; chart.setBackground(background); } previewChart = (PreviewLineChartView) findViewById(R.id.chart_preview); previewChart.setZoomType(ZoomType.HORIZONTAL); chart.setLineChartData(bgGraphBuilder.lineData()); chart.setOnValueTouchListener(bgGraphBuilder.getOnValueSelectTooltipListener()); previewChart.setLineChartData(bgGraphBuilder.previewLineData()); updateStuff = true; previewChart.setViewportCalculationEnabled(true); chart.setViewportCalculationEnabled(true); previewChart.setViewportChangeListener(new ViewportListener()); chart.setViewportChangeListener(new ChartViewPortListener()); setViewport(); }