com.github.mikephil.charting.charts.BarLineChartBase Java Examples
The following examples show how to use
com.github.mikephil.charting.charts.BarLineChartBase.
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: BarLineChartBaseManager.java From react-native-mp-android-chart with MIT License | 6 votes |
@ReactProp(name = "zoom") public void setZoom(BarLineChartBase chart, ReadableMap propMap) { if (BridgeUtils.validate(propMap, ReadableType.Number, "scaleX") && BridgeUtils.validate(propMap, ReadableType.Number, "scaleY") && BridgeUtils.validate(propMap, ReadableType.Number, "xValue") && BridgeUtils.validate(propMap, ReadableType.Number, "yValue")) { YAxis.AxisDependency axisDependency = YAxis.AxisDependency.LEFT; if (propMap.hasKey("axisDependency") && propMap.getString("axisDependency").equalsIgnoreCase("RIGHT")) { axisDependency = YAxis.AxisDependency.RIGHT; } chart.zoom( (float) propMap.getDouble("scaleX"), (float) propMap.getDouble("scaleY"), (float) propMap.getDouble("xValue"), (float) propMap.getDouble("yValue"), axisDependency ); } }
Example #2
Source File: ZoomJob.java From NetKnight with Apache License 2.0 | 6 votes |
@Override public void run() { Matrix save = mViewPortHandler.zoom(scaleX, scaleY); mViewPortHandler.refresh(save, view, false); float valsInView = ((BarLineChartBase) view).getDeltaY(axisDependency) / mViewPortHandler.getScaleY(); float xsInView = ((BarLineChartBase) view).getXAxis().getValues().size() / mViewPortHandler.getScaleX(); pts[0] = xValue - xsInView / 2f; pts[1] = yValue + valsInView / 2f; mTrans.pointValuesToPixel(pts); save = mViewPortHandler.translate(pts); mViewPortHandler.refresh(save, view, false); ((BarLineChartBase) view).calculateOffsets(); view.postInvalidate(); }
Example #3
Source File: ZoomJob.java From StockChart-MPAndroidChart with MIT License | 6 votes |
@Override public void run() { Matrix save = mRunMatrixBuffer; mViewPortHandler.zoom(scaleX, scaleY, save); mViewPortHandler.refresh(save, view, false); float yValsInView = ((BarLineChartBase) view).getAxis(axisDependency).mAxisRange / mViewPortHandler.getScaleY(); float xValsInView = ((BarLineChartBase) view).getXAxis().mAxisRange / mViewPortHandler.getScaleX(); pts[0] = xValue - xValsInView / 2f; pts[1] = yValue + yValsInView / 2f; mTrans.pointValuesToPixel(pts); mViewPortHandler.translate(pts, save); mViewPortHandler.refresh(save, view, false); ((BarLineChartBase) view).calculateOffsets(); view.postInvalidate(); recycleInstance(this); }
Example #4
Source File: ZoomJob.java From Stayfit with Apache License 2.0 | 6 votes |
@Override public void run() { Matrix save = mViewPortHandler.zoom(scaleX, scaleY); mViewPortHandler.refresh(save, view, false); float valsInView = ((BarLineChartBase) view).getDeltaY(axisDependency) / mViewPortHandler.getScaleY(); float xsInView = ((BarLineChartBase) view).getXAxis().getValues().size() / mViewPortHandler.getScaleX(); pts[0] = xValue - xsInView / 2f; pts[1] = yValue + valsInView / 2f; mTrans.pointValuesToPixel(pts); save = mViewPortHandler.translate(pts); mViewPortHandler.refresh(save, view, false); ((BarLineChartBase) view).calculateOffsets(); view.postInvalidate(); }
Example #5
Source File: ZoomJob.java From Ticket-Analysis with MIT License | 6 votes |
@Override public void run() { Matrix save = mRunMatrixBuffer; mViewPortHandler.zoom(scaleX, scaleY, save); mViewPortHandler.refresh(save, view, false); float yValsInView = ((BarLineChartBase) view).getAxis(axisDependency).mAxisRange / mViewPortHandler.getScaleY(); float xValsInView = ((BarLineChartBase) view).getXAxis().mAxisRange / mViewPortHandler.getScaleX(); pts[0] = xValue - xValsInView / 2f; pts[1] = yValue + yValsInView / 2f; mTrans.pointValuesToPixel(pts); mViewPortHandler.translate(pts, save); mViewPortHandler.refresh(save, view, false); ((BarLineChartBase) view).calculateOffsets(); view.postInvalidate(); recycleInstance(this); }
Example #6
Source File: ChartInfoViewHandler.java From android-kline with Apache License 2.0 | 6 votes |
public ChartInfoViewHandler(BarLineChartBase chart) { mChart = chart; mDetector = new GestureDetector(mChart.getContext(), new GestureDetector.SimpleOnGestureListener() { @Override public void onLongPress(MotionEvent e) { super.onLongPress(e); mIsLongPress = true; Highlight h = mChart.getHighlightByTouchPoint(e.getX(), e.getY()); if (h != null) { mChart.highlightValue(h, true); mChart.disableScroll(); } } }); }
Example #7
Source File: ZoomJob.java From android-kline with Apache License 2.0 | 6 votes |
@Override public void run() { Matrix save = mRunMatrixBuffer; mViewPortHandler.zoom(scaleX, scaleY, save); mViewPortHandler.refresh(save, view, false); float yValsInView = ((BarLineChartBase) view).getAxis(axisDependency).mAxisRange / mViewPortHandler.getScaleY(); float xValsInView = ((BarLineChartBase) view).getXAxis().mAxisRange / mViewPortHandler.getScaleX(); pts[0] = xValue - xValsInView / 2f; pts[1] = yValue + yValsInView / 2f; mTrans.pointValuesToPixel(pts); mViewPortHandler.translate(pts, save); mViewPortHandler.refresh(save, view, false); ((BarLineChartBase) view).calculateOffsets(); view.postInvalidate(); recycleInstance(this); }
Example #8
Source File: KLineView.java From android-kline with Apache License 2.0 | 5 votes |
@Override public void onAxisChange(BarLineChartBase chart) { float lowestVisibleX = chart.getLowestVisibleX(); if (lowestVisibleX <= chart.getXAxis().getAxisMinimum()) return; int maxX = (int) chart.getHighestVisibleX(); int x = Math.min(maxX, mData.size() - 1); HisData hisData = mData.get(x < 0 ? 0 : x); setDescription(mChartPrice, String.format(Locale.getDefault(), "MA5:%.2f MA10:%.2f MA20:%.2f MA30:%.2f", hisData.getMa5(), hisData.getMa10(), hisData.getMa20(), hisData.getMa30())); setDescription(mChartVolume, "成交量 " + hisData.getVol()); setDescription(mChartMacd, String.format(Locale.getDefault(), "MACD:%.2f DEA:%.2f DIF:%.2f", hisData.getMacd(), hisData.getDea(), hisData.getDif())); setDescription(mChartKdj, String.format(Locale.getDefault(), "K:%.2f D:%.2f J:%.2f", hisData.getK(), hisData.getD(), hisData.getJ())); }
Example #9
Source File: BarLineChartBaseManager.java From react-native-mp-android-chart with MIT License | 5 votes |
@Override public void setYAxis(Chart chart, ReadableMap propMap) { BarLineChartBase barLineChart = (BarLineChartBase) chart; if (BridgeUtils.validate(propMap, ReadableType.Map, "left")) { YAxis leftYAxis = barLineChart.getAxisLeft(); setCommonAxisConfig(chart, leftYAxis, propMap.getMap("left")); setYAxisConfig(leftYAxis, propMap.getMap("left")); } if (BridgeUtils.validate(propMap, ReadableType.Map, "right")) { YAxis rightYAxis = barLineChart.getAxisRight(); setCommonAxisConfig(chart, rightYAxis, propMap.getMap("right")); setYAxisConfig(rightYAxis, propMap.getMap("right")); } }
Example #10
Source File: BarLineChartTouchListener.java From NetKnight with Apache License 2.0 | 5 votes |
public BarLineChartTouchListener(BarLineChartBase<? extends BarLineScatterCandleBubbleData<? extends IBarLineScatterCandleBubbleDataSet<? extends Entry>>> chart, Matrix touchMatrix) { super(chart); this.mMatrix = touchMatrix; // this equals to about 9 pixels on a 5.5" FHD screen this.mDragTriggerDist = Utils.convertDpToPixel(3f); this.mMinScalePointerDistance = Utils.convertDpToPixel(3.5f); }
Example #11
Source File: RealmBaseActivity.java From Stayfit with Apache License 2.0 | 5 votes |
protected void setup(Chart<?> chart) { mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf"); // no description text chart.setDescription(""); chart.setNoDataTextDescription("You need to provide data for the chart."); // enable touch gestures chart.setTouchEnabled(true); if (chart instanceof BarLineChartBase) { BarLineChartBase mChart = (BarLineChartBase) chart; mChart.setDrawGridBackground(false); // enable scaling and dragging mChart.setDragEnabled(true); mChart.setScaleEnabled(true); // if disabled, scaling can be done on x- and y-axis separately mChart.setPinchZoom(false); YAxis leftAxis = mChart.getAxisLeft(); leftAxis.removeAllLimitLines(); // reset all limit lines to avoid overlapping lines leftAxis.setTypeface(mTf); leftAxis.setTextSize(8f); leftAxis.setTextColor(Color.DKGRAY); leftAxis.setValueFormatter(new PercentFormatter()); XAxis xAxis = mChart.getXAxis(); xAxis.setTypeface(mTf); xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); xAxis.setTextSize(8f); xAxis.setTextColor(Color.DKGRAY); mChart.getAxisRight().setEnabled(false); } }
Example #12
Source File: TestSuiteFragment.java From SQLite-Performance with The Unlicense | 5 votes |
private void setupXAxis(BarLineChartBase chart, IAxisValueFormatter formatter) { XAxis x = chart.getXAxis(); x.setGranularity(1.0f); x.setDrawGridLines(false); x.setPosition(XAxis.XAxisPosition.BOTTOM); x.setDrawAxisLine(false); x.setCenterAxisLabels(true); x.setAxisMinimum(2.0f); x.setAxisMaximum(5.0f); x.setValueFormatter(formatter); }
Example #13
Source File: TestSuiteFragment.java From SQLite-Performance with The Unlicense | 5 votes |
private void setupYAxes(BarLineChartBase chart) { YAxis y = chart.getAxisLeft(); y.setDrawZeroLine(true); y.setDrawLabels(false); y.setDrawGridLines(false); y.setDrawAxisLine(false); y.setAxisMinimum(0); y = chart.getAxisRight(); y.setDrawZeroLine(true); y.setDrawLabels(false); y.setDrawGridLines(false); y.setDrawAxisLine(false); y.setAxisMinimum(0); }
Example #14
Source File: TimeLineView.java From android-kline with Apache License 2.0 | 5 votes |
@Override public void onAxisChange(BarLineChartBase chart) { float lowestVisibleX = chart.getLowestVisibleX(); if (lowestVisibleX <= chart.getXAxis().getAxisMinimum()) return; int maxX = (int) chart.getHighestVisibleX(); int x = Math.min(maxX, mData.size() - 1); HisData hisData = mData.get(x < 0 ? 0 : x); setDescription(mChartVolume, "成交量 " + hisData.getVol()); }
Example #15
Source File: BarLineChartTouchListener.java From android-kline with Apache License 2.0 | 5 votes |
/** * Constructor with initialization parameters. * * @param chart instance of the chart * @param touchMatrix the touch-matrix of the chart * @param dragTriggerDistance the minimum movement distance that will be interpreted as a "drag" gesture in dp (3dp equals * to about 9 pixels on a 5.5" FHD screen) */ public BarLineChartTouchListener(BarLineChartBase<? extends BarLineScatterCandleBubbleData<? extends IBarLineScatterCandleBubbleDataSet<? extends Entry>>> chart, Matrix touchMatrix, float dragTriggerDistance) { super(chart); this.mMatrix = touchMatrix; this.mDragTriggerDist = Utils.convertDpToPixel(dragTriggerDistance); this.mMinScalePointerDistance = Utils.convertDpToPixel(3.5f); }
Example #16
Source File: BarLineChartTouchListener.java From StockChart-MPAndroidChart with MIT License | 5 votes |
/** * Constructor with initialization parameters. * * @param chart instance of the chart * @param touchMatrix the touch-matrix of the chart * @param dragTriggerDistance the minimum movement distance that will be interpreted as a "drag" gesture in dp (3dp equals * to about 9 pixels on a 5.5" FHD screen) */ public BarLineChartTouchListener(BarLineChartBase<? extends BarLineScatterCandleBubbleData<? extends IBarLineScatterCandleBubbleDataSet<? extends Entry>>> chart, Matrix touchMatrix, float dragTriggerDistance) { super(chart); this.mMatrix = touchMatrix; this.mDragTriggerDist = Utils.convertDpToPixel(dragTriggerDistance); this.mMinScalePointerDistance = Utils.convertDpToPixel(3.5f); }
Example #17
Source File: BarLineChartTouchListener.java From Ticket-Analysis with MIT License | 5 votes |
/** * Constructor with initialization parameters. * * @param chart instance of the chart * @param touchMatrix the touch-matrix of the chart * @param dragTriggerDistance the minimum movement distance that will be interpreted as a "drag" gesture in dp (3dp equals * to about 9 pixels on a 5.5" FHD screen) */ public BarLineChartTouchListener(BarLineChartBase<? extends BarLineScatterCandleBubbleData<? extends IBarLineScatterCandleBubbleDataSet<? extends Entry>>> chart, Matrix touchMatrix, float dragTriggerDistance) { super(chart); this.mMatrix = touchMatrix; this.mDragTriggerDist = Utils.convertDpToPixel(dragTriggerDistance); this.mMinScalePointerDistance = Utils.convertDpToPixel(3.5f); }
Example #18
Source File: GraphLayout.java From voice-pitch-analyzer with GNU Affero General Public License v3.0 | 4 votes |
/** * style a basic chart in app style * * @param chart chart object to be styled * @return styled chart object */ public static BarLineChartBase FormatChart(BarLineChartBase chart) { chart.getAxisLeft().setStartAtZero(false); chart.getAxisRight().setStartAtZero(false); // hide grid lines & borders chart.getAxisLeft().setDrawGridLines(false); chart.getAxisRight().setDrawGridLines(false); chart.getXAxis().setDrawGridLines(false); chart.getAxisLeft().setValueFormatter(new GraphValueFormatter()); chart.getAxisRight().setValueFormatter(new GraphValueFormatter()); chart.setDrawBorders(false); chart.setDescription(""); // disable all interactions except highlighting selection chart.setTouchEnabled(false); chart.setScaleEnabled(false); chart.setPinchZoom(false); chart.setDoubleTapToZoomEnabled(false); chart.setDrawGridBackground(false); chart.getData().setHighlightEnabled(true); chart.getAxisLeft().setAxisMaxValue(PitchCalculator.maxPitch.floatValue()); chart.getAxisRight().setAxisMaxValue(PitchCalculator.maxPitch.floatValue()); chart.getAxisRight().setAxisMinValue(PitchCalculator.minPitch.floatValue()); chart.getAxisLeft().setAxisMinValue(PitchCalculator.minPitch.floatValue()); chart.getAxisLeft().setValueFormatter(new GraphValueFormatter()); chart.getAxisRight().setValueFormatter(new GraphValueFormatter()); chart.setDrawBorders(false); // set min/max values etc. for axes chart.getAxisLeft().setAxisMinValue(PitchCalculator.minMalePitch.floatValue()); chart.getAxisRight().setAxisMinValue(PitchCalculator.minMalePitch.floatValue()); // chart.getAxisRight().setStartAtZero(false); chart.setHardwareAccelerationEnabled(true); // chart.getLegend().setEnabled(false); Legend legend = chart.getLegend(); legend.setPosition(Legend.LegendPosition.BELOW_CHART_CENTER); return chart; }
Example #19
Source File: BarLineChartBaseManager.java From react-native-mp-android-chart with MIT License | 4 votes |
@ReactProp(name = "scaleEnabled") public void setScaleEnabled(BarLineChartBase chart, boolean enabled) { chart.setScaleEnabled(enabled); }
Example #20
Source File: BarLineChartBaseManager.java From react-native-mp-android-chart with MIT License | 4 votes |
@ReactProp(name = "gridBackgroundColor") public void setGridBackgroundColor(BarLineChartBase chart, String color) { chart.setGridBackgroundColor(Color.parseColor(color)); }
Example #21
Source File: BarLineChartBaseManager.java From react-native-mp-android-chart with MIT License | 4 votes |
@ReactProp(name = "doubleTapToZoomEnabled") public void setDoubleTapToZoomEnabled(BarLineChartBase chart, boolean enabled) { chart.setDoubleTapToZoomEnabled(enabled); }
Example #22
Source File: BarLineChartBaseManager.java From react-native-mp-android-chart with MIT License | 4 votes |
@ReactProp(name = "pinchZoom") public void setPinchZoom(BarLineChartBase chart, boolean enabled) { chart.setPinchZoom(enabled); }
Example #23
Source File: BarLineChartBaseManager.java From react-native-mp-android-chart with MIT License | 4 votes |
@ReactProp(name = "drawBorders") public void setDrawBorders(BarLineChartBase chart, boolean enabled) { chart.setDrawBorders(enabled); }
Example #24
Source File: BarLineChartBaseManager.java From react-native-mp-android-chart with MIT License | 4 votes |
@ReactProp(name = "scaleYEnabled") public void setScaleYEnabled(BarLineChartBase chart, boolean enabled) { chart.setScaleYEnabled(enabled); }
Example #25
Source File: BarLineChartBaseManager.java From react-native-mp-android-chart with MIT License | 4 votes |
@ReactProp(name = "borderColor") public void setBorderColor(BarLineChartBase chart, String color) { chart.setBorderColor(Color.parseColor(color)); }
Example #26
Source File: BarLineChartBaseManager.java From react-native-mp-android-chart with MIT License | 4 votes |
@ReactProp(name = "borderWidth") public void setBorderWidth(BarLineChartBase chart, float width) { chart.setBorderWidth(width); }
Example #27
Source File: BarLineChartBaseManager.java From react-native-mp-android-chart with MIT License | 4 votes |
@ReactProp(name = "scaleXEnabled") public void setScaleXEnabled(BarLineChartBase chart, boolean enabled) { chart.setScaleXEnabled(enabled); }
Example #28
Source File: BarLineChartBaseManager.java From react-native-mp-android-chart with MIT License | 4 votes |
@ReactProp(name = "maxVisibleValueCount") public void setMaxVisibleValueCount(BarLineChartBase chart, int count) { chart.setMaxVisibleValueCount(count); }
Example #29
Source File: BarLineChartBaseManager.java From react-native-mp-android-chart with MIT License | 4 votes |
@ReactProp(name = "autoScaleMinMaxEnabled") public void setAutoScaleMinMaxEnabled(BarLineChartBase chart, boolean enabled) { chart.setAutoScaleMinMaxEnabled(enabled); }
Example #30
Source File: BarLineChartBaseManager.java From react-native-mp-android-chart with MIT License | 4 votes |
@ReactProp(name = "keepPositionOnRotation") public void setKeepPositionOnRotation(BarLineChartBase chart, boolean enabled) { chart.setKeepPositionOnRotation(enabled); }