mpandroidchart

MPAndroidChart BarChart xValues Issue

孤街醉人 提交于 2019-12-10 16:43:41
问题 I noticed an issue with the BarChart of MPAndroidChart and need a fix. First my code: this.barChart = (BarChart) view.findViewById(R.id.bar_fragment_bar_chart); this.barChart.setDrawYValues(true); this.barChart.setDrawXLabels(false); this.barChart.setDrawValueAboveBar(true); this.barChart.setDrawBorder(false); this.barChart.setDrawGridBackground(false); this.barChart.setDrawHorizontalGrid(true); this.barChart.setDrawVerticalGrid(false); this.barChart.setDrawBarShadow(false); this.barChart

MPAndroidChart - Remove top border / axis since v2

﹥>﹥吖頭↗ 提交于 2019-12-10 14:58:18
问题 I upgraded MPAndroidChart from v1.7 to v2 and had to change a couple things. One of the new things is that i now appear to have a top border for the maximum value. My code trying to hide all borders is like this: LineChart graph = (LineChart) connectionView.findViewById(R.id.graph); graph.setDrawGridBackground(false); graph.setDrawBorders(false); graph.setDescription(""); YAxis yr = graph.getAxisRight(); yr.setEnabled(false); yr.setDrawAxisLine(false); YAxis yl = graph.getAxisLeft(); yl

MPAndroidChart bar chart how to change color of each label

不羁岁月 提交于 2019-12-10 14:36:26
问题 This is a bar chart that i build using MPAndroidChart library. Now I have to change the color of each label and I can't find the solution through searching over the internet. Can any one please help me to get through this problem. 回答1: There are two parts to this answer. 1) If you want to have a singular label in your legend for your barchart, you would add all of your bars into one dataset and use the method setColors(int[] colors, android.content.Context c) to assign a color to each bar. 2)

MP Android Chart-How to fix the number of X-Axis values in the Line Chart?

浪尽此生 提交于 2019-12-10 14:27:34
问题 private void plotchart(String s[], float[] f1) { chart.setBackgroundColor(Color.rgb(63, 81, 181)); chart.setDescription(""); // enable touch gestures chart.setTouchEnabled(true); chart.setScaleEnabled(false); chart.setPinchZoom(false); chart.setGridBackgroundColor(Color.rgb(30, 46, 141)); chart.setDrawGridBackground(false); chart.getAxisRight().setEnabled(false); chart.setDrawMarkerViews(true); chart.setDragEnabled(true); chart.setViewPortOffsets(0f, 0f, 0f, 0f); // chart

how to set values for xlabels and ylabels in mpandroidchart

旧时模样 提交于 2019-12-10 11:15:43
问题 I am using mpandroidchart android library. I am implementing line charts. Here can i set the x and y labels on my own? currently it is adding the values based on the dataset provided to the chart. Can you please give some idea on this? 回答1: You have to use a formatter on your axis object. There is two kind of formatter XAxisValueFormatter and YAxisValueFormatter. This the code i used to change the X label number with suffix "h" for hours : //get reference on chart line view LineChart chart =

MPAndroidChart Bar Chart - how to group bars with random x-axis intervals in between groups?

断了今生、忘了曾经 提交于 2019-12-10 10:08:37
问题 I want to make a bar chart with 3 different datasets grouped together at each data point like so: However, I am unable to group the bars together using the library's provided groupBars method because no matter what x-value I set for an entry, it groups the bars according to the interval I specify in its parameters. For example, if I generate a dataset with entry x-values {0, 5, 13, 17...50} and call `groupBars', all of my entries are gathered 1 x-value apart like so: What I want is the bars

MPAndroidChart PieChart how to change the center text to display the different color and font size

不想你离开。 提交于 2019-12-09 23:49:07
问题 Currently I use the MPAndroidChart from GITHUB and draw the piechart to display the two line text, each line has different color and different font size,I check the source codes and the center text is a string object, and try to use: PAINT paint = pie_chart.getPaint(Chart.PAINT_CENTER_TEXT); but looks like not work, would someone has the experience to do it and guide me about it. 回答1: after study the source codes, i change the PieChartRenderer.java to change the mCenterTextPaint.setColor

How to solve draw gradient below line - PhilJay/MPAndroidChart/issues/104?

China☆狼群 提交于 2019-12-08 17:45:16
问题 github link I would like a gradient and, if possible, choose components colors and orientation. is this issues solved? 回答1: i found it's answer LineDataSet set1 = new LineDataSet(values, "DataSet 1"); Drawable drawable = ContextCompat.getDrawable(this, R.drawable.fade_red); set1.setFillDrawable(drawable); fade_red.xml <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:angle="90" android:startColor="#00ffffff" android

Scrollable BarChart with possibility to touch each bar using MpAndroidChart?

↘锁芯ラ 提交于 2019-12-08 17:06:21
问题 I'm trying to create a chart in my app using MPAndroidChart. My aim is to get a graph looking like this one: But with some specific features. The graph will be wider than the screen's width so it must have a minimum width and be scrollable ( for the width I'm using this workaround, but its not scrollable ): chart.getLayoutParams().width=100*entries.size(); I would like to have the same kind of speech bubble on click on a bar ( I don't know if there is a way to have it and the scroll in the

how to change Bar color in MPandroidCharts based on some individual value stored in sqlite?

浪子不回头ぞ 提交于 2019-12-08 10:34:16
问题 If have an SQLite which stores 3 values names,credits,bunks. I have an mpandroid bar chart with x-axis:names,y-axis:bunks. I want to change the individual bar color or add limitline based on their credits for each entry,stored in SQLite. Is this possible? I am new to this please help me out. public class Myhelper extends SQLiteOpenHelper { public static final String DATABASE_NAME="mydatabase.db"; public static final String TABLE_NAME="mytable"; public static final String COLUMN_ID="_id";