mpandroidchart

How to add x axis as datetime label in MPAndroidChart?

ε祈祈猫儿з 提交于 2021-02-07 14:14:06
问题 I implemented line chart (MPAndroidChart library) for temperature report in my project.In X axis datetime should be plotted and Y axis temperature should be plotted. I just added datetime as string in X axis label but it's collapsed. So please anyone guide me. 回答1: Try the following. To set the X Axis XAxis xAxis = mChart.getXAxis(); xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); xAxis.setValueFormatter(new MyXAxisValueFormatter()); xAxis.setLabelsToSkip(0); Create a new class

【iOS】图表实现-Charts(一)

回眸只為那壹抹淺笑 提交于 2021-02-03 09:30:38
前几天把AAChartsKit的使用简单写了写,官方使用说明已经写的很详细了。我也就不多说了,今天就讲讲Charts的使用。 0.简介 近期项目需要使用到折线图这样的图表功能,因此接触到了Charts这个框架,不得不说这个图表框架很强大,但是在GitHub上 Charts 的介绍也比较简单的介绍(直说了和MPAndroidChart类似,大部分使用方法一致),就写写自己的一点心得供大家参考。 Charts使用swift编写,它是仿照 MPAndroidChart 实现的。所以在安卓和iOS上可以实现一致的效果。如果你们的APP想在两端实现统一的效果,就可以使用这个图标库。 废话不多说了。开始讲解使用方法吧。 1.导入三方库 charts支持cocoapods导入,这就对大多数开发者比较方便了。但是就是使用cocoapdos也需要注意些地方。 由于charts使用swift编写,在swift编写的项目中使用比较方便,在这篇文章中就不详细描述了。但是现如今还是有很多项目使用oc编写,就如我的这个项目。这就需要了解一些oc和swift的桥接了。这就需要看别的文章了。回归正题,开始讲cocoapdos的导入吧。 (1)podfile的设置 (2)将工程中Pods的编译语言设置为SWIFT最新版本 build Settings ->Swift Language Version 改为最新版本

MPAndroidChart x date value duplication problem

只愿长相守 提交于 2021-01-29 16:57:55
问题 I am implementing the function to display the change of exercise time by date as a graph. But there was a problem. Before I explain the problem, I will briefly explain my code. When a date is input from the user, the date is stored in the database and output by date. For example, when the user enters 2020/06/26, it is displayed as 06/26 on the graph. Now I will explain the problem. The x value of the graph is overlapping. 07/01 does not appear immediately after 06/30, but very far. I will

MPAndroidchart two Axes overlapping

与世无争的帅哥 提交于 2021-01-29 16:01:03
问题 I have a chart with two datasets displayed on both yAxes. However these datasets overlap each other. Is there a way to display them like a grouped chart side by side over one label If i use chart.groupBars(0f, 0.8f, 0.1f) the chart gets cut off because the bar width does not scale correctly. 回答1: OK After a bit more digging around and reading the docs more carefully i found the answer. The sum of your barWidth, barSpace and groupSpace have to be zero, eg in my case with two bars per group:

How to set color for values in MPAndroidChart?

放肆的年华 提交于 2021-01-29 02:48:45
问题 I am using MPAndroidChart. Searched through the documentation but couldn't find anything that implemented correctly. I have a graph at the moment but I want to change the color of the line if it goes over a certain amount. Graph Example In the example I have linked, it shows a line drawn through the values from 10. I would like this line (the one going through the chart) and the color of the line in the chart to change color over 10. Is this possible? Using MPAndroidChart. I have one dataset

How to set color for values in MPAndroidChart?

一个人想着一个人 提交于 2021-01-29 02:46:52
问题 I am using MPAndroidChart. Searched through the documentation but couldn't find anything that implemented correctly. I have a graph at the moment but I want to change the color of the line if it goes over a certain amount. Graph Example In the example I have linked, it shows a line drawn through the values from 10. I would like this line (the one going through the chart) and the color of the line in the chart to change color over 10. Is this possible? Using MPAndroidChart. I have one dataset

iOS-Charts X Axis values are repeating indefinitely when setVisibleXRangeMaximum is set

折月煮酒 提交于 2021-01-28 08:24:04
问题 I am trying to draw a chart where the x-axis is TimeInterval and Y-axis is power consumption . There will be too much data to show as for each day there will be data. For that reason, I want to show 5 x values at a time. I achieved that by setting self.chart.setVisibleXRangeMaximum(5) after setting data for the chart. Though 5 x-axis values are showing but the values are repeating for an indefinite time. Like if the first day is 10/10/2016 all the x-axis values after that are the same for

MPAndroidChart - How to change the color of PieChart center Background?

三世轮回 提交于 2021-01-27 07:09:47
问题 Im trying to use the MPAndroidChart library to develop a circular chart. But only Pie chart is available. So i tried giving two xvalue coordinates, with one color similar to background. So i got something similar to circular chart. But i'm not able to change the background color and font color of center text inside the pie chart? Thanks! 回答1: There are two possible solutions: Retrieve the Paint object used by the chart to draw the "center-hole" and modify it the way you want Paint p1 = mChart

How to set diffent style to single line graph in MPAndroidChart?

强颜欢笑 提交于 2021-01-22 08:46:36
问题 Hello am using MPAndroiChart for my Android App I stuck with a requirement where I have to draw a line chart(a single line) with different style. Some part of the line is straight and some part is dotted. Something like this ________...........__________________...______ Is it possible to do in MPAndroidChart? 回答1: Yes, call lineDataSet.enableDashedLine(...) Documentation: https://github.com/PhilJay/MPAndroidChart/wiki/DataSet-classes-in-detail 来源: https://stackoverflow.com/questions/33011210

How to continuously update Y-axis values in MPAndroidChart

帅比萌擦擦* 提交于 2021-01-22 08:36:53
问题 I want my axis in LineChart to adjust it's maximum and minimum values real-time. Functions like resetAxisMaxValue() and resetAxisMinValue() work well when new data's Y-value is increasing(both positive and negative), however, once the signal gets low again Y-value max and min never drops to the smaller values so it can show all new data on the full canvas of the graph. I wanted to check whether there is method to do so automatically, or whether I should use brute force. Thank you. 回答1: Alex's