MpAndroid chart Android - How to remove horizontal highlight Indicator - android

I am using MpAndroid for chart in Android.
When I touch any point in chart two line are drawn on chart(Vertical and Horizontal highlight Indicators).
1 line parallel to X axis(Horizontal Indicator) and another parallel to Y Axis(Vertical Indicator).
I want to show only Vertical Indicator.
How can I do it.

there is a method for a DataSet (e.g. CandleDataSet)
candleDataSet.setDrawHorizontalHighlightIndicator(false);

Related

Android MP Chart library get X-axis height

Let's say I have an Activity containing a ChartView (blue rectangle)
Now, I want to place another View on top of it that will stretch from the X-axis all the way to the top of ChartView.
I tried to do that by setting the margin-bottom equal to the height of the X-axis (red area), but I don't know how to get its height
How can I achieve this effect? Is there a way to get X-axis height in Android MP Chart? Or maybe there is a walkaround that will have a similar result?
Desirable outcome (the gray area is a view placed on top of the chart):
chart.getXAxis().mLabelHeight returns the height of x-Axis by pixel.
You can get it after OnGlobalLayoutListener, because it is calculated after x-Axis is drawn.
----------Updated Jun 22nd
another way is to use "getHeight() - mViewPortHandler.contentBottom()", but mViewPortHandler is protected, so an extended chart is necessary to provide access to mViewPortHandler

Ho to set MPAndroid piechart no lable

I'v used MPAndroid PieChart and want to show only percent values without labels. When I remove labels then colored guide below of chart also is without label. How to remove labels from pichart without removing guide labels?
set setDrawLabels(false) for the axis.
setDrawLabels(boolean enabled): Set this to true to enable drawing the labels of the axis.

MPAndroidChart - Horizontal bar chart - Justify label text to the left

I'm using MPAndroidChart to create a horizontal bar graph.
Is it possible to justify the label text from the left as opposed to the right?
Code:
mChart.getXAxis().setValueFormatter(new LabelValueFormatter(set1));
mChart.getXAxis().setPosition(XAxis.XAxisPosition.BOTTOM_INSIDE);
mChart.getXAxis().setXOffset(100);
Setting the axis position to the TOP and reversing the offset worked:
mChart.getXAxis().setValueFormatter(new LabelValueFormatter(set1));
mChart.getXAxis().setPosition(XAxis.XAxisPosition.TOP);
mChart.getXAxis().setXOffset(-350);
you can set to draw the values above the bars by:
mChart.setDrawValueAboveBar(true);
the result is like this image.

multiple Bars and lines in achartengine

I want to combine 3 bar series and 3 line series in one chart using achartengine.
When I specify the type of chart as BarChart and give it 3 series, things work right. The bars widths are what I set and the spacing and colouring is correct:
(see image here: http://i42.tinypic.com/ifu1ap.jpg)
But when I specify the chart type as
mChart = ChartFactory.getCombinedXYChartView(getView().getContext(), mDataset, mRenderer, new String[] {BarChart.TYPE, BarChart.TYPE, BarChart.TYPE, LineChart.TYPE, LineChart.TYPE,LineChart.TYPE });
the bars display on top of each other and the widths aren't right:
(see image here: http://i43.tinypic.com/2vum2xv.jpg)
Neither XYMultipleSeriesRenderer.setBarWidth() nor XYSeriesRenderer.setLineWidth() works for the bar widths.
I thought that if I added the XYSeries x values with an offset that I could fix the overlapping bars issue but then the widths of the bars are still not what I set it to be.
Does anyone know (the right way) how to make a chart that shows multiple bar and line series in one chart?
You are correct about using an offset to render the bars such as they don't overlap.
However, for spacing them, you need to use renderer.setBarSpacing(2); which means that the space between 2 items in the same series is equal to two times width of one bar.

Android - How can align the labels' text with their axis?

I'm using achartengine. I don't know how to align the labels' text with their axis. On some screens, the text is centered with the axis; on other screens, they're on the bottom or on the top of the axis.
Is there a way to globally put them in the center of the axis?
I think you can use the following:
mRenderer.setYLabelsAlign(Align.LEFT, 0)
If you want to set the alignment on the right side of the grid, just set Align.LEFT, which means they are align on the left.
Reading these two threads might clear it more: Android AChartEngine - Unable to change textColor of Y-Axis Labels and AChartEngine : Align Y-Axis Labels on right side of Axis itself
Hope it helps.

Categories

Resources