mpandroidchart

Duplicate x-axis value in MPAndroidchart library

孤人 提交于 2019-12-25 07:14:08
问题 //map: {2-6-2016=[120.0], 27-5-2016=[100.0], 1-6-2016=[78.0, 59.0]} LineChart lineChart = (LineChart) findViewById(R.id.chart); ArrayList<Entry> graphYValues = new ArrayList<>(); ArrayList<String> xLabels = new ArrayList<String>(); for (Map.Entry<String, List<Float>> mapKeySet : map.entrySet()) { List<Float> lsValue = mapKeySet.getValue(); for (float v : lsValue) { graphYValues.add(new Entry(v, i));//value ,index xLabels.add(mapKeySet.getKey());//if same label -x-axis have multiple y-axis

How to remove decimal places from project using Mikephil pie chart

冷暖自知 提交于 2019-12-25 05:18:07
问题 Here is static value of integer private int upload=14, bill=15, unbill=85, total=100, unupload=12, sign=10, unsign=90, print=12, unprint=88; Set entry of pie chart ArrayList<Entry> entries = new ArrayList<>(); entries.add(new Entry(bill, 0)); entries.add(new Entry(unbill, 1)); entries.add(new Entry(print, 2)); entries.add(new Entry(unprint, 3)); entries.add(new Entry(sign, 4)); entries.add(new Entry(unsign, 5)); entries.add(new Entry(upload, 6)); entries.add(new Entry(unupload, 7)); int

MPAndroidChart: negative values in pie chart or custom labels

断了今生、忘了曾经 提交于 2019-12-25 04:33:26
问题 In my Android application I have to show my income and expense amounts in a piechart. The expense amounts will be negative. The amounts are of type float . So is it possible to display both negative and positive values in a pie chart using MPAndroidChart library? I have tried with some negative and positive integer values and the result is horible. The pie-chart will behave crazy like a rummy board or illumination screen. If I can't have negative values in a pie chart, is it possible to show

manage text in some Situation PieChart of MPAndroidChart

眉间皱痕 提交于 2019-12-25 03:12:09
问题 I try to manage text in PieChart of MPAndroidChart. But when my text is difficult situation like True = 2, False = 3 , Not = 95, in this situation my pie chart layout is very bad. Here is my code :- fun setupPieChartView() { mPie = findViewById(R.id.piechart) mPie?.setUsePercentValues(true) val desc: Description = Description() desc.text = "PieChart" mPie?.description = desc val legend: Legend? = mPie?.legend legend?.horizontalAlignment = Legend.LegendHorizontalAlignment.LEFT val value =

Is it possible to show a chart by using MpAndroid from web server api?

☆樱花仙子☆ 提交于 2019-12-25 01:33:41
问题 I am newbie android developer and i have a list of different currency items and I should open a new screen with chart of clicked item. when user clicks on a list item a new screen should be opened which shows the exchange rate chart of the selected currency for the last 7 days based on USD. I should request every time the currency data gets updated for the last 7 days. Example request for getting currency history in a given period between USD and CAD: https://api.exchangeratesapi.io/history

Charting - Set the Graph GridLines Fixed

元气小坏坏 提交于 2019-12-24 23:19:55
问题 val set1: LineDataSet set1 = LineDataSet(values, "Player Form Graph") set1.color = Color.GREEN set1.setCircleColor(Color.GREEN) set1.lineWidth = 3f set1.circleRadius = 6f set1.circleHoleRadius = 3f set1.setDrawCircleHole(true) set1.disableDashedLine() set1.valueTextSize = 16f set1.setDrawFilled(true) set1.fillColor = Color.DKGRAY set1.formLineWidth = 6f set1.formLineDashEffect = DashPathEffect(floatArrayOf(10f, 5f), 0f) set1.formSize = 16f setUpGraph Function: private fun setUpGraph() {

How to set different colour for each staked value of StackedBarChart

六月ゝ 毕业季﹏ 提交于 2019-12-24 18:52:19
问题 I am using MPAndroidChart library and my requirement is to show stack value in stack color as given in picture and also not above the bar but left and right for the alternate stack. I have tried like this way but it didn't work set.setValueTextColors(colorList); It's giving one color for one complete bar. 回答1: I used a custom renderer to fix the issue Here is the code Chart creation protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R

MPandroidchart some dot's color doesn't change

寵の児 提交于 2019-12-24 18:23:21
问题 I'm making scatter chart that if value over specific value, the dot's color is changed. I wrote codes like these. for (int i = 0; i < 30; i++) { float y = (float) (Math.random()*0.2+0.1); value1.add(new Entry(i, y)); if(y>=0.2f) { colors.add(getBaseContext().getResources().getColor(R.color.color_red)); } else colors.add(getBaseContext().getResources().getColor(R.color.color_skyblue)); } } And the result is below. As you can see, there is a line. Upper side's color should be red, lower side's

MPAndroidChart -Use multiple text instead of “No Chart Data available” depends on the data

别等时光非礼了梦想. 提交于 2019-12-24 15:24:55
问题 I tried to change MPAndroid Chart text of "No Chart Data available" into "Loading Data..." while the data is retrieving.I had done this.But when there is no data the chart layout should shows ," NO DATA". I am getting the Same Text(Loading Data...) eventhough there is no data. protected void onDraw(Canvas canvas) { if (!mDataNotSet && mData==null) { canvas.drawText("NO DATA", getWidth() / 2, getHeight() / 3, mInfoPaint); return; } if (mDataNotSet && mData == null || mData.getYValCount() <= 0)

MPAndroidChart - Button click in MarkerView

≡放荡痞女 提交于 2019-12-24 13:22:53
问题 Currently I have a Button in a layout, however an assigned OnClickListener never calls back to the onClick method. Is it possible to intercept the click of a Button in a layout assigned to a MarkerView? 回答1: Using the library it appears not to be possible, however a solution of sorts is to show a View or ViewGroup over the chart which has a Button in it. You’ll need to set up an empty layout for the MarkerView and wrap your Chart in a ViewGroup such as a RelativeLayout. Define a listener such