RangeBar chart useful for displaying weather chart
TL;DR
- Need a chart to show the range?
- Use the RangeBarChart library. You can draw any chart you want.
- There were no charts in MPAndroidChart to show ranges., so I made it myself.
If you need to show chart in android,
What’s the first thing that p
Most Android developers are probably thinking of and using the MPAndroidChart library.
MPAndroidChart provides a variety of charts such as LineChart /BarChart / PieChart / CandleStickChart to show.
I’ve always used this library whenever I need to show charts.
But…
There was one thing missing from this really perfect MPAndroidChart…
It was that there was no chart that I could use when I wanted to show a chart showing the range.
For example, there are cases where charts need to be displayed with the following UI requirements.
Like the weather,
When you want to show a chart that shows a range based on the maximum and minimum values for a specific period,
you want to create a chart with the concept of a RangeBar.
Is it really not on the MPAndroidChart?
Yes, really not.
There are similar charts.
This is the CandleStick chart that I saw a lot when displaying stock/coin charts.
CandleStick has 4 concepts: start value, end value, minimum value, and maximum value.
So to forcefully create a range value
- start value = minimum value
- end value = maximum value
We had to create and express a long RangeBar in the form of a bar by arbitrarily manipulating data.
But that’s not the purpose of CandleStick either.
Even if you want to draw a label that expresses the value, the CandleStick chart is implemented to display only the end value (last value) as a label as it is used as a stock chart.
The RangeBar chart we want is to display both the minimum and maximum labels.
So I prepared.
It was frustrating, so I made it.
This is a RangeBarChart that can be used when you want to draw a RangeBar chart that shows the minimum/maximum values according to time distribution, such as weather.
- RangeBarChart is a library implemented by inheriting MPAndroidChart.
- Because BarChart is inherited and used, all functions used in BarChart can be used in the same way.
- If you have been using MPAndroidChart before, you can use RangeBarchart with the same pattern.
For detailed descriptions, examples, and usage of the library, please check the relevant url.
When using the library, there are cases where the function I want is not available.
- In that case, create a new function in the library and create PR
- Create and share a library that implements the necessary functions yourself
What I need is a feature that someone else needs.
Android developers who are struggling to implement the UI,
Always happy coding.
thank you peace!