Java Code Examples for lecho.lib.hellocharts.view.PreviewLineChartView#setLineChartData()
The following examples show how to use
lecho.lib.hellocharts.view.PreviewLineChartView#setLineChartData() .
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 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 2
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 3
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 4
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 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 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 7
Source File: PreviewLineChartActivity.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_preview_line_chart, container, false); chart = (LineChartView) rootView.findViewById(R.id.chart); previewChart = (PreviewLineChartView) rootView.findViewById(R.id.chart_preview); // Generate data for previewed chart and copy of that data for preview chart. generateDefaultData(); chart.setLineChartData(data); // Disable zoom/scroll for previewed chart, visible chart ranges depends on preview chart viewport so // zoom/scroll is unnecessary. chart.setZoomEnabled(false); chart.setScrollEnabled(false); previewChart.setLineChartData(previewData); previewChart.setViewportChangeListener(new ViewportListener()); previewX(false); return rootView; }
Example 8
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(); }