Compare commits

...

1712 commits

Author SHA1 Message Date
yoksnod
a6c3808fd5
Merge pull request #2 from yoksnod/marker-interface-improvements
Added jitpack integration
2020-02-12 14:54:18 +03:00
Dmitry Donskoy
941579e10f Added jitpack integration 2020-02-12 14:53:16 +03:00
yoksnod
21c811ff9a
Merge pull request #1 from yoksnod/marker-interface-improvements
Modified and expanded, made more flexible  marker interaction interface
2020-02-12 14:49:13 +03:00
Dmitry Donskoy
f3a2ec21c9 Modified and expanded, made more flexible marker interaction interface 2020-02-12 14:47:18 +03:00
Daniel Cohen Gindi
9347dd1af7
Merge pull request #4802 from oatrice/fix_crash_solid_color_barchart
fix NPE when use solid color with barchart
2020-02-09 07:34:02 +02:00
Anirut Teerabut
90e523042c
Update BarChartRenderer.java 2020-02-07 22:09:57 +07:00
Anirut Teerabut
33240f9225
Update HorizontalBarChartRenderer.java 2020-02-07 22:09:07 +07:00
Anirut Teerabut
4b67673da9
Update BarChartRenderer.java 2020-02-07 22:03:20 +07:00
Anirut Teerabut
cef967fd71 fix NPE when use solid color with barchart 2020-02-07 17:53:40 +07:00
Daniel Cohen Gindi
eae977306e Merge branch 'fill'
* fill:
  Implement a more generic Fill class instead of GradientColor
2020-01-24 12:53:07 +02:00
Daniel Cohen Gindi
c0e7f56b5d Implement a more generic Fill class instead of GradientColor
Support HorizontalBarChart too.
2020-01-24 12:52:27 +02:00
Daniel Cohen Gindi
351e341ee7 Fixed merge residue 2020-01-24 11:42:03 +02:00
Daniel Cohen Gindi
f05337768d Finalized vertical line collision check 2020-01-23 15:45:57 +02:00
Daniel Cohen Gindi
f8d068d377
Merge pull request #4787 from danielgindi/feature/catching_up_to_ios
Feature/catching up to ios
2020-01-23 15:38:53 +02:00
Daniel Cohen Gindi
5e4a32eb41 Corrected check for line in vertical bounds
https://github.com/danielgindi/Charts/pull/4100
2020-01-23 12:09:06 +02:00
Daniel Cohen Gindi
1de836ac65 Remove unexpected dash line during linear animation
https://github.com/danielgindi/Charts/pull/4094
2020-01-23 11:19:07 +02:00
Daniel Cohen Gindi
0668d30a6b Fixed a bug where a pie slice without highlight enabled is hidden
https://github.com/danielgindi/Charts/pull/3969
2020-01-23 10:54:28 +02:00
Daniel Cohen Gindi
34fefd28e1 maxHeight didn't account for the last label
https://github.com/danielgindi/Charts/pull/3900
2020-01-23 10:18:28 +02:00
Daniel Cohen Gindi
45240c3723 Improved negative offset for horz bar chart
https://github.com/danielgindi/Charts/pull/3854
2020-01-22 16:01:42 +02:00
Daniel Cohen Gindi
14456f475f Renamed values -> entries for consistency
https://github.com/danielgindi/Charts/pull/3847
2020-01-22 14:24:37 +02:00
Daniel Cohen Gindi
e02e9be2fa Multiple colors for valueline
https://github.com/danielgindi/Charts/pull/3709
2020-01-22 14:13:31 +02:00
Daniel Cohen Gindi
fcc5af71ce Call onChartScale listener after double-tap-zoom
https://github.com/danielgindi/Charts/pull/3770
2020-01-22 13:49:10 +02:00
Daniel Cohen Gindi
13aee592b1 Improve min/max calculation
https://github.com/danielgindi/Charts/pull/3650
2020-01-22 13:43:42 +02:00
Daniel Cohen Gindi
c97c8d247f Fixed index out of bounds issue when using stacked bar chart
b03cf16ec4
2020-01-22 13:23:12 +02:00
Daniel Cohen Gindi
ae59e7a19e This is for the inline bubble selection
https://github.com/danielgindi/Charts/pull/3548
2020-01-22 13:12:04 +02:00
Daniel Cohen Gindi
7752efef7e Support for labelXOffset for YAxis label 2020-01-22 13:04:11 +02:00
Daniel Cohen Gindi
58545bbbfa Add option to disable clipping data to contentRect
https://github.com/danielgindi/Charts/pull/3360
2020-01-22 12:46:37 +02:00
Daniel Cohen Gindi
4ce14e6cc9 Add a warning message if pie chart has more than one data set
https://github.com/danielgindi/Charts/pull/3286
2020-01-22 12:42:32 +02:00
Daniel Cohen Gindi
8df9eda7af Call notifyDataChanged for an opportunity for subclasses 2020-01-22 12:39:03 +02:00
Daniel Cohen Gindi
34c3ceaa05 Reset min/max when clearing ChartDataSet
https://github.com/danielgindi/Charts/pull/3265
2020-01-22 12:29:47 +02:00
Daniel Cohen Gindi
ea816e8d6d Added dataIndex param for highlightValue (combined charts)
https://github.com/danielgindi/Charts/pull/2852
2020-01-22 12:25:34 +02:00
Daniel Cohen Gindi
bafb0fbbe4 Use correct color index for bubble chart
https://github.com/danielgindi/Charts/pull/3202
2020-01-22 12:16:48 +02:00
Daniel Cohen Gindi
4549ae17b7 Select correct axis for legend distance calculation in horz bar chart
https://github.com/danielgindi/Charts/pull/2214
2020-01-22 12:15:02 +02:00
Daniel Cohen Gindi
912427e543 Custom text alignment for no-data
https://github.com/danielgindi/Charts/pull/3199
2020-01-22 12:07:37 +02:00
Daniel Cohen Gindi
3f5475077e Avoid race condition for interval/intervalMagnitude
https://github.com/danielgindi/Charts/pull/2377
2020-01-22 11:59:43 +02:00
Daniel Cohen Gindi
2e725e49d3 Make min/max axis labels configurable
https://github.com/danielgindi/Charts/pull/2894
2020-01-22 11:54:08 +02:00
Daniel Cohen Gindi
a4ca1f3fba Fixed axis label disappearing when zooming in
https://github.com/danielgindi/Charts/pull/3132
2020-01-22 11:47:45 +02:00
Daniel Cohen Gindi
634a690d6a Added an implementation of Douglas Peucker with resultCount input
https://github.com/danielgindi/Charts/pull/2848
2020-01-22 11:44:27 +02:00
Daniel Cohen Gindi
1987d7eb64 Consider axis dependency in Combined chart
https://github.com/danielgindi/Charts/pull/2874
2020-01-22 11:04:57 +02:00
Daniel Cohen Gindi
6ebf3fa57a Added highlightColor parameter for pie charts
https://github.com/danielgindi/Charts/pull/2961
2020-01-22 10:27:55 +02:00
Daniel Cohen Gindi
95027fa6a7 Safe guards
These will be even more important when moving to Kotlin ranges
2020-01-22 09:55:00 +02:00
Philipp Jahoda
d86f39cc91
Update README.md 2020-01-20 11:15:12 +01:00
Philipp Jahoda
cb26ed4ef4
Update FUNDING.yml 2019-10-08 14:15:52 +02:00
Philipp Jahoda
dc59171524
Create FUNDING.yml 2019-10-08 14:15:21 +02:00
Philipp Jahoda
726616d079 Merge branch 'master' of github.com:PhilJay/MPAndroidChart 2019-04-27 17:38:41 +02:00
Philipp Jahoda
fffe9a297e Update gradle 2019-04-27 17:38:37 +02:00
Philipp Jahoda
2340e12800
Merge pull request #4512 from duchampdev/percent_formatter_sign_spacing
PercentFormatter: make space between number and percent sign optional
2019-04-27 17:37:13 +02:00
duchampdev
c5667d4f14 fix little typo 2019-04-27 16:06:37 +02:00
duchampdev
0563fb48b0 PercentFormatter: make space between number and percent sign optional 2019-04-27 16:06:10 +02:00
Philipp Jahoda
ed8876cef2
Update README.md 2019-04-07 16:37:14 +02:00
Philipp Jahoda
12b4351d0c
Update README.md 2019-04-07 16:27:59 +02:00
Philipp Jahoda
adb56e75bd
Update README.md 2019-04-07 16:20:14 +02:00
Philipp Jahoda
e95c1eb26a
Update README.md 2019-03-20 17:56:58 +01:00
Philipp Jahoda
0c2ac2d9cc New example app release 2019-03-16 11:53:42 +01:00
Philipp Jahoda
2058f7bf5d Minor changes to project and example 2019-03-16 11:42:04 +01:00
Philipp Jahoda
971640b29d
Update Support_help.md 2019-02-21 09:05:06 +01:00
Philipp Jahoda
7df8a4cedc
Update Feature_request.md 2019-02-21 09:04:40 +01:00
Philipp Jahoda
59028d3bf3
Update Bug_report.md 2019-02-21 09:04:28 +01:00
Philipp Jahoda
c886bb342a
Update README.md 2019-02-20 22:51:10 +01:00
almic
aea2ff3417
Add option to set minimum angles
Allows to force minimum slice angles when drawing charts, which means that any
slices with angles lower than the minimum will be drawn with the minimum angle.

When changing this setting on the fly, you have to call
`notifyDataSetChanged()` and `invalidate()` for the minimum angle to take
effect.

This only functions if all slices can be drawn with the minimum angle. For
example if a chart has 5 slices, the largest functioning minimum angle is
`72f` degrees on a 360 degree chart, or 20% of the chart's `maxAngle`.
2018-11-15 09:51:46 -07:00
almic
42cdba535f
Add Curved Slices to Pie Chart
Finally added support for rounded slices, and somewhat improved the code
for the PieChartRenderer class.
2018-11-12 10:59:48 -07:00
almic
29f4cc5c2c
Remove unnecessary API checks
Also added run configuration for the MPChartExample.
Removed deprecated Legend stuff.
2018-11-11 09:40:37 -07:00
almic
fc0e234298
Remove Deprecated Things
Long deprecated Legend constructor and positioning has been removed, it was
replaced with a new way to position the Legend.

The old Easing options have been removed now, accessing them is as easy as
removing the `EasingOption` part, such that the names look like
`Easing.Linear` or `Easing.EaseInOutQuad` now.
2018-11-07 14:52:25 -07:00
almic
e5b66192e7
New ValueFormatter
I created a simplified value formatter class, which is an abstract class rather
than an interface.

The switch was chosen because the new format has all the methods predefined
(something an interface wouldn't allow) meaning you can extend it and only
change what you want. This also means that you only need one value formatting
class for labels rather than two different classes, it just makes more sense.

Please check the method signatures to learn how to use them, I'm sure you'll
find this new format is much more customizable and faster to use.

I've made the class abstract even though there are no abstract methods or
fields, this is because it would certainly be a mistake to create a
ValueFormatter and not override any methods.

To convert existing code, just use 'extends' instead of 'implements' and change
the names to 'ValueFormatter'. You'll need to change the methods you overwrite
as well, just check the class and use the one you need.
2018-11-07 12:41:53 -07:00
Mick A
608d9e29f5
Fix link error 2018-10-30 08:59:58 -06:00
almic
9148f37f9e
Bump version to 3.1.0-alpha 2018-10-29 13:23:18 -06:00
Mick A
6ce99326ae
Merge pull request #2273 from vpop/update/unused-local
Remove unused local variable
2018-10-27 21:56:40 -06:00
Mick A
129ad15fd0
Merge pull request #2187 from vpop/update/redundant-nullcheck
Remove nullcheck for known non-null variable
2018-10-27 21:42:36 -06:00
almic
5030b36c86
More Cleanup
I've removed the realm examples, mainly because the library was buggy.
In the previous commit, I already removed the examples from the list
since they didn't add anything to the overall demonstration. I thought
that if anyone wants to use realm.io with the charts, they can see the
actual library.

The file structure has been updated to match how Android Studio does
things. Some files added way back when have been deleted as they don't
do anything but cause the linter to freak out about 'unused properties'

All 'build.gradle' files have been refreshed as well.

Small addition to the README file to add a quick way to reach sections
of the page.
2018-10-27 18:00:06 -06:00
almic
db7dda2b7e
More Linting
Lots of things in the example app are now marked with the 'final' modifier, and saveToGallery() is protected in classes that implement it. As well, new suppressions are in a few places.

NEW text is now removed completely. Looks like this has been unused for a long time and it's just stuck around anyway.
2018-10-27 14:02:04 -06:00
almic
d67ea481af
Huge Project Refresh
Before anyone freaks out, all these changes are under-the-hood, meaning that you probably won't even notice them at all.

The biggest difference is raising the minSdkVersion from 9 to 14. Recently android bumped this number interally as there are basically no devices running lower than 14 anymore. Sorry but you are just wasting your time if you are trying to support anything lower than 14 now.

The next biggest change is updating the project to the new AndroidX libraries, which changes some imports and nothing else really.

The third biggest change is fixing a few bugs in the code that cause values to be drawn even if there are none, which results in your app crashing. Surprisingly, these checks already existed in a few of the newer chart types, but most lacked this simple check.

Other than those three changes, nothing else is functionally different. Well, saving to gallery works on all charts in the example app now, and you can quickly see the code for each example in the menus.

The only real potential "breaking" change is that charts are now saved as PNGs by default instead of JPGs if you go the route of not specifying as a JPG. You may want to double check your file sizes as PNGs can be larger than low quality JPGs.

I still have more plans for simplifying the API and fixing other issues with the project, for the small few that closely pay attention to individual commits: there's going to be more soon.
2018-10-26 10:30:22 -06:00
Philipp Jahoda
20bca4a8ca
Update README.md 2018-08-26 20:31:44 +02:00
Philipp Jahoda
e2a9110d38
Update README.md 2018-08-26 20:31:00 +02:00
Philipp Jahoda
2316f8500f
Update README.md 2018-08-26 20:21:49 +02:00
Philipp Jahoda
6f0b7432ac
Update README.md 2018-08-26 20:21:19 +02:00
Philipp Jahoda
073ad3c877
Update README.md 2018-08-26 20:14:32 +02:00
Philipp Jahoda
c1f6fcebf0
Update README.md 2018-06-06 09:14:41 +02:00
Philipp Jahoda
b65ba08324
Update README.md 2018-05-15 15:57:09 +02:00
Mick A
fe7a0f8bc3
Merge pull request #4018 from RobertZagorski/feature/remove-redundant-findViewById-casts
[Enhancement] Remove redundant findViewById casts in example application
2018-05-12 21:28:06 -06:00
almic
536a35a6fd
docs(README): Update & simplify README
- Re-ordered some of the sections
- Simplified some sections
- Reformatted here and there
- Added a few emojis, how cute!

The goal of this change was to hopefully further reduce the amount of
issue support/ question spam. By moving the sections around to show the
more important parts higher up, like usage and documentation links, I
hope this will make it easier for people to find the documentation.
2018-05-10 11:03:03 -06:00
RobertZagorski
75dd04cc42 Remove redundant findViewById casts, that became obsolete after migration to API 26. 2018-05-10 08:01:03 +02:00
Mick A
1485cdc687
Merge pull request #3451 from davidgoli/add-grid-lines-on-top-of-data
Add option to draw limit lines on top of data
2018-05-09 09:12:49 -06:00
Mick A
53de181607
Merge pull request #3478 from MaximPestryakov/patch-1
Refactored LargeValueFormatter
2018-05-09 09:07:06 -06:00
Mick A
9ee3a74633
Merge pull request #4013 from RobertZagorski/bugfix/#2369-legend-offset-is-not-calculated-twice-for-line-chart
Remove mLabelRotatedHeight counted twice, when calculating legend offset
2018-05-09 08:36:07 -06:00
Mick A
73054bedc3
Merge pull request #3642 from pagrzybe/autoscale_restrictions
Option to set restrictions for Y axis autoscaling.
2018-05-09 08:29:22 -06:00
Maxim Pestryakov
5869c9de23
Fixed Javadoc 2018-05-09 16:03:48 +03:00
RobertZagorski
89436221db Remove mLabelRotatedHeight counted twice, when calculating legend offsets. (Fix for #2369).
Removed statements where completely not needed as calculating offsets is alredy done in BarLineCharBase#calculateOffsets(...)
2018-05-09 08:44:22 +02:00
Pawel Grzybek
92c14db5b4 Fixed code review comments. 2018-05-09 08:09:03 +02:00
Mick A
0b6632f2cb
Merge pull request #4008 from RobertZagorski/bugfix/#1604-update-and-reorganise--copy-data-sets-methods
Update and reorganise copy data sets methods (Fix for #1604).
2018-05-08 09:42:03 -06:00
RobertZagorski
7abc9cd669 Update and reorganise copy data sets methods (Fix for #1604).
Copying class properties is always done in protected copy method.
2018-05-08 16:19:09 +02:00
almic
9583a18b84
chore(template): Move templates to .github folder 2018-05-06 00:29:31 -06:00
almic
03c538fc34
docs(templates): Update Issue & PR templates
I've updated the issue and pull request templates, again. This time I
looked to the node.js request library for inspiration.

It's no secret that this project has been attracting a LOT of very
low-quality issues. Almost all are asking questions that can be easily
answered if the person looked at the example project or the wiki.

Specifically, the new Support_help.md file.

This file will hopefully bait these low-quality support questions and
reduce the number of opened issues regarding debugging or support
significantly.

I've updated the default ISSUE_TEMPLATE.md to be a copy of Bug_report.md
to force people to read that notice text if they decide to not choose
any of the templates.
2018-05-06 00:27:57 -06:00
Mick A
c08ec81fc0
Merge pull request #4001 from oatrice/feature/muti_gradient
[Feature] Multiple gradient color for barchart
2018-05-05 09:18:14 -06:00
Anirut Teerabut
e4ba3cdc20 - multiple gradient color 2018-05-04 04:21:26 +07:00
almic
689d484615
Delete lingering MyEasingFunction.java
I made the decision to remove this file instead of updating it, as I'm
sure most will instead prefer to look at the actual Easing class. If you
miss this example class... ¯\_(ツ)_/¯
2018-05-03 08:37:00 -06:00
Philipp Jahoda
9b9d2a68cb
Update README.md 2018-05-03 16:22:32 +02:00
Mick A
0378e763ae
Merge pull request #2856 from stephenmcbride/master
Fix for missing setters in getInstance method
2018-05-02 10:42:40 -06:00
Mick A
1ff676ecaf
Update CONTRIBUTING.md
Condensed CONTRIBUTING and added helpful reference links.

And cake!
2018-05-02 00:44:47 -06:00
Mick A
00e284c043
Update Bug_report.md
quick fix
2018-05-01 23:02:01 -06:00
Mick A
a7eb395b81
Downgrade ISSUE_TEMPLATE.md to generic issue 2018-05-01 22:59:06 -06:00
Mick A
11bf7aa812 Update issue templates 2018-05-01 22:57:40 -06:00
Mick A
89e50c8c9b
Merge pull request #3982 from almic/yaxis-calc
Remove YAxis Custom Min/Max Check for Padding
2018-05-01 21:29:15 -06:00
Mick A
640208c8ff
Merge pull request #3820 from longup/master
Fix last entry clipping bug #3819
2018-05-01 21:19:05 -06:00
Mick A
5519c5170d
fix(docs): Broken Contributing link 2018-04-30 17:42:35 -06:00
almic
35c9fc937e
refactor(EasingFunction): Simplified EasingFunction
EasingFunction has been simplified greatly, and I've added a MUCH needed
annotation to relevant methods.

Easing.EasingOptions has been deprecated, as well as any methods using
them. Converting is as simple as deleting the "EasingOptions" part.

A new signature is available for animateXY()!

You are now able to pass one EasingFunction to animateXY() if you want
both axes to be animated the same way.

Quietly included are some gradle build updates, incrementing the
appcompat version to 27.1.1, and using the new `javacompiler` to avoid
deprecation of `javacompile`
2018-04-30 12:24:18 -06:00
Mick A
89d18a7f67
Merge pull request #3207 from scottkennedy/weakref-fixes
Fix some potential NPEs with WeakReference usage
2018-04-30 08:15:48 -06:00
Mick A
6fbd492761
Create PULL_REQUEST_TEMPLATE.md 2018-04-29 09:58:33 -06:00
Mick A
7286f8703f
Create ISSUE_TEMPLATE.md 2018-04-29 09:48:01 -06:00
Mick A
9997a33524
Merge pull request #3975 from hannesa2/AndroidStudio3.1.2
update to Android Studio 3.1.2
2018-04-28 19:12:26 -06:00
Hannes Achleitner
d8ea67aa21 update to Android Studio 3.1.2 2018-04-28 19:54:22 +02:00
Mick A
40adb57f68
Merge pull request #3898 from sembozdemir/pie_chart_value_line_colors
PieChart: Add option for using slice color as value line color
2018-04-28 10:53:08 -06:00
Mick A
215e0dfc05
Merge pull request #3949 from WilderPereira/master
Rename RadarChartActivitry to RadarChartActivity
2018-04-28 10:37:07 -06:00
almic
e1411f169e
Remove Custom Check
calculate() no longer checks if min and max is custom, it just adds the padding.
2018-04-27 00:08:27 -06:00
Wilder Pereira
993a8554c0 Remove unused imports 2018-04-15 21:51:35 -03:00
Wilder Pereira
508cc565a9 Rename RadarChartActivitry to RadarChartActivity 2018-04-15 21:51:15 -03:00
sembozdemir
1e6e58d2c0 Add option for using slice color as value line color
Fixes: #3897
2018-03-28 20:23:51 +03:00
zhanglong
aee6058dbb Avoid that the last label entry in the x-labels clip off the edge of the screen #3819 2018-02-27 15:04:47 +08:00
Philipp Jahoda
3e1eb1445a
Delete googlee1205ea43aa2c32a.html 2018-02-24 12:51:49 +01:00
Philipp Jahoda
82668ebc34
Add files via upload 2018-02-24 12:50:04 +01:00
Philipp Jahoda
a5250888b9
Update README.md 2018-01-12 15:27:40 +01:00
Philipp Jahoda
297ce9f2cc
Update README.md 2018-01-12 14:07:02 +01:00
Philipp Jahoda
b3e2358334
Update README.md 2018-01-12 14:06:19 +01:00
Philipp Jahoda
8fd1a86b0a
Update README.md 2017-12-27 16:25:56 +01:00
Philipp Jahoda
6ccaf940d8
Update README.md 2017-12-27 16:24:45 +01:00
Philipp Jahoda
c50f03cf39
Update README.md 2017-12-25 20:09:46 +01:00
Philipp Jahoda
c867d7cb37
Update README.md 2017-12-25 20:06:18 +01:00
Philipp Jahoda
2c08b560d6
Update README.md 2017-12-25 20:05:18 +01:00
Philipp Jahoda
779e0f5665
Update README.md 2017-12-25 19:58:23 +01:00
Philipp Jahoda
8954409575
Update README.md 2017-12-20 14:03:05 +01:00
Philipp Jahoda
44125a87dd
Update README.md 2017-12-20 10:59:50 +01:00
Philipp Jahoda
4b7eb1fd04
Update README.md 2017-12-19 14:38:34 +01:00
Philipp Jahoda
21ad19661b
Update README.md 2017-12-19 14:19:30 +01:00
Philipp Jahoda
b06439f36d
Update README.md 2017-12-19 14:14:54 +01:00
Philipp Jahoda
62910171f1 Merge branch 'master' of github.com:PhilJay/MPAndroidChart 2017-12-14 19:37:16 +01:00
Philipp Jahoda
16a9be8ea0 Update gitignore, add assets 2017-12-14 19:37:09 +01:00
Pawel Grzybek
e416736ad5 Added option to set restrictions for Y axis autoscaling. 2017-12-10 20:19:06 +01:00
Philipp Jahoda
d9000987c7
Update README.md 2017-11-30 13:40:49 +01:00
Philipp Jahoda
1ac72ea811
Update README.md 2017-11-30 09:27:59 +01:00
Philipp Jahoda
41aff3f13d Merge 2017-11-29 16:07:13 +01:00
Philipp Jahoda
5e97f561f7 Update version 2017-11-29 16:06:58 +01:00
Philipp Jahoda
47485f8364
Update README.md 2017-11-29 16:03:11 +01:00
Philipp Jahoda
0868d9bf89 Add new google repo 2017-11-29 15:57:30 +01:00
Philipp Jahoda
23aef1a0ab Add new google repo 2017-11-29 15:55:18 +01:00
Philipp Jahoda
dfaffa39cc Add maven plugin to example 2017-11-29 15:48:42 +01:00
Philipp Jahoda
ed9340ea51 Update maven android plugin 2017-11-29 15:47:10 +01:00
Philipp Jahoda
796dfb21f8 Out comment gradle wrapper 2017-11-29 15:28:03 +01:00
Philipp Jahoda
f2dedb30de Update gradle and dependencies 2017-11-29 15:23:57 +01:00
Philipp Jahoda
a5a482fbdc
Update README.md 2017-11-28 10:50:37 +01:00
Maxim Pestryakov
d3c339da10 Refactored LargeValueFormatter 2017-10-06 17:12:46 +03:00
davidgoli
c97b8d531d add option to draw limit lines on top of data 2017-09-22 18:57:07 -07:00
Daniel Cohen Gindi
72031d33ca Allow locking drag on either axes 2017-09-08 11:00:45 +03:00
Daniel Cohen Gindi
ea93823f63 Fix CombinedChartView not drawing markers 2017-09-08 10:13:12 +03:00
Daniel Cohen Gindi
ed770762fb Add default x spacing (half width) for scatter chart as well 2017-08-25 12:15:42 +03:00
Daniel Cohen Gindi
98f97f0df1 Run view port jobs after applying changes 2017-08-25 12:13:45 +03:00
Philipp Jahoda
4f77a154bf Update README.md 2017-08-11 16:31:29 +02:00
Philipp Jahoda
ad3c82f634 Update README.md 2017-08-04 17:05:42 +02:00
Scott Kennedy
43ae497ecf Fix some potential NPEs with WeakReference usage
Even if the WeakReference field is not null, the contained value may be null.  Additionally, you always need a strong reference to the value to ensure it isn't garbage collected while you're using it.
2017-06-26 10:51:58 -07:00
Philipp Jahoda
695f481077 Merge pull request #3204 from PhilJay/add-license-1
Create LICENSE
2017-06-26 09:16:47 +02:00
Philipp Jahoda
fcb506c219 Create LICENSE 2017-06-26 09:16:23 +02:00
Daniel Cohen Gindi
acf985ff0c Clear lastHighlighted when clear is called 2017-04-26 20:45:12 +03:00
Philipp Jahoda
0af86819ea Update README.md 2017-04-04 10:29:38 +02:00
Philipp Jahoda
f6a398b6b2 Update README.md 2017-03-24 11:36:12 +01:00
Philipp Jahoda
208bf181ad Update README.md 2017-03-23 16:23:45 +01:00
PhilJay
557e55653b Remove line width minimum constraint 2017-03-23 16:15:16 +01:00
PhilJay
b564704b82 Updating versions 2017-03-23 16:13:21 +01:00
Philipp Jahoda
6df13dd66e Update README.md 2017-03-15 15:55:23 +01:00
Philipp Jahoda
2eb12901a9 Update README.md 2017-03-14 10:39:45 +01:00
Philipp Jahoda
993d273a52 Update README.md 2017-03-14 10:39:05 +01:00
Stephen McBride
6c54f0b0a9 Fix for missing setters in getInstance method
The zoomAndCenterAnimated method in BarLineChartBase crashes with a NullPointer exception because the yAxis variable is null when onAnimationUpdate is called. The yAxis is null because of missing setters in the getInstance method of AnimatedZoomJob.
2017-02-28 15:58:42 +13:00
Daniel Cohen Gindi
0c919ab02d Consider isEnabled in more axis rendering cases 2017-02-22 17:29:33 +02:00
Daniel Cohen Gindi
493e3d238d Merge pull request #2463 from maheshgaya/master
Fix: typo for October
2017-02-21 16:39:50 +02:00
Daniel Cohen Gindi
3ec493fc0c Merge pull request #2414 from Ewg777/patch-1
Fixed docs typo in AxisBase.java
2017-02-21 16:39:27 +02:00
Daniel Cohen Gindi
31b60225d0 Merge pull request #2622 from patrick-iv/fix_circle_inherit_alpha
Fix circles inherit alpha #2620
2017-02-21 16:38:39 +02:00
Daniel Cohen Gindi
886cc9f85d Merge pull request #2621 from patrick-iv/fix_default_text_size
Fix for default text size being set in PX instead of DP
2017-02-21 16:36:02 +02:00
Daniel Cohen Gindi
528e2e8d61 Merge pull request #2811 from travisfw/master
fix tests for java executable location in gradlew to be compatible with bash 4.3.42
2017-02-21 16:34:00 +02:00
Daniel Cohen Gindi
28166a01d1 Merge pull request #2814 from travisfw/utf8-javadoc
Set javadoc character encoding to utf8
2017-02-21 16:33:11 +02:00
Daniel Cohen Gindi
a5e0a9b86c Moved auto scale before render of axis lines
https://github.com/danielgindi/Charts/pull/2177
2017-02-21 14:24:13 +02:00
Daniel Cohen Gindi
94957fad33 Improved feb29 formula 2017-02-20 13:55:16 +02:00
Daniel Cohen Gindi
23e0178dbb Merge pull request #2825 from danielgindi/icons
Entry cons in all chart types
2017-02-20 13:45:21 +02:00
Daniel Cohen Gindi
144af7b295 Added examples for icon entries 2017-02-20 13:33:53 +02:00
Daniel Cohen Gindi
a02e108f46 Implemented icon support 2017-02-20 13:33:39 +02:00
travisfw
749827798b fix https://github.com/PhilJay/MPAndroidChart/issues/2813 2017-02-14 11:07:10 -08:00
travisfw
ed618084f9 fix tests for java executable location. bug #2805
https://github.com/PhilJay/MPAndroidChart/issues/2805
2017-02-13 14:02:55 -08:00
Patrick Ivarsson
30a331781f Fix circles inherit alpha (Fixes #2620)
ISSUE:
When using multiple LineDataSets like the follows:

    int solidColor = 0xFFFF00FF;
    dataSet.setColor(solidColor);
    dataSet.setCircleColor(solidColor);

    int semiTransparentColor = 0x8A000000;
    fadedSet.setColor(semiTransparentColor);

    LineData data = new LineData(dataSet, fadedSet);

the circles in 'dataSet' will rendered with the alpha from
fadedSet (0x8A).

The reason for this is that mRenderPaint is not reset properly
before drawing the circles. The first time drawCircles is called
the imageCache.fill(...) method is used where the color is set by
mRenderPaint.setColor(set.getCircleColor(i)), restoring the alpha
to 0xFF. The second time homever, imageCache.fill(...) is not called
which means that mRenderPaint will use it's old color/alpha,
which in this case is from fadedSet.

TEST INFO:
To trigger the issue, add the following to LineChartActivity1:

    final ArrayList<Entry> fadedEntries = new ArrayList<>();
    for (int i = 0; i < count; i++) {

        float val = (float) (Math.random() * range) + 3;
        fadedEntries.add(new Entry(i, val));
    }
    final LineDataSet fadedDateSet = new LineDataSet(fadedEntries, "Faded");
    fadedDateSet.setColor(0x42000000);

    dataSets.add(fadedDateSet); // add the datasets

and launch the first item in the example app.

SOLUTION:
This commit replaces mRenderPaint with null when drawing the circle
bitmap. If circleColor has been defined with a semi-transparent
color, it will be drawn that way in the cached bitmap, hence the the
bitmap itself does not need to be drawn with an alpha.
2016-12-23 15:01:23 +01:00
Patrick Ivarsson
6966b8117e Fix for default text size being set in PX instead of DP
The default text size in ComponentBase was defined as 10 pixels
instead of 10dp, which causes tiny text and does not reflect
the javadoc and the general behavior of setTextSize(...)
2016-12-23 12:38:42 +01:00
Daniel Cohen Gindi
ccf6b7e3b1 Correctly position 0 in stacked bar 2016-12-19 22:50:08 +02:00
Daniel Cohen Gindi
d5e5ec3a92 resetZoom() 2016-12-19 22:06:41 +02:00
Daniel Cohen Gindi
a934501315 Gradle updates 2016-12-19 21:56:16 +02:00
Daniel Cohen Gindi
34e7f44979 drawBottomYLabelEntryEnabled 2016-12-19 21:56:03 +02:00
Philipp Jahoda
8abe7e84ad Update README.md 2016-12-10 10:35:56 +01:00
Philipp Jahoda
9aaa3328f0 Update README.md 2016-12-10 10:35:28 +01:00
Philipp Jahoda
345b4bc97e Update README.md 2016-11-19 10:01:13 +01:00
PhilJay
08f295eae1 Upgrade manifest 2016-11-17 19:01:53 +01:00
PhilJay
a7fd778fc8 Upgrade version 2016-11-17 19:01:21 +01:00
Daniel Cohen Gindi
2e80fada31 Fixed a bug where the mod-360 bypass draws a full-circle for 0 slices. 2016-11-16 12:04:57 +02:00
Daniel Cohen Gindi
4cb83a7b91 Added IndexAxisValueFormatter, to allow for easy x-axis labels like MPAndroidChart 2.0 2016-11-16 11:19:50 +02:00
Daniel Cohen Gindi
0818d766db Fixed EPSILON. (Closes #2432)
Closes #2424
Closes #2394
Closes #2393
Closes #2385
2016-11-16 11:01:34 +02:00
Daniel Cohen Gindi
ee020bba67 Gradle updates 2016-11-16 11:01:34 +02:00
Mahesh Gaya
262d877b9f Fix: typo for October 2016-11-12 12:23:36 -06:00
Daniel Cohen Gindi
3928e285ae Fixed double calculation of xAxis spacing 2016-11-08 17:25:19 +02:00
Daniel Cohen Gindi
00f36054c7 Fixed weird glitch in mixed (pos/neg) stacked bars highlight
https://github.com/danielgindi/Charts/pull/1744
https://github.com/danielgindi/Charts/issues/1726
2016-10-31 15:35:16 +02:00
Daniel Cohen Gindi
3a879e9402 Added missing isDrawBordersEnabled getter 2016-10-31 13:34:22 +02:00
Daniel Cohen Gindi
8045d64260 Added clipValuesToContent property for clipping values 2016-10-31 13:32:47 +02:00
Daniel Cohen Gindi
6a5580b101 Renamed new property getter 2016-10-31 13:26:25 +02:00
Daniel Cohen Gindi
70691bea41 Fixed glitch in clipping rects.
It's the Android's renderer's bug.
When specifying exact clipping rects,
  they are clipping more than they should!
So drawing a thin 1px line on the edge of a clipping rect fail.
Instead of insetting by half the line width, inset by full line width.
2016-10-31 13:10:11 +02:00
Daniel Cohen Gindi
49b4d1a96b Bugfix: Corrected clipRect on the proper rect variable 2016-10-31 12:09:49 +02:00
Daniel Cohen Gindi
fb8094e9f2 Make automatically disabling slice-spacing an opt-in feature 2016-10-31 11:45:05 +02:00
Evgeniy
bc13bc2c17 Update AxisBase.java
Mistake fixed
2016-10-27 08:45:39 +03:00
PhilJay
9a19bf6670 Migrate to Realm v2.0.2, fix example 2016-10-23 00:02:49 +02:00
PhilJay
9b7cffa274 Move to Realm v2.0.2, update example 2016-10-22 23:54:31 +02:00
Philipp Jahoda
49b61e92a4 Update README.md 2016-10-22 15:54:26 +02:00
Philipp Jahoda
3ce2016048 Update README.md 2016-10-19 23:09:03 +02:00
Philipp Jahoda
b618524a19 Update README.md 2016-10-19 23:03:54 +02:00
Daniel Cohen Gindi
810c99c579 Make highlightFullBarEnabled feature work again 2016-10-19 10:08:42 +03:00
PhilJay
0fec2ef06b Clear up grouped bar example 2016-10-18 22:40:45 +02:00
Daniel Cohen Gindi
d65ffb8871 Fixed bar chart demo first value being empty 2016-10-18 18:39:04 +03:00
Daniel Cohen Gindi
730e5d3d9b Fixed last label of line chart not rendering 2016-10-18 18:27:21 +03:00
Daniel Cohen Gindi
c83d2f4ff4 Default spaceMin/max for xAxis in candlestick charts 2016-10-18 18:17:16 +03:00
PhilJay
8ed6dd24bf Update gradle & android sdk 2016-10-16 19:09:42 +02:00
Philipp Jahoda
221cd1313a Merge pull request #2342 from nielsz/patch-1
Fix typo
2016-10-16 18:49:41 +02:00
Daniel Cohen Gindi
555176bcdb Avoid crash when dataset is empty 2016-10-10 17:24:59 +03:00
Daniel Cohen Gindi
e10628958f Improved highlight for scatter/bubble, and fixes highlightValueWithX 2016-10-10 16:33:43 +03:00
Daniel Cohen Gindi
8d65596266 Default spaceMin/spaceMax for bar charts
This avoids having to set custom axisMinimum/axisMaximum, or offsetting x
2016-10-08 22:25:44 +03:00
Daniel Cohen Gindi
b77063d818 Feature: spaceMin/spaceMax for axis 2016-10-08 22:24:08 +03:00
Daniel Cohen Gindi
815dee86a0 Corrected calcMinMaxY for autoScaleMinMax 2016-10-08 21:47:31 +03:00
nielsz
463ef829d7 Fix typo 2016-10-08 12:18:13 +02:00
PhilJay
3398cf4462 Refactoring, prepare example for testing highlight 2016-10-02 15:14:09 +02:00
PhilJay
323329d8a6 Extend test cases 2016-10-02 14:36:55 +02:00
Daniel Cohen Gindi
6f1d365176 Merge pull request #2314 from mikedream89/master
[FIX] not find centeringEnabled
2016-09-30 18:27:38 +03:00
Mark
cf0f1fca34 [FIX] not find centeringEnabled 2016-09-29 19:38:48 +08:00
Daniel Cohen Gindi
c8553da89c Set z-index of markers to be the highest 2016-09-29 09:09:05 +03:00
Daniel Cohen Gindi
06bed3332d Allow label centering for 1 label 2016-09-29 09:00:18 +03:00
Daniel Cohen Gindi
aa14ab262b Minor fixes for interval in axis labels 2016-09-29 08:59:33 +03:00
Daniel Cohen Gindi
028328b986 Guard roundToNextSignificant and decimal from invalids 2016-09-29 08:12:05 +03:00
PhilJay
01d8b24686 Update gradle 2016-09-24 18:21:50 +02:00
PhilJay
d4e2e697e6 Merge branch 'master' of https://github.com/PhilJay/MPAndroidChart 2016-09-22 16:23:48 +02:00
Daniel Cohen Gindi
6c0b9c1aab Removed redundant condition 2016-09-21 20:02:56 +03:00
Daniel Cohen Gindi
b1fe859ce8 Fixes for cubic bezier edges 2016-09-21 19:55:58 +03:00
Daniel Cohen Gindi
63684f02ca Avoid crash for centerAxisLabelsEnabled when entry count == 1 2016-09-21 17:56:00 +03:00
Daniel Cohen Gindi
21e778cb1f Move on from the deprecated property in the demos 2016-09-21 07:53:06 +03:00
Daniel Cohen Gindi
7ffa9caaa1 Fixed entry searching algorithm to handle sequential same values 2016-09-21 07:30:46 +03:00
Daniel Cohen Gindi
b53c8cdbd1 Removed redundancies 2016-09-19 22:15:26 +03:00
Voicu
89f10e928e Remove unused local variable 2016-09-18 09:32:34 -07:00
PhilJay
865c3dae18 Extend test cases (for bugfix) 2016-09-18 17:33:04 +02:00
PhilJay
5b9bd6e633 Fix time chart example 2016-09-18 11:13:25 +02:00
PhilJay
0aeddb025e Fix issue causing ANR for empty charts 2016-09-17 23:47:47 +02:00
PhilJay
e9459fb592 Remove unused mDrawPaint instance 2016-09-17 23:23:59 +02:00
PhilJay
d34670fa62 Remove noDataTextDescription - this can be done via noDataText as well 2016-09-17 23:23:12 +02:00
PhilJay
643f901b15 Make chart description a Component which allows to treat description similar to Legend or Axis (issue #2249) 2016-09-17 21:36:59 +02:00
Daniel Cohen Gindi
a3c1fe6bbf Added missing clip rect for zero line 2016-09-15 09:12:59 +03:00
Daniel Cohen Gindi
a6dd5bb4a1 Improved naming before the big release 2016-09-14 23:47:55 +03:00
Daniel Cohen Gindi
8f5a898a95 Improved naming 2016-09-14 22:22:32 +03:00
PhilJay
7b33554d5b Minor changes & documentation 2016-09-04 10:44:23 +02:00
Philipp Jahoda
02cf2c1b97 Merge pull request #2193 from relair/PieChart_FixForBackgroundIssue_WhenSliceIsTooSmall
Pie chart, fix for small values appearing as background
2016-09-03 19:01:39 +02:00
PhilJay
01419f795b Remove psd 2016-08-31 09:19:05 +02:00
Daniel Cohen Gindi
fd3b71f780 Reuse index 2016-08-29 22:22:14 +03:00
Marcin
afcb72f50f Fix for pie chart, so small values won't appear as "background" (which really is a huge circle) 2016-08-24 14:52:42 +01:00
Voicu
e5d03ba640 Remove nullcheck for known non-null value 2016-08-22 23:30:43 -07:00
Philipp Jahoda
8134d7f056 Merge pull request #2110 from Akylas/dasheffect
AxisLine DashEffect
2016-08-18 20:58:17 +02:00
Philipp Jahoda
e3c240bd9b Merge pull request #2172 from redwarp/master
Correct documentation for ComponentBase#setTextSize
2016-08-18 20:57:32 +02:00
Philipp Jahoda
2b04973813 Merge pull request #2168 from Sin-Wave/master
Fixed Bug in LineChartRenderer
2016-08-18 20:57:14 +02:00
Benoit Vermont
26a69592d3 Merge pull request #1 from redwarp/setTextSize-Documentation
Update ComponentBase.java
2016-08-18 16:49:10 +02:00
Benoit Vermont
9d0b0fd955 Update ComponentBase.java
Update the documentation for setTextSize, to reflect that the parameter size is in DP, and not in pixel.
2016-08-18 16:48:28 +02:00
Julian Köpke
918950b6ad respect phaseX when drawing cubicFill 2016-08-18 08:35:33 +02:00
Julian Köpke
cc971a7d02 fixed LineChartRenderer to get correct x values when using cubicFill 2016-08-17 19:44:48 +02:00
Daniel Cohen Gindi
5daa6dc23c Fill before stroke - because the fill may cover half of a thick stroke 2016-08-15 15:59:33 +03:00
Daniel Cohen Gindi
73148a6aa4 Simplified some code 2016-08-15 15:50:08 +03:00
Daniel Cohen Gindi
e556275e29 range may also be Infinite when xMin/xMax are MAX 2016-08-15 15:23:44 +03:00
Daniel Cohen Gindi
6c17ca45de Take care of edge cases when calculating intervals (labelCount == 0) 2016-08-15 15:21:33 +03:00
Philipp Jahoda
1bbf4be1ee Fixes and finishing up of autoScaleMinMax feature 2016-08-14 22:22:48 +02:00
Philipp Jahoda
336dfb93e5 Fix autoScaleMinMax 2016-08-14 21:48:05 +02:00
Philipp Jahoda
66ea845e14 Merge branch 'master' of https://github.com/PhilJay/MPAndroidChart 2016-08-14 21:25:52 +02:00
Philipp Jahoda
62bc0de28a Cleanup, preparations for autoScaleMinMax fix 2016-08-14 21:25:41 +02:00
Daniel Cohen Gindi
dab8db488f neededWidth should be enough here. formSize has no meaning globally.
If more offset is needed - use extraOffsets, or adjust the maxSizePercent).
2016-08-14 16:53:20 +03:00
Daniel Cohen Gindi
38cdf1b206 Set those sizes to dps, convert internally.
Until now it was set-dps, get-pixels.
2016-08-14 16:53:20 +03:00
Daniel Cohen Gindi
7a10c05e3a Added feature for dashing legend line forms (Closes #1843) 2016-08-14 16:53:20 +03:00
Daniel Cohen Gindi
ea6b0e8e1c Simplified legend entries configuration. Option to style dataset form... 2016-08-14 16:53:20 +03:00
Daniel Cohen Gindi
7747c34552 Add half line width to clipping rect of grid/limit lines (Closes #2081)
https://github.com/danielgindi/Charts/issues/1204
2016-08-14 11:07:26 +03:00
Philipp Jahoda
12d5b858f2 Merge 2016-08-14 09:54:32 +02:00
Philipp Jahoda
092e8a80f7 Changes related to #2119 2016-08-14 09:51:47 +02:00
Daniel Cohen Gindi
be12f155ba We need an "equals or less" here 2016-08-14 10:10:53 +03:00
Daniel Cohen Gindi
bab5b9dd6c Refined scaleXEnabled/scaleYEnabled conditioning 2016-08-14 09:37:45 +03:00
Daniel Cohen Gindi
3c8bf8cb94 Use an actual Epsilon here 2016-08-14 08:54:20 +03:00
Philipp Jahoda
d342760357 Fix issue #2102 2016-08-13 15:38:40 +02:00
Philipp Jahoda
d912964dd3 Cleanup 2016-08-13 15:27:40 +02:00
Philipp Jahoda
7462c083f9 Fix #2119 2016-08-12 21:02:25 +02:00
Philipp Jahoda
0f04e9c6f5 Documentation update 2016-08-12 20:55:59 +02:00
Philipp Jahoda
5a4a6d4065 Fix crash related to circle size (#2115) 2016-08-12 20:50:57 +02:00
Philipp Jahoda
f0e1deb763 Update image 2016-08-11 18:28:34 +02:00
Philipp Jahoda
077365c9af Add barchart wiki image 2016-08-11 18:25:29 +02:00
Philipp Jahoda
e158ef15e2 Renaming of setAxisMinValue etc to setAxisMinimum for consistency 2016-08-11 12:46:52 +02:00
Daniel Cohen Gindi
788539001f Choose a default that matches the default v2 behavior
To avoid hurting existing stylings drastically
2016-08-10 22:43:54 +03:00
Daniel Cohen Gindi
31b0fd9ff9 Updated Realm sample 2016-08-10 00:24:41 +03:00
Daniel Cohen Gindi
30cb069974 Brought back the Realm demos, were removed by mistake 2016-08-10 00:15:34 +03:00
Daniel Cohen Gindi
86d05e989a Corrected formula for 29-feb :-) 2016-08-09 20:46:04 +03:00
Daniel Cohen Gindi
71ac434a2d Pie's x is deprecated - log it out, and avoid in calcMinMax 2016-08-09 16:17:19 +03:00
Daniel Cohen Gindi
2176873271 Avoid creating a new formatter if null
This can improve performance in certain cases,
  and has the advantage of controlling the "global" default formatter
  that is used for null cases.
2016-08-09 16:02:07 +03:00
Daniel Cohen Gindi
18eec8f0e6 If we are at it - rename those interfaces too
FillFormatter -> IFillFormatter
ValueFormatter -> IValueFormatter
AxisValueFormatter -> IAxisValueFormatter
2016-08-09 15:44:03 +03:00
Daniel Cohen Gindi
02bf21df50 Reverse string formatter caches
These *will* cause trouble.
We know of users who format the strings based on the entry's location,
  view port scroll/scale, etc.

The cache will repeat irrelevant values, and gain no benefit for us.
2016-08-09 15:34:11 +03:00
Daniel Cohen Gindi
e841b697be Reversed "array access optimization"
A `for-each` loop allocates only one iterator for the whole loop,
  not for each iteration.
So this "optimization" is not needed, and just introduces additional
  clutter.

http://stackoverflow.com/questions/14640184/does-the-java-foreach-loop-create-a-new-object
2016-08-09 15:34:11 +03:00
Daniel Cohen Gindi
8cf2a6c3d0 Removed the extra offset that messed up legend location 2016-08-09 11:33:09 +03:00
Daniel Cohen Gindi
713f467ba8 Renamed Highlighter -> IHighlighter 2016-08-09 11:16:58 +03:00
Daniel Cohen Gindi
4d9dc0aa06 Safeguard for cubic bezier drawing 2016-08-08 23:32:11 +03:00
Daniel Cohen Gindi
339fa16324 Added back missing new CombinedChartRenderer 2016-08-08 22:26:05 +03:00
Daniel Cohen Gindi
aaec1f5d2c DRYed scatter code, simplified IShapeRenderer implementations 2016-08-08 22:15:57 +03:00
Daniel Cohen Gindi
51f0e53a7f Reinvented Markers - interface based, enhanced default behaviour
Two default implementations exist now: MarkerView, MarkerImage
The default behaviour constraints the marker to the view's bounds.
2016-08-08 18:25:44 +03:00
Daniel Cohen Gindi
f63002e196 Renamed x-pos to x-value where appropriate 2016-08-08 10:14:58 +03:00
Daniel Cohen Gindi
77c10fc9e5 These return a single pixel (x/y), for values (x value and y value) 2016-08-08 10:03:51 +03:00
Daniel Cohen Gindi
2d54fd1f3f Call createRenderers() instead of recreating the renderer each time 2016-08-08 09:56:04 +03:00
Daniel Cohen Gindi
79f5ed0200 Simplified scatter shape enum model
(Why would anyone try to subclass an enum?)
2016-08-08 09:56:04 +03:00
Daniel Cohen Gindi
99379d7bcf Renamed ShapeRenderer -> IShapeRenderer 2016-08-08 09:56:04 +03:00
Daniel Cohen Gindi
d2e8ee220a Renamed zoomCenter to zoomToCenter 2016-08-08 09:56:04 +03:00
Daniel Cohen Gindi
9c5a46c9f8 Gradle required 2048 heap for multidex 2016-08-08 09:56:04 +03:00
Daniel Cohen Gindi
1096719e8f drawBarShadowEnabled is working again 2016-08-08 09:56:04 +03:00
Daniel Cohen Gindi
0c00b09bdb DRYed that code 2016-08-08 09:56:04 +03:00
Daniel Cohen Gindi
1eae18b657 Keep that in a variable 2016-08-08 09:56:04 +03:00
Daniel Cohen Gindi
b2250e0155 Use scientific EPSILON 2016-08-08 09:56:04 +03:00
Daniel Cohen Gindi
164bfd7fca Fixed legend anchor for TOP 2016-08-08 09:56:04 +03:00
Daniel Cohen Gindi
f9108b9ad9 Groundwork for future support of highlight for multiple bubbles per x 2016-08-08 09:56:04 +03:00
Philipp Jahoda
342d41cbc4 Add linechart wiki 2016-08-07 23:17:11 +02:00
Philipp Jahoda
79e6a5d747 Add wiki piechart 2016-08-07 22:52:40 +02:00
Philipp Jahoda
946475b6d5 Add grouped barchart wiki image 2016-08-07 22:34:41 +02:00
Philipp Jahoda
099a9cf8c1 Minor changes 2016-08-07 10:55:42 +02:00
Martin Guillon
2f6fb103a2 method to set the dash effect 2016-08-07 10:17:32 +02:00
Martin Guillon
a91de26a52 axis line dash effect 2016-08-07 10:17:18 +02:00
Philipp Jahoda
3ea1db57ab Create example for XYMarkerView (#2029) 2016-07-16 22:53:01 +02:00
Philipp Jahoda
e000c42744 Create new XYMarkerView (#2029) 2016-07-16 22:52:10 +02:00
Philipp Jahoda
ef575decbb Remove old screenshot 2016-07-16 15:43:26 +02:00
Philipp
37c4eef38e Update build tools 2016-07-16 15:41:37 +02:00
Philipp
4d5ce149dd Ignore ds_store files 2016-07-16 15:17:54 +02:00
Philipp Jahoda
d7e659a1fa Change max-highlight-distance default to 500dp 2016-07-09 15:42:17 +02:00
Philipp Jahoda
8c67ec19f7 Fix #1978 2016-07-08 19:15:52 +02:00
Philipp Jahoda
c3dc2822ce Merge 2016-07-07 16:49:13 +02:00
Philipp Jahoda
9ccf58feab Fixes related to legend rendering (issue #1969) 2016-07-07 16:48:59 +02:00
Philipp Jahoda
2fa4a094e7 Update README.md 2016-07-07 11:36:01 +02:00
Philipp Jahoda
89104c2858 Update README.md 2016-07-07 11:34:08 +02:00
Philipp Jahoda
eb44a13434 Merge readme 2016-07-03 20:38:30 +02:00
Philipp Jahoda
16738ef480 Import cleanup 2016-07-03 20:38:12 +02:00
Philipp Jahoda
e2cbafa049 Code cleanup & new zoom method 2016-07-03 20:22:56 +02:00
Philipp Jahoda
75ba4f69fc Update README.md 2016-07-03 14:54:43 +02:00
Philipp Jahoda
db70835cbc Update README.md 2016-07-03 14:53:58 +02:00
Philipp Jahoda
1a39ac9b12 Update README.md 2016-07-03 14:49:47 +02:00
Philipp Jahoda
bad43a5e13 Move example to realm v1.1.0 2016-07-03 11:48:04 +02:00
Philipp Jahoda
83a4bf9075 Update README.md 2016-07-03 09:50:34 +02:00
Philipp Jahoda
a4ac12aebf Update README.md 2016-07-03 01:17:15 +02:00
Philipp Jahoda
08b2d55049 Update README.md 2016-07-03 00:26:11 +02:00
Philipp Jahoda
3f0f3a82c2 Improve setColors methods, cleanup 2016-07-03 00:23:56 +02:00
Philipp Jahoda
360cc24b97 Cleanup 2016-07-03 00:11:48 +02:00
Philipp Jahoda
94a67ccea0 Fixes & improvements related to circle cache 2016-07-02 21:05:00 +02:00
Philipp Jahoda
6d21817c8a Rename PointD to MPPointD 2016-07-02 12:36:16 +02:00
Philipp Jahoda
43fa1e6cec Merge #1947 2016-07-02 12:29:50 +02:00
Tony Patino
40c5c87d13 Perf + Bug (#1892) (#1895)
This changeset merges all performance updates related to #1892, as well as the bug fix for #1895 for master.
2016-07-01 13:53:51 -07:00
Tony Patino
b5da8dcdb5 Crash fix - Create small clip paths (#1895)
With large data sets, the Path object created was sufficiently large as to cause an OutOfMemory error. This is resolved by only pathing a limited number of points on the chart at a time, then clearing the path and resuming. Stress testing with 1500 entries.
2016-07-01 13:19:37 -07:00
Tony Patino
87758604d3 Revert "Crash fix - Create small clip paths (#1895)"
This reverts commit d5df3ad795.
2016-07-01 13:17:49 -07:00
Tony Patino
d5df3ad795 Crash fix - Create small clip paths (#1895)
With large data sets, the Path object created was sufficiently large as to cause an OutOfMemory error.  This is resolved by only pathing a limited number of points on the chart at a time, then clearing the path and resuming.  Stress testing with 1500 entries.
2016-07-01 13:16:22 -07:00
Philipp Jahoda
0789628197 Add realm related example code 2016-07-01 18:54:59 +02:00
Philipp Jahoda
6a2e6e5528 Temporary remove of realm from example 2016-07-01 18:12:42 +02:00
Philipp Jahoda
0597663392 changes to build.gradle 2016-07-01 17:49:12 +02:00
Philipp Jahoda
efbea0a7ef Documentation 2016-07-01 17:30:12 +02:00
Philipp Jahoda
12eee703a7 Fix issue related to highlight callbacks #745 2016-07-01 09:13:58 +02:00
Tony Patino
523c7e5b21 Render bug fix - circle bitmap sizes (#1892)
Zooming in on the circle bitmaps, they were slightly small.  Allocate a little more space in the circle's bitmap to correct this.
2016-06-30 17:24:32 -07:00
Tony Patino
66094db764 Eliminate allocs - Copy arrays without new[] (#1892)
Make sure we copy List<> into [] if the size is identical to the length, instead of instantiating a new [].
2016-06-30 16:28:15 -07:00
Tony Patino
37f2498487 Eliminate allocs - MFPoint recycle (#1892)
Noticed a couple of stray un-recycled MFPoint and FSize instances.  These accounted for a bit of the remaining generated garbage.
2016-06-30 16:26:53 -07:00
Tony Patino
38fbefe66b Eliminate allocs - Move and Zoom Job Pools (#1892)
Create object pools for the Zoom, move, and animation jobs.  Their constructors remain public, to make this easier to roll back from if needed.
2016-06-30 15:33:02 -07:00
Tony Patino
5a18d0ef22 Eliminate allocs - Adjust pool replenishing (#1892)
Replenish fewer objects in utils pools when empty, in case the pool size grows large.
2016-06-30 15:30:45 -07:00
Tony Patino
b037f55d73 Eliminate allocs - XAxisRender array (#1892)
Found an array that was instantiated frequently without need.  Placed bounds on its instantiation.
2016-06-30 15:29:40 -07:00
Tony Patino
afdbd2c5f0 Eliminate allocs - Tests for StringCache (#1892)
Created unit tests for the FormattedStringCache classes.  Also, took this opportunity to create a FormattedStringCache.Generic<K,V> static class to take over what was previously simply FormattedStringCache.  Verified that all unit tests still pass.
2016-06-30 11:30:39 -07:00
Tony Patino
69f17b2a79 Eliminate allocs - Buffer ArrayLists (#1892)
Many short-lived ArrayLists were created in various methods, which could easily have been extracted to field level variable.  This has been done, and the arrays cleared before use.
2016-06-29 18:30:21 -07:00
Tony Patino
7fd18d2177 Eliminate allocs - Buffer Paint.FontMetrics (#1892)
paint.getFontMetrics() has a hidden allocation.  paint.getFontMetrics(fontMetrics) is used internally inside of Paint, so caching and holding onto a metrics buffer helps reduce allocations.
2016-06-29 17:48:31 -07:00
Tony Patino
424ee02ce2 Eliminate allocs - String Caches now have Prim subtypes (#1892)
By creating versions of the FormattedStringCache that don't require auto boxing, allocations are cut tremendously in this commit.
2016-06-29 17:36:15 -07:00
Tony Patino
a04ad28cec Eliminate allocs - Cache XBounds in Renderer (#1892)
getXBounds creates a disposable XBounds instance on every call.  Cache it and update the values with a set method.  This means XBounds values are now mutable.
2016-06-29 17:12:47 -07:00
Tony Patino
d372fd305c Eliminate allocs - Rect and RectF buffers (#1892)
Buffering temporary Rect and RectF instances.  Created methods to modify RectF instances as performance alternatives to methods that create disposable RectF instances.
2016-06-29 17:05:07 -07:00
Tony Patino
0b72b5588b Eliminate allocs - Cache formatted Strings (#1892)
ValueFormatter objects now rely on a FormattedStringCache to return already-formatted Strings.  We might want to create primitive-enabled versions since all our values to format are float or double primitives, and the keys are also all primitives.  This will eliminate auto-boxing penalties.
2016-06-29 16:43:33 -07:00
Tony Patino
bd45d73bc6 Eliminate allocs - Array Access (#1892)
foreach(:) arrays on Android carry the cost that each iteration creates an implicit instantiation.  for(;;) arrays are uglier but guarantee that no unwanted allocations occur while iterating.
2016-06-28 18:18:49 -07:00
Tony Patino
c59b46affc Eliminate allocs - Cache drawn circles as bitmaps (#1892)
LineChartRenderer now caches drawn circles as bitmaps.  ILineDataSet now has a method that returns the number of available colors in the set.
2016-06-28 17:39:42 -07:00
Tony Patino
56cfd2b42b Eliminate allocs - Matrix and Path buffers (#1892)
Created buffers for short lived Matrix and Path objects, resetting them instead of instantiating new ones.  Also created some matrix transform methods that accept output Matrix objects to facilitate caching.
2016-06-28 17:22:48 -07:00
Tony Patino
d946f3e3ff Eliminate allocs - float array buffers (#1892)
Creating field level buffers for frequently instantiated float arrays.  Cuts instantiations of many small objects.
2016-06-28 16:34:49 -07:00
Tony Patino
f86c1632a7 Eliminate allocs - MPPointF replace PointF (#1892)
In order to have a poolable alternative to PointF, this changeset introduces MPPointF.  Convenience methods exist that accept output MPPointF variables for extra savings on pool access.  Methods that return recyclable MPPointF instances are documented.
2016-06-28 15:48:48 -07:00
Tony Patino
0f2e2133d3 Eliminate allocs - Legend arrays (#1892)
In addition to creating a resized label sizes array, copy old FSize instances to the new array to cut down on the need to get instances from pool.  Recycle to pool if the labels shrank.
2016-06-28 14:48:57 -07:00
Tony Patino
fcf26aa6ad Eliminate allocs - PointD pooling (#1892)
Replace all "new PointD()" instantiations with PointD.getInstance() / PointD.recycleInstance() pairs. Helper methods overloaded to include void return / output PointD variable signatures.  Old methods remain as convenience, with notations that they return recyclable instances.
2016-06-28 14:26:27 -07:00
Tony Patino
d299546ebd Eliminate allocs - FSize pooling (#1892)
Replace all "new FSize()" instantiations with FSize.getInstance() / FSize.recycleInstance() pairs.  Smarter FSize array usage inside Legend.
2016-06-28 13:54:10 -07:00
Tony Patino
cb6dabbdec Eliminate allocs - ObjectPool and Tests (#1892) 2016-06-28 12:42:05 -07:00
Philipp Jahoda
a233e38978 Remove Realm related classes from project 2016-06-27 23:47:32 +02:00
Philipp Jahoda
da6ded7bce Merge master 2016-06-27 17:21:41 +02:00
Philipp Jahoda
f54631175e Update README.md 2016-06-27 17:20:50 +02:00
Philipp Jahoda
1b4e9be07f Code cleanup and documentation 2016-06-27 12:34:23 +02:00
Philipp Jahoda
bd5858e8c0 Changes to custom scatter rendering 2016-06-27 12:29:49 +02:00
Philipp Jahoda
af114d180d Merge master 2016-06-26 22:04:19 +02:00
Philipp Jahoda
0f3f4b75b0 Merge #1878 2016-06-26 21:58:12 +02:00
Philipp Jahoda
f01b90668b Work on horizontalbarchart 2016-06-26 21:05:41 +02:00
Philipp Jahoda
eb76d21fe0 Cleanup 2016-06-26 11:54:43 +02:00
Philipp Jahoda
c5fa68eda5 Merge master 2016-06-26 10:31:13 +02:00
Philipp Jahoda
98e090ca19 Minor example adjustments 2016-06-26 10:30:16 +02:00
Philipp Jahoda
3b0be740cd Add example for half-piechart 2016-06-26 10:05:54 +02:00
Philipp Jahoda
b5bfc3e2bd Fixes related to setting visible axis range for horizontal barchart 2016-06-26 00:24:19 +02:00
Philipp Jahoda
f345d164ce Fix issue related to horizontal dashed grid lines #1756 2016-06-25 11:00:29 +02:00
Philipp Jahoda
5f8eb44d9f Fixes related to highlight rendering 2016-06-24 23:10:03 +02:00
Philipp Jahoda
0eb69d246c Changes related to highlight full bar 2016-06-24 23:01:05 +02:00
Philipp Jahoda
cb0226b231 Update CONTRIBUTING.md 2016-06-23 15:11:19 +02:00
Philipp Jahoda
6878220e2e Improvements to chart highlighting 2016-06-22 01:06:56 +02:00
Philipp Jahoda
f83a7e3b26 Minor changes to highlighting 2016-06-21 11:11:49 +02:00
Philipp Jahoda
ded930a2fa Work on viewport modifications for horizontal barchart (issue #1842) 2016-06-21 09:39:48 +02:00
Philipp Jahoda
72890afc10 Minor fixes related to double tap highlight 2016-06-20 20:50:09 +02:00
Philipp Jahoda
82d5fde6f2 Add feature that allows different styling for value and entry labels (former slice-text) 2016-06-19 23:51:25 +02:00
Philipp Jahoda
c18a2e270c Improvements to scatter value rendering 2016-06-19 21:53:31 +02:00
Philipp Jahoda
adfc9a5c77 Fix issue related to values not being drawn 2016-06-19 21:42:38 +02:00
Philipp Jahoda
95bd8a580e Improvements regarding highlighting, issue #1335 2016-06-19 21:35:23 +02:00
Philipp Jahoda
2dc7207f13 Fix weird nullpointer #1404 2016-06-19 21:19:08 +02:00
Philipp Jahoda
19265217bd Provide example for #1865 2016-06-18 16:09:22 +02:00
Philipp Jahoda
005c166e07 Cleanup 2016-06-18 12:24:56 +02:00
Philipp Jahoda
8a6139b1fb Fixes related to DefaultValueFormatter #1809 2016-06-18 12:18:43 +02:00
Philipp Jahoda
f75ea845e0 Work on scatterdataset copy 2016-06-18 00:56:04 +02:00
Philipp Jahoda
735a9b9c98 Fixes related to no data text #1749 2016-06-18 00:44:51 +02:00
Philipp Jahoda
bb0ad3ac22 Fix bug related to inverted axis & scrolling #1829 2016-06-18 00:33:26 +02:00
Philipp Jahoda
3aa4daae32 Add feature allowing customization of dragTriggerDistance #1721 2016-06-17 21:53:30 +02:00
wajdi chamakhi
4c4c76b1c7 remove Boldness 2016-06-16 09:23:23 +01:00
Philipp Jahoda
93e4f77006 Merge master 2016-06-16 10:10:28 +02:00
Philipp Jahoda
fb4590e6b0 Fix #1862 2016-06-16 10:07:12 +02:00
Philipp Jahoda
a823d9c059 Merge master 2016-06-16 10:05:43 +02:00
Philipp Jahoda
6fb2245845 Merge pull request #1553 from CoryCharlton/master
Added Chart.setNoDataTextColor(int color)
2016-06-16 09:58:52 +02:00
Philipp Jahoda
a3720feb0e Update README.md 2016-06-15 23:44:53 +02:00
Philipp Jahoda
84160773ed Fixes related to combinedchart #1853 2016-06-15 21:07:02 +02:00
wajdichamakhi
b0a0af8427 Merge pull request #3 from wajdichamakhi/Custom-Shape-Renderer
Custom shape renderer - Optimisation
2016-06-15 14:28:24 +01:00
wajdi chamakhi
bda3ccee35 Init shapeRendererList optimisation 2016-06-15 14:25:20 +01:00
wajdi chamakhi
53e57db562 Adding The Enum Patern Back 2016-06-15 14:20:18 +01:00
wajdichamakhi
9b2882e06d Merge pull request #2 from wajdichamakhi/Custom-Shape-Renderer
Author: wajdi chamakhi <wajdichamakhi@gmail.com>
2016-06-15 12:33:39 +01:00
wajdi chamakhi
a2e88ebedd Author: wajdi chamakhi <wajdichamakhi@gmail.com>
Date:   Wed Jun 15 11:30:11 2016 +0100

    Changing ScatterShape from ENUM to HashMap of String .
    Creating a provider which provides ShapeRenderer.
    Creating CustomShapeRenderers imlementing ShapeRender with different renderShape() method
    Replacing the Switch Statement by ShapeRenderer.renderShape();

    => Better OOP implementation. Scalable easily.
     To add new Shape you only need to create a class implementing ShapeRenderer and override renderShape method and then add the class in the provider ScatterChart.registerShapeRenderer(String scatterShapeName, ShapeRenderer shapeRenderer).
2016-06-15 12:27:45 +01:00
Philipp Jahoda
63eb7dfd91 Fix issue #1862 2016-06-14 15:28:45 +02:00
Philipp Jahoda
09cfb2334b Update README.md 2016-06-14 13:18:40 +02:00
wajdichamakhi
f324378de3 Merge pull request #1 from wajdichamakhi/Labels_and_legend_bold
Adding control on text Boldness in XAxis, YAxis, Limit Legends
2016-06-14 12:05:19 +01:00
Philipp Jahoda
5ff8f9609b More fixes related to MarkerView drawing 2016-06-13 23:19:51 +02:00
Philipp Jahoda
8a37bbda38 Work on highlight rendering and markerview 2016-06-13 20:13:30 +02:00
Philipp Jahoda
e853a80f78 Unused method cleanup 2016-06-12 16:23:01 +02:00
Philipp Jahoda
44d5641fb8 Fix issue in selection callback 2016-06-12 16:20:52 +02:00
Philipp Jahoda
dfc0b46f48 Improve OnChartValueSelectedListener 2016-06-12 16:16:51 +02:00
Philipp Jahoda
2b886a463e Work on improving pie and radar highlighting 2016-06-12 16:11:37 +02:00
Philipp Jahoda
0d9c8545f2 Work on combined highlighting 2016-06-11 23:44:30 +02:00
Philipp Jahoda
4b00e83479 Remove SelectionDetail class 2016-06-11 00:44:54 +02:00
Philipp Jahoda
f283de1698 Work on highlight 2016-06-11 00:07:53 +02:00
Philipp Jahoda
c28b41b05e Work on highlighting 2016-06-10 23:35:29 +02:00
Philipp Jahoda
858600dcd2 Cleanup renderers 2016-06-10 16:59:18 +02:00
Philipp Jahoda
82ca5e7e91 Highlighter cleanup 2016-06-10 16:55:13 +02:00
Philipp Jahoda
694eb49162 Fix issue in LegendRenderer 2016-06-10 16:03:19 +02:00
Philipp Jahoda
4826f3be24 Improved combined example, add grouped bars 2016-06-10 15:52:17 +02:00
Philipp Jahoda
95dd249cf3 Fixes related to slice space #1857, #1856, #1807, #1699, #1665, #1660, ... 2016-06-10 14:12:44 +02:00
Philipp Jahoda
b0f5ec1bf1 Example cleanup and improvements 2016-06-09 18:17:32 +02:00
Philipp Jahoda
e5af5692e4 Improvements to example 2016-06-09 18:04:01 +02:00
wajdi chamakhi
df91cedee3 Adding control on text Boldness in XAxis, YAxis, Limit Legends 2016-06-09 12:09:16 +01:00
Philipp Jahoda
2e5217edef Cleanup realm 2016-06-09 12:23:58 +02:00
Philipp Jahoda
6cb3034b0c Fix minmax calculations for realm implementation 2016-06-09 12:17:03 +02:00
Philipp Jahoda
d507234cc8 Further improve rendering x-bounds calculation 2016-06-09 12:10:15 +02:00
Philipp Jahoda
455ff894cb Fixes related to minmax and bubblechart rendering 2016-06-09 12:04:01 +02:00
Philipp Jahoda
c0bee1c1cd Further abstraction of XBounds calculation 2016-06-09 10:52:51 +02:00
Philipp Jahoda
0c90c44a01 Work on improving line rendering 2016-06-09 10:45:11 +02:00
Philipp Jahoda
81dbd91344 Merge 2016-06-09 09:46:55 +02:00
Philipp Jahoda
e704fb87a0 Fixes related to line renering 2016-06-09 09:45:20 +02:00
Philipp Jahoda
3c47d0ade9 Create example for timechart 2016-06-08 16:50:20 +02:00
Philipp Jahoda
45f9a189b7 Merge master 2016-06-07 23:46:09 +02:00
Philipp Jahoda
dad6cc0ce5 Modify build.gradle 2016-06-07 23:42:33 +02:00
Philipp Jahoda
5a4b6f1532 Fixes related to combined chart and refinement of combined chart example 2016-06-07 23:20:06 +02:00
Philipp Jahoda
f927517bea Comment cleanup 2016-06-07 21:58:44 +02:00
Philipp Jahoda
42ceaa9aa2 Work on line approximation 2016-06-07 21:48:26 +02:00
Philipp Jahoda
1ff1c8fcfa Documentation 2016-06-07 16:59:22 +02:00
Philipp Jahoda
4367fbb8f6 Minor fixes 2016-06-07 16:57:13 +02:00
Philipp Jahoda
72b4948aa3 Cleanup of chartdata object 2016-06-07 16:55:48 +02:00
Philipp Jahoda
ae2d917fa7 Refactoring, tests and fixes related to min and max calculation 2016-06-07 14:00:45 +02:00
Philipp Jahoda
33b158147e Minor fix in example 2016-06-06 23:55:58 +02:00
Philipp Jahoda
0a55308975 Fixes and testing related to dynamic data adding and removing from chartdata 2016-06-06 23:54:54 +02:00
Philipp Jahoda
dc03cf2593 Test adding and removing entries 2016-06-06 23:11:18 +02:00
Philipp Jahoda
280101bafc IDataSet interface cleanup 2016-06-06 22:53:09 +02:00
Philipp Jahoda
b4109d3248 Testing of calculate min max of dataset, changes in remove entry methods 2016-06-06 22:51:20 +02:00
Philipp Jahoda
67911b1317 Write unit tests for groupBars 2016-06-06 17:47:40 +02:00
Philipp Jahoda
68947023d4 Refactoring and improvements related to grouped bars 2016-06-06 17:23:26 +02:00
Philipp Jahoda
40917f0dda Refactoring 2016-06-06 17:13:10 +02:00
Philipp Jahoda
f69ae3f76b Improve & test LargeValueFormatter 2016-06-06 16:44:56 +02:00
Philipp Jahoda
92504fa81d Update gradle files 2016-06-04 23:35:16 +02:00
Philipp Jahoda
33fbf34a7c Cleanup 2016-06-04 23:32:39 +02:00
Philipp Jahoda
073b477811 Fixes related to markerview drawing in animation 2016-06-04 23:15:56 +02:00
Philipp Jahoda
01f8a57550 Work on zooming methods 2016-06-04 23:07:19 +02:00
Philipp Jahoda
6fd2ffa278 Comment refactoring 2016-06-04 15:15:26 +02:00
Philipp Jahoda
565c8a465e More fixes for RadarChart 2016-06-04 15:13:08 +02:00
Philipp Jahoda
22c7a6dc03 Cleanup recently noticed refactoring fail 2016-06-04 14:57:11 +02:00
Philipp Jahoda
1dd8c901d6 Documentation cleanup 2016-06-04 14:51:39 +02:00
Philipp Jahoda
cee380be6c Fix issue in highlight animation for barchart 2016-06-04 14:44:39 +02:00
Philipp Jahoda
b5cf9e120b Remove highlight-arrow feature, this can be done by markerview 2016-06-04 14:31:47 +02:00
Philipp Jahoda
66434c6a8e Test axis renderer 2016-06-04 14:18:43 +02:00
Philipp Jahoda
084935d9e3 Cleanup y-axis renderers 2016-06-04 11:14:39 +02:00
Philipp Jahoda
3076f259f9 Fix drawing of horizontal x-axis grid lines 2016-06-04 10:28:30 +02:00
Philipp Jahoda
5aa797fa96 Bugfixes related to realm support 2016-06-04 00:24:42 +02:00
Philipp Jahoda
40f078a2bf Work on realm and barchart 2016-06-03 23:30:49 +02:00
Philipp Jahoda
589bd0cbad Work on making realm example work again 2016-06-03 16:52:32 +02:00
Philipp Jahoda
6d39afa028 Brush up radarchart example 2016-06-03 16:13:04 +02:00
Philipp Jahoda
f39d8911d3 Work on radarchart 2016-06-03 12:11:42 +02:00
Philipp Jahoda
4b058a594f Fixes regarding drawing of markerview 2016-06-03 11:35:16 +02:00
Philipp Jahoda
ac3eafaba9 Work on highlighting, introduced highlight max distance 2016-06-03 10:26:05 +02:00
Philipp Jahoda
423b885745 Work on combined highlighting 2016-06-02 23:43:16 +02:00
Philipp Jahoda
8751f608a4 Work on radarchart rendering 2016-06-02 23:10:02 +02:00
Philipp Jahoda
639d335909 Work on radarchart rendering, cleanup xaxis 2016-06-02 22:57:48 +02:00
Philipp Jahoda
4ae9950632 Work on radarchart rendering 2016-06-02 20:10:37 +02:00
Philipp Jahoda
bfcbae4263 Fix issue related to barchart value labels 2016-06-02 20:02:49 +02:00
Philipp Jahoda
a25290742d Work on dynamic adding examples 2016-06-02 19:49:01 +02:00
Philipp Jahoda
b4268fc502 Work on candlestick chart rendering 2016-06-02 19:22:24 +02:00
Philipp Jahoda
0632fedfd2 Work on improving example 2016-06-02 19:16:05 +02:00
Philipp Jahoda
11212eb72d Write example of day axis formatter 2016-06-02 17:16:34 +02:00
Philipp Jahoda
ec880022ab Fine tuning of days example 2016-06-02 15:53:03 +02:00
Philipp Jahoda
5292cfc818 Improve examples 2016-06-02 14:59:06 +02:00
Philipp Jahoda
b857e58837 Work on x-axis rendering of barchart 2016-06-02 14:00:06 +02:00
Philipp Jahoda
2ae37c3088 Restructuring of axis formatters 2016-06-02 10:24:51 +02:00
Philipp Jahoda
1a642899e0 Work on axis formatters 2016-06-02 10:08:04 +02:00
Philipp Jahoda
5110dc6349 Remove deprecated methods 2016-06-02 09:54:04 +02:00
Philipp Jahoda
d2aa701eb2 Work on x-axis rendering and formatters 2016-06-02 09:50:06 +02:00
Philipp Jahoda
90dc54a685 Fix performance issue in linechart 2016-06-01 22:30:02 +02:00
Philipp Jahoda
92cfe0a482 Remove xmin and xmax from renderer 2016-06-01 22:14:38 +02:00
Philipp Jahoda
71be944ea9 Fix offset related issues 2016-06-01 22:09:58 +02:00
Philipp Jahoda
6d23f7a3aa Work on horizontal highlighting 2016-06-01 21:40:37 +02:00
Philipp Jahoda
ceda923114 Work on horizontalbarchart rendering 2016-06-01 18:05:23 +02:00
Philipp Jahoda
2d4cf0d4b7 Work on x-axis formatting 2016-05-31 20:33:26 +02:00
Philipp Jahoda
8e2355c78f Remove all XAxisValue imports and dependencies 2016-05-31 18:10:07 +02:00
Philipp Jahoda
0d4b60800c Remove XAxisValue from example 2016-05-31 18:00:35 +02:00
Philipp Jahoda
6919a97f17 Remove x-values from data objects 2016-05-31 17:49:07 +02:00
Philipp Jahoda
d33b27cde0 Work on bar highlighting 2016-05-31 16:31:26 +02:00
Philipp Jahoda
3d6f0b982b Fix in horizontal buffer 2016-05-31 15:18:09 +02:00
Philipp Jahoda
e2ccaf353b Remove barspace from BarDataSet 2016-05-31 15:10:39 +02:00
Philipp Jahoda
1bf2948f48 Work on bar rendering 2016-05-31 15:02:31 +02:00
Philipp Jahoda
ddb03d4dec Work on highlighting 2016-05-31 12:27:45 +02:00
Philipp Jahoda
a0d39b918b Work on highlighting 2016-05-31 11:08:29 +02:00
Philipp Jahoda
0221ddfd24 Work on getting highest and lowest visible x 2016-05-31 09:49:31 +02:00
Philipp Jahoda
cc81a21c64 Restructure project from eclipse to android studio file structure 2016-05-31 09:34:11 +02:00
Philipp Jahoda
530ab11157 Work on highlighting 2016-05-31 08:56:40 +02:00
Philipp Jahoda
690dd87a06 Work on highlighting 2016-05-30 17:21:18 +02:00
Philipp Jahoda
7db6b7ea4a Work on barchart rendering 2016-05-30 15:44:03 +02:00
Philipp Jahoda
ec6752567b Work on barcharts with new x-value 2016-05-30 14:52:17 +02:00
Philipp Jahoda
d2cc49b525 Work on changing xaxis, WIP 2016-05-30 10:54:11 +02:00
Philipp Jahoda
d4e71d808c Refactoring of entry 2016-05-30 09:14:03 +02:00
Philipp Jahoda
7de481bca3 Merge 2016-05-28 15:58:44 +02:00
Philipp Jahoda
1b9b3da3de Add spin animation to pie example 2016-05-28 15:52:56 +02:00
Philipp Jahoda
0270470897 Minor fixes related to polyline example 2016-05-28 15:47:02 +02:00
Philipp Jahoda
2a2cee5d1c Merge master 2016-05-28 15:35:37 +02:00
Philipp Jahoda
8bca4c79d3 Update README.md 2016-05-27 22:36:23 +02:00
Philipp Jahoda
4ca511c4fd Merge 2016-05-27 17:47:13 +02:00
Philipp Jahoda
77f83cddc5 Update gradle 2016-05-27 17:46:48 +02:00
Philipp Jahoda
98fe348b21 Update README.md 2016-05-27 14:15:38 +02:00
Philipp Jahoda
43bc45b718 Minor fixes in example 2016-05-27 13:27:55 +02:00
Daniel Cohen Gindi
87193a3d2e Add extra control point when rendering cubic bezier out of range 2016-05-26 15:26:14 +03:00
Daniel Cohen Gindi
b59cf564a0 Updated coloured line circle colors for correct transparent hole 2016-05-22 17:55:54 +03:00
Daniel Cohen Gindi
881581fa2d Allow transparent circle hole color 2016-05-22 17:55:07 +03:00
Daniel Cohen Gindi
17f919aa43 Allow more control over circle hole radius 2016-05-22 17:15:22 +03:00
Daniel Cohen Gindi
2cb255a9f4 Clip drawing area of limit lines when !isDrawLimitLinesBehindDataEnabled 2016-05-22 15:23:18 +03:00
Daniel Cohen Gindi
4393b2710a I hope this will position x-labels correctly vertically
And without any weird hack.
But by just finally figuring out how to
correctly offset the drawing from the font glyph size
2016-05-15 10:36:45 +03:00
Daniel Cohen Gindi
92810c8d9a Fixed typo in Util/Utils 2016-05-15 09:59:06 +03:00
Daniel Cohen Gindi
4cf9f59654 These DPs must be converted to pixels 2016-05-10 19:27:37 +03:00
Daniel Cohen Gindi
db19fdcb94 These DPs must be converted to pixels 2016-05-10 19:27:08 +03:00
Daniel Cohen Gindi
ea89dfef04 Supress false-positive inspection warning 2016-05-08 21:04:33 +03:00
Daniel Cohen Gindi
6a72ab8c18 Added feature highlightFullBar for highlighting all values at xIndex
This also provides backwards-compatibility for old behaviour of Combined chart

NOTE: The drawHighlight code was just indented and wrapped in a loop over datasets.
2016-05-08 20:43:15 +03:00
Philipp Jahoda
e894e380f6 Merge pull request #1727 from danielgindi/highlights
Highlight enhancements
2016-05-04 08:58:15 +02:00
Daniel Cohen Gindi
a002634d49 Highlight enhancements
There are certain cases (ie. bubbles) which make sense to have multiple
values per xIndex.
This fixes that - and adds more granular highlight for Combined Chart.
2016-05-01 22:05:53 +03:00
Daniel Cohen Gindi
a3e4450c74 More reusable Realm data builder 2016-05-01 21:45:53 +03:00
Philipp Jahoda
69d1b4d811 Minor fix 2016-04-17 23:26:01 +02:00
Philipp Jahoda
3baf89c25d Merge 2016-04-17 23:25:12 +02:00
Philipp Jahoda
4b3825c68d Revert #1684 2016-04-17 23:21:03 +02:00
Philipp Jahoda
10676ea964 Fixes related to example 2016-04-17 23:15:42 +02:00
Philipp Jahoda
5424d799f9 Merge pull request #1684 from thadeubatista/master
[Resolved] X Axis Labels being cut off horizontally #1657
2016-04-16 23:41:39 +02:00
Philipp Jahoda
b28aae50fc Merge 2016-04-16 19:17:20 +02:00
thadeu.batista
3f483b90db ajuste alinhamento de labels da parte inferior do gráfico LineChart 2016-04-15 23:10:20 -03:00
thadeu.batista
66068f5242 projeto pronto para ajustes 2016-04-14 21:29:47 -03:00
thadeu.batista
6d3faca19c teste primeiro commit 2016-04-14 21:28:32 -03:00
Philipp Jahoda
358770cd13 Merge pull request #1682 from brcinho/potential_solution_for_out_of_memory_problems
potential solution to rare out of memory problems
2016-04-14 14:47:36 +02:00
Marko Brčić
6358f27f79 Seems that System.gc() call is not necessary 2016-04-14 10:56:02 +02:00
Marko Brčić
ab424e69d8 potential solution to rare out of memory problems 2016-04-13 23:54:37 +02:00
Daniel Cohen Gindi
215ce2d82e Minor improvements for line rendering 2016-04-13 21:50:12 +03:00
Daniel Cohen Gindi
b8ce47a78d Fixed dataset updates in demos 2016-04-13 21:49:50 +03:00
Daniel Cohen Gindi
fcd696a979 Allow setting xVals on Data 2016-04-13 21:49:50 +03:00
Daniel Cohen Gindi
6f2f6a289c Fixed crash when phaseX causes entryForIndex to go out of bounds 2016-04-13 21:49:50 +03:00
Daniel Cohen Gindi
1c312e85a9 Allow bubble sizes to not be normalized against the dataset max 2016-04-13 21:49:49 +03:00
Daniel Cohen Gindi
ff0b8c375f Make these a little clearer 2016-04-13 21:49:49 +03:00
Daniel Cohen Gindi
0b43eeaf2d Removed unnecessary ternary expression 2016-04-13 16:57:57 +03:00
Daniel Cohen Gindi
4e50305dd3 Avoid division by zeros 2016-04-13 16:57:52 +03:00
Daniel Cohen Gindi
cfb3fdf0a9 Fixed dataset update in demo 2016-04-13 16:56:31 +03:00
Daniel Cohen Gindi
bef8db1af1 Fixed a null exception when using markers with pie chart 2016-04-12 14:06:13 +03:00
Philipp Jahoda
055b5a6c4c Add material colors 2016-04-12 11:34:58 +02:00
Philipp Jahoda
f7eabd0718 Update gradle 2016-04-12 10:42:51 +02:00
Philipp Jahoda
bc7ce8d0bd Merge master 2016-04-11 22:59:20 +02:00
Philipp Jahoda
493da1d130 Merge pull request #1671 from danielgindi/legend-exploded
Exploded the Legend-Position enum to support more combinations
2016-04-11 22:50:55 +02:00
Philipp Jahoda
48f1b6f960 Merge pull request #1670 from danielgindi/bar-border
Bar border
2016-04-11 22:50:09 +02:00
Daniel Cohen Gindi
42981cc98d Protect loop from infinite loop in the highest of zooms 2016-04-11 10:23:11 +03:00
Daniel Cohen Gindi
a1fa7ad5b2 Exploded the Legend-Position enum to support more combinations 2016-04-10 20:02:55 +03:00
Daniel Cohen Gindi
9a9ae5141c Avoid division by zero when calculating huge zooms 2016-04-10 14:10:03 +03:00
Daniel Cohen Gindi
e6915e25e2 Made these bar demos reuse the dataset and keep styling 2016-04-10 13:19:19 +03:00
Daniel Cohen Gindi
58b640dc0b Added bar borders to the demo 2016-04-10 13:19:19 +03:00
Daniel Cohen Gindi
18e39237de Added feature for drawing bar borders 2016-04-10 13:14:38 +03:00
Daniel Cohen Gindi
0ab3dbfae1 Added Xamarin links 2016-04-10 10:23:26 +03:00
Philipp Jahoda
cf463cad06 Merge 2016-04-10 00:57:32 +02:00
Philipp Jahoda
ccced3cc1f Merge pull request #1668 from danielgindi/horizontal-cubic-line
Horizontal cubic line
2016-04-10 00:46:30 +02:00
Daniel Cohen Gindi
215be8ac75 DRYed some code here... 2016-04-09 22:07:06 +03:00
Daniel Cohen Gindi
e762b59a28 Made these line demos reuse the dataset and keep styling 2016-04-09 22:01:15 +03:00
Daniel Cohen Gindi
f74cead4e7 Make yVals settable 2016-04-09 22:01:15 +03:00
Daniel Cohen Gindi
e0250bda49 Add horizontal bezier to the demo 2016-04-09 22:01:14 +03:00
Daniel Cohen Gindi
986874866d Added horizontal cubic (not exaggerating vertical control points) 2016-04-09 22:01:14 +03:00
Philipp Jahoda
a0b49fc8c4 Include offset in position calculation 2016-04-09 11:19:33 +02:00
=
545c633918 Work on timechart 2016-04-05 22:47:09 +02:00
=
992dd5fc85 Work on example 2016-04-05 22:30:38 +02:00
=
0c8cc700b3 Further improvements and timechart example 2016-04-05 22:27:25 +02:00
Philipp Jahoda
d0ce8e7d5a Improve axis calculate method 2016-04-05 11:16:07 +02:00
Philipp Jahoda
34a6e3b5eb Implement axis calculate method 2016-04-05 11:14:25 +02:00
Philipp Jahoda
a599fb79f9 Implement min/max calculation for x values 2016-04-05 11:04:57 +02:00
Philipp Jahoda
5b9665bf2d Merge 2016-04-05 09:41:53 +02:00
Philipp Jahoda
087aa1fda5 Merge 2016-04-05 09:41:20 +02:00
=
a9bd0c6191 Adjust example according to XAxisValue 2016-04-04 22:32:47 +02:00
=
d771bf4467 Start fixing example 2016-04-04 21:51:06 +02:00
=
4c5a2b94a4 Introduce XAxisValue to ChartData object 2016-04-04 21:46:53 +02:00
=
9d0be5d993 Merge branch 'remove_xindices' of https://github.com/PhilJay/MPAndroidChart into remove_xindices 2016-04-04 21:32:28 +02:00
Daniel Cohen Gindi
31f15a941d Turn on granularity for this example
For the value to take effect
2016-04-04 14:52:43 +03:00
Philipp Jahoda
00f3e42278 Create XAxisValue class 2016-04-03 22:50:33 +02:00
Philipp Jahoda
995538cf0b Remove granularity auto-calc feature 2016-04-03 22:36:23 +02:00
Philipp Jahoda
937ea04062 Disable granularity calculation per default 2016-04-03 18:50:31 +02:00
Philipp Jahoda
727b860f11 Add auto calculation of granularity 2016-04-03 18:42:44 +02:00
Philipp Jahoda
af746314c7 Brush up example 2016-04-03 17:51:21 +02:00
Philipp Jahoda
d976b79ed0 Change pie value line default values 2016-04-01 18:11:37 +02:00
Philipp Jahoda
411725bd5b Merge 2016-04-01 18:04:24 +02:00
Philipp Jahoda
8fffe4101c Merge pull request #1641 from danielgindi/labels-around-pie
Labels around pie
2016-04-01 18:03:47 +02:00
Philipp Jahoda
ae7df47637 Modify gitignore 2016-04-01 16:28:18 +02:00
Daniel Cohen Gindi
122ba413ef Take into account extra offsets for pie/radar charts 2016-04-01 16:57:39 +03:00
Daniel Cohen Gindi
56e59d8776 Support for lines drawn to pie values 2016-04-01 16:57:16 +03:00
Philipp Jahoda
aa6bb7418d Fix #1637 2016-04-01 13:01:52 +02:00
Philipp Jahoda
7ef82f2b00 Merge 2016-04-01 09:50:58 +02:00
Philipp Jahoda
135f9aa09e Minor changes 2016-04-01 09:50:37 +02:00
Daniel Cohen Gindi
2e417148ce Corrected legend to center while wrapping in both "above" and "below"
Fixes the bug introduced by 0ee538c
2016-03-31 22:31:32 +03:00
Philipp Jahoda
543075027a Update README.md 2016-03-31 11:35:57 +02:00
Philipp Jahoda
f5ed473085 Update README.md 2016-03-31 11:35:01 +02:00
Philipp Jahoda
3fd2a8a17b Update build.gradle and manifest 2016-03-31 11:26:05 +02:00
Philipp Jahoda
badb736070 Add documentation to axis 2016-03-31 11:22:13 +02:00
Philipp Jahoda
1cecb828f7 Merge 2016-03-31 10:37:09 +02:00
Philipp Jahoda
528dd490d4 Fix issue #1529 2016-03-31 10:36:13 +02:00
=
0ee538c734 Fix issue #1631 2016-03-30 22:31:17 +02:00
=
9569cf577f Add methods for getting axis min and max value 2016-03-30 22:24:00 +02:00
Philipp Jahoda
b28f4aa8b8 Modify realm dependency 2016-03-29 23:41:15 +02:00
Philipp Jahoda
35845ced62 Update realm dependency 2016-03-29 18:26:13 +02:00
Philipp Jahoda
e221117b8f Fix #1605 2016-03-28 22:39:39 +02:00
Philipp Jahoda
a3238cb32d Merge pull request #1623 from KonstantinSchubert/patch-1
Attempt to fix issue #1622
2016-03-28 22:33:45 +02:00
Konstantin Schubert
8e4d28d0df Attempt to fix issue #1622
Remove call to super.calcMinMax() in PieChart.
2016-03-28 22:05:22 +02:00
Philipp Jahoda
8e00d1f2e6 Fix issue #1550 2016-03-27 15:03:12 +02:00
Philipp Jahoda
395742f09f Set fill color if drawable is not supported 2016-03-27 14:56:26 +02:00
Philipp Jahoda
8b4aa77237 Move getXAxis() method 2016-03-27 12:22:20 +02:00
Philipp Jahoda
7475b1292d Remove redundant deltaX value from chart 2016-03-26 19:28:08 +01:00
Philipp Jahoda
676e148ea1 Move axis min/max related code to AxisBase 2016-03-26 19:11:16 +01:00
Philipp Jahoda
8939945267 Refactoring and change of axis min/max calculation and custom axis values 2016-03-26 19:02:13 +01:00
Philipp Jahoda
96c518d3d9 Provide version checks 2016-03-26 11:16:31 +01:00
Philipp Jahoda
0d1894770c Fix issue #1601 2016-03-25 22:50:03 +01:00
Philipp Jahoda
fc72fbece1 Fix #1323 2016-03-25 22:19:51 +01:00
=
303ea3d764 Change values or SKIP and NONE color 2016-03-25 00:04:16 +01:00
=
7e7b6e397e Add documentation, set granularity in example 2016-03-22 23:27:38 +01:00
Cory Charlton
dfe68c519d Merge pull request #1 from PhilJay/master
Getting up to date
2016-03-21 10:36:49 -07:00
Philipp Jahoda
1eebf84001 Change zero line drawing default to false 2016-03-18 12:00:42 +01:00
Philipp Jahoda
21584d1fbb Merge pull request #1595 from danielgindi/pie-improvements
Do not let slice spacing make the chart go haywire. (Fixes #1582)
2016-03-18 09:13:34 +01:00
Daniel Cohen Gindi
06e63af1e1 Do not let slice spacing make the chart go haywire. (Fixes #1582)
If the user provides data that does not allow the spacing to stay even -
he will need to manually fix that (i.e by giving a larger inner hole)

Even with a hole - with very small slices it will not help.
Spacing could be reduces, and small slices can be removed from the dataset.
2016-03-17 22:14:47 +02:00
Philipp Jahoda
fa2518dbe0 Merge pull request #1594 from danielgindi/cubic-leak-fix
Fixed cubic line "leak" on first point.
2016-03-17 17:38:06 +01:00
Philipp Jahoda
ffb615f09e Merge pull request #1593 from danielgindi/yaxis-width-limits
Added feature for min/max width limits on yAxis
2016-03-17 17:37:57 +01:00
Daniel Cohen Gindi
f002a3a9cc Fixed cubic line "leak" on first point.
Since lately we've done many fixes to the calculation for first/last
  points in cubic drawing - we not do not need that first "add curve".

Related issue: https://github.com/danielgindi/ios-charts/issues/683
2016-03-17 17:53:36 +02:00
Daniel Cohen Gindi
a19ffad046 Added feature for min/max width limits on yAxis 2016-03-17 17:15:34 +02:00
Philipp Jahoda
506b106277 Merge pull request #1592 from danielgindi/granularity
Granularity
2016-03-17 15:52:49 +01:00
Daniel Cohen Gindi
d430dd61fb Prevent repeated y-axis values by controlling granularity 2016-03-17 16:21:32 +02:00
Daniel Cohen Gindi
6347d680c8 Added feature for highlight circle in radar chart 2016-03-17 15:24:59 +02:00
Daniel Cohen Gindi
a7da427e26 Fixed a bug where after rotation/resize the matrix stays out of bounds
This bug existed before "keepPositionOnRotation".
In my opinion - keepPositionOnRotation should be default...
2016-03-17 12:41:21 +02:00
Daniel Cohen Gindi
dd50c2e49e Avoid extra computed when not needed 2016-03-17 12:19:36 +02:00
Philipp Jahoda
1ba4b413e8 Update README.md 2016-03-17 09:11:11 +01:00
Philipp Jahoda
20dd3b8ef1 Update README.md 2016-03-17 00:18:21 +01:00
Philipp Jahoda
71fede97b3 Fix #1584 2016-03-16 14:48:09 +01:00
Philipp Jahoda
677d8ef2d4 Add documentation 2016-03-15 23:37:02 +01:00
Philipp Jahoda
f1bc0d05d9 Update README.md 2016-03-13 13:44:10 +01:00
Philipp Jahoda
39efc52c20 Merge pull request #1571 from anant-dev/patch-1
Update README.md
2016-03-12 19:32:04 +01:00
Anant Singh
07d7813ccb Update README.md 2016-03-12 23:25:51 +05:30
Philipp Jahoda
7009cc8b96 Move onSizeChanged(...) 2016-03-10 23:37:06 +01:00
Philipp Jahoda
21f43ed3f0 Minor fix related to #1565 2016-03-10 23:36:30 +01:00
Philipp Jahoda
083e91a7fe Merge pull request #1565 from leoMehlig/rotation
Keep position on rotation
2016-03-10 23:26:13 +01:00
Philipp Jahoda
f5f71ef31c Merge pull request #1562 from danielgindi/stepped-chart
Stepped chart
2016-03-10 23:25:40 +01:00
Philipp Jahoda
a6ce45f9ac Fix issue #1561 2016-03-10 17:20:36 +01:00
Philipp Jahoda
1015aee1c5 Add contribution file 2016-03-10 17:09:27 +01:00
Leo Mehlig
3995941c3c Keep position on rotation
I’ve added a flag (keepPositionOnRotation) to BarLineChartBase
indicating whether the chart
should stay at its current position or not.
2016-03-10 13:44:16 +01:00
Daniel Cohen Gindi
7b8203020d Added stepped line chart support 2016-03-10 00:05:29 +02:00
Daniel Cohen Gindi
d4500e28ae Localized buffers for line rendering
To simplify rendering flow, and avoid excessive memory usage
2016-03-10 00:05:29 +02:00
Philipp Jahoda
e17e6dfd64 Merge readme 2016-03-06 18:29:35 +01:00
Philipp Jahoda
4845e1b0e3 Fix issue regarding corrupted translation (issue #1551) 2016-03-06 18:29:08 +01:00
Philipp Jahoda
3b70c23a06 Update README.md 2016-03-06 17:55:31 +01:00
Philipp Jahoda
f2771a6c88 Update README.md 2016-03-06 14:08:42 +01:00
Cory Charlton
6e35cf1c68 Added Chart.setNoDataTextColor(int color) 2016-03-05 18:33:34 -08:00
Philipp Jahoda
420d17391a Add dp conversion to fix issue #1540 2016-03-04 22:24:59 +01:00
Philipp Jahoda
c335897159 Merge 2016-03-02 23:43:08 +01:00
Philipp Jahoda
298e973819 Minor adjustment of previous fix. 2016-03-02 23:42:58 +01:00
Daniel Cohen Gindi
f1d79dc67b Fixes circle-with-hole drawing hiccup (Closes #1528) 2016-03-03 00:30:11 +02:00
Philipp Jahoda
2600018ff8 Fix #1535 2016-03-02 23:14:42 +01:00
Philipp Jahoda
a990ed79a2 Merge pull request #1530 from danielgindi/pie-spacing-fixes
Fixed some bugs calculating offset center point for space pie slice (Fixes #1528)
2016-03-01 23:16:56 +01:00
Daniel Cohen Gindi
acd046d787 Fixed some bugs calculating offset center point for space pie slice
(Fixes #1528)
2016-03-02 00:14:33 +02:00
Daniel Cohen Gindi
8f4432c52d Make the extra last line clearer in the rendering code flow 2016-02-29 18:54:38 +02:00
Philipp Jahoda
ed77cb4523 Update README.md 2016-02-28 20:05:59 +01:00
Philipp Jahoda
5f51623993 Add matrixbuffer to avoid constant allocations 2016-02-28 19:31:49 +01:00
Philipp Jahoda
03d91e41e6 Merge pull request #1524 from danielgindi/job-refactoring
Job refactoring
2016-02-28 16:14:28 +01:00
Daniel Cohen Gindi
922f1a8ab3 Renamed AnimatedJob to match ViewPortJob naming 2016-02-27 22:25:08 +02:00
Daniel Cohen Gindi
261720e94a If the other methods are public - this should be public as well 2016-02-27 22:23:31 +02:00
Daniel Cohen Gindi
028f4a54ca Removed addJob as possible cause for confusion
People should use `addViewportJob` instead
2016-02-27 22:23:00 +02:00
Daniel Cohen Gindi
42de21f3ca Renamed the job functions 2016-02-27 22:22:14 +02:00
Daniel Cohen Gindi
1d1a07131f Fixed confusion in docs :-) 2016-02-27 21:51:18 +02:00
Philipp Jahoda
f0dcd68017 Update README.md 2016-02-27 18:12:23 +01:00
Philipp Jahoda
5f6e3092b8 Merge pull request #1517 from danielgindi/pie-fixes
Pie fixes
2016-02-27 18:10:38 +01:00
Philipp Jahoda
042a4dd73a Merge pull request #1516 from danielgindi/cubic-line-fixes
Cubic line fixes
2016-02-27 12:17:16 +01:00
Daniel Cohen Gindi
f317299176 Normalise API for allowing to show slices under the hole 2016-02-26 14:56:15 +02:00
Daniel Cohen Gindi
d9c0fd76e5 Fixed drawing of hole colors 2016-02-26 14:55:23 +02:00
Daniel Cohen Gindi
badc1a8508 Always start with previous xIndex to avoid clipping the cubic too soon 2016-02-26 14:17:31 +02:00
Daniel Cohen Gindi
c3f2ec2faf Fix cubic fill being weird when xIndex does not match entry index 2016-02-26 14:17:31 +02:00
Philipp Jahoda
4b1112d2ef Update README.md 2016-02-25 15:43:50 +01:00
Philipp Jahoda
bc8c0788e9 Update README.md 2016-02-25 10:12:12 +01:00
Philipp Jahoda
c2007bec12 Update README.md 2016-02-25 10:08:52 +01:00
Philipp Jahoda
7ffc20c11b Update README.md 2016-02-25 10:07:52 +01:00
Philipp Jahoda
fa49f2fc83 Update README.md 2016-02-25 10:04:23 +01:00
Philipp Jahoda
fc3deccbce Add target API annotation 2016-02-25 09:48:24 +01:00
Philipp Jahoda
81eb08ffa9 Add API level check for new animation methods 2016-02-25 09:45:58 +01:00
Philipp Jahoda
8fa30a3106 Update example build.gradle 2016-02-25 00:49:10 +01:00
Philipp Jahoda
563767076d Another RadarChart fix that caused fill never to be disabled 2016-02-25 00:37:23 +01:00
Philipp Jahoda
d1689b6f63 Minor performance improvement for prior fix. 2016-02-25 00:33:50 +01:00
Philipp Jahoda
ebbea0651b Minor RadarChart fix for unequal datasets in terms of entry count 2016-02-25 00:28:10 +01:00
Philipp Jahoda
4a8929e9ca Fix issue #1506 2016-02-24 23:36:48 +01:00
Philipp Jahoda
3ddcd245ec Upgrade to realm 0.87.5 2016-02-24 15:15:47 +01:00
Philipp Jahoda
9028b5613b Minor fixes with zoom methods 2016-02-24 15:06:15 +01:00
Philipp Jahoda
2dd9d5aa34 Introduce zoomToAnimated(...) method - first version 2016-02-24 11:39:34 +01:00
Philipp Jahoda
1a0e90aacf Changes related to PieChart 2016-02-24 09:37:33 +01:00
Philipp Jahoda
27fbe57e3a Merge 2016-02-22 20:21:47 +01:00
Philipp Jahoda
7ac0fac8f2 Merge 2016-02-22 20:20:55 +01:00
Philipp Jahoda
a212d7ea6f Merge pull request #1499 from danielgindi/axis-range-fix
Fixed range calculation according to axisMin/axisMax
2016-02-22 20:16:35 +01:00
Philipp Jahoda
36d7436106 Merge pull request #1483 from danielgindi/pie-improvements
Improvements for drawing pie slices
2016-02-22 20:16:00 +01:00
Daniel Cohen Gindi
7a67f25b7d Fixed range calculation according to axisMin/axisMax 2016-02-22 19:06:31 +02:00
Daniel Cohen Gindi
9278b3d329 Added calculation of minimum inner radius for proper spacing
This also allows for animating the spacing :-)
2016-02-21 01:19:04 +02:00
Philipp Jahoda
72cabd15aa Add feature to move the viewport to a specified position animated 2016-02-20 11:25:34 +01:00
Daniel Cohen Gindi
b598ee1448 Fixed drawing full circle without slice spacing 2016-02-19 14:48:22 +02:00
Philipp Jahoda
014c688633 Merge master 2016-02-18 18:24:39 +01:00
Philipp Jahoda
016b760df4 Add documentation for chartinterface 2016-02-18 14:42:57 +01:00
Daniel Cohen Gindi
acd8dc1337 Improved transparentCircle for Pie
Instead of using PorterDuffXfer to clear everything in the hole -
we allow both hole color and transparentCircle to co-exist.

Also now we allow to see through to the inner ends of the pie slices.
2016-02-18 02:34:05 +02:00
Daniel Cohen Gindi
dcb20889ba Improvements for drawing pie slices
Xfer tricks not needed anymore - we only draw what we need!
2016-02-18 02:33:16 +02:00
Daniel Cohen Gindi
d1fb7bbe95 Update BarLineChartBase.java 2016-02-17 18:31:38 +02:00
Daniel Cohen Gindi
daa0115ab5 Minor docs update 2016-02-17 18:12:06 +02:00
Philipp Jahoda
c979bdb535 Fix issue related to value-text colors (issue #1478). 2016-02-17 09:59:31 +01:00
Philipp Jahoda
4f1f5bc3ef Code & example cleanup 2016-02-16 16:34:49 +01:00
Philipp Jahoda
9c92003c3e PieChart fixes for realm dataset 2016-02-15 10:42:56 +01:00
Philipp Jahoda
92e60e5eed Add feature for equal slice-spaces from center to outside (#444). 2016-02-14 21:16:14 +01:00
Philipp Jahoda
bdac14c83c New candlestickchart screenshot 2016-02-14 17:07:52 +01:00
Philipp Jahoda
71c67892ff Minor changes for negative zero fix 2016-02-14 17:04:19 +01:00
Philipp Jahoda
9104e77595 Remove redundant if-check 2016-02-14 16:56:25 +01:00
Philipp Jahoda
c53917a6d6 Update ScatterDataSet documentation 2016-02-14 16:54:37 +01:00
Philipp Jahoda
2a55eaceca Update candlestickchart screenshot 2016-02-14 16:53:32 +01:00
Philipp Jahoda
8703a0b886 Example adjustments 2016-02-12 17:47:52 +01:00
Philipp Jahoda
9297923f09 Remove redundant setStartAtZero method from YAxis. 2016-02-12 17:37:58 +01:00
Philipp Jahoda
b47dd65227 Minor adjustments to scatter-hole PR 2016-02-12 13:03:06 +01:00
Philipp Jahoda
80371bb5c8 Merge pull request #1454 from danielgindi/scatter
Scatter - support for shape holes, new X shape
2016-02-12 11:54:16 +01:00
Philipp Jahoda
98837e52c3 Merge pull request #1465 from danielgindi/candlesticks
Candle sticks improvements and new features
2016-02-12 11:04:35 +01:00
Philipp Jahoda
0895690ea4 Add zeroline screenshot 2016-02-11 16:24:30 +01:00
Philipp Jahoda
61c2398d6b Merge pull request #1455 from danielgindi/no-data-text
Center the "no data text" vertically
2016-02-11 10:56:00 +01:00
Daniel Cohen Gindi
32fc58d8dd Renamed candleDataSet.bodySpace -> barSpace 2016-02-11 11:00:16 +02:00
Daniel Cohen Gindi
b8f3d49b11 Support for rendering candlesticks without the bars 2016-02-11 10:58:40 +02:00
Daniel Cohen Gindi
95ce8b2bf6 Changed order of those properties for consistency 2016-02-11 10:47:08 +02:00
Daniel Cohen Gindi
f5c2336eb1 Got rid of the confusing 4 multiplier here 2016-02-11 10:44:42 +02:00
Daniel Cohen Gindi
45a8960251 Separate neutralColor in candlestick chart 2016-02-11 10:33:35 +02:00
Daniel Cohen Gindi
83ebea7fd2 Do not show shadow through candle bar 2016-02-11 10:26:14 +02:00
Daniel Cohen Gindi
5809f713c5 Default filled/not-filled in candle chart were wrong 2016-02-11 09:55:02 +02:00
Philipp Jahoda
fad31d0e88 Update README.md 2016-02-10 20:23:33 +01:00
Philipp Jahoda
5bc1136800 Version upgrade 2016-02-10 20:19:54 +01:00
Philipp Jahoda
08dfebcc08 Final fixes and improvements concerning zero line 2016-02-10 20:18:56 +01:00
Philipp Jahoda
661ed7dd70 Merge pull request #1456 from danielgindi/pie-center-text
Pie center text
2016-02-10 20:03:32 +01:00
Philipp Jahoda
28775755ef Introducing zero line which can be drawn regardless of grid lines 2016-02-10 11:09:35 +01:00
Daniel Cohen Gindi
54dc87cf55 On the fly conversion of dp - to avoid confusion 2016-02-10 01:50:15 +02:00
Daniel Cohen Gindi
3592adf522 New X shape for Scatter 2016-02-10 01:45:13 +02:00
Daniel Cohen Gindi
ccada2d3f1 Support for holes in Scatter shapes 2016-02-10 01:44:53 +02:00
Daniel Cohen Gindi
2c62ac87f0 Center the "no data text" vertically 2016-02-09 22:39:01 +02:00
Daniel Cohen Gindi
c3b8b1161a Clipping to path on Hardware layer available since API 18 2016-02-09 22:18:35 +02:00
Daniel Cohen Gindi
b73e3d0af2 Cleaned up this residue 2016-02-09 22:18:31 +02:00
Daniel Cohen Gindi
9c546bcfa9 Percentages on MPAndroidCharts are 0-100 2016-02-09 22:18:26 +02:00
Philipp Jahoda
ce84fe270b Fixes for last commit 2016-02-09 11:06:24 +01:00
Philipp Jahoda
31de4f2a29 Add feature to allow setting different colors for values (#1389, ...) 2016-02-06 18:44:23 +01:00
Philipp Jahoda
9615cc2af1 Improve example 2016-02-06 18:28:28 +01:00
Philipp Jahoda
a6e6fed0fa Work on new example with multicolor barchart 2016-02-06 18:21:46 +01:00
Philipp Jahoda
f19b8e862a Fix #1425 2016-01-31 11:25:15 +01:00
Daniel Cohen Gindi
93746fa017 Another minor fix for pie center text 2016-01-28 18:03:49 +02:00
Daniel Cohen Gindi
7e35393ec2 Fixed pie text bounds 2016-01-28 17:36:05 +02:00
Philipp Jahoda
1882d5ac25 Performance improvement & documentation of new formatter 2016-01-28 14:42:33 +01:00
Philipp Jahoda
43203db5c0 Introducing StackedValueFormatter (#1415) 2016-01-28 11:29:00 +01:00
Philipp Jahoda
569f890ee4 Merge pull request #1418 from danielgindi/radar-animation
Radar animation
2016-01-28 10:47:25 +01:00
Daniel Cohen Gindi
f3bd299ab1 These are redundant 2016-01-28 11:41:13 +02:00
Daniel Cohen Gindi
996948e829 Fix pie chart values animation on X axis 2016-01-28 11:41:06 +02:00
Daniel Cohen Gindi
ae231be566 Added missing spin in menu 2016-01-28 11:07:42 +02:00
Daniel Cohen Gindi
21fc088f0d Minor perf for pie chart 2016-01-28 11:07:42 +02:00
Daniel Cohen Gindi
6ee101c5c6 Support for animating Radar charts 2016-01-28 11:07:42 +02:00
Philipp Jahoda
19f1b3b444 Fixes for recent changes 2016-01-27 16:23:24 +01:00
Philipp Jahoda
295521c93a Merge branch 'master' of https://github.com/PhilJay/MPAndroidChart 2016-01-27 15:53:48 +01:00
Philipp Jahoda
4f8b80b6cc Fix #1410 2016-01-27 15:53:24 +01:00
Philipp Jahoda
99c87c4d89 Fix 1410 2016-01-27 15:52:24 +01:00
Philipp Jahoda
9137956ec1 Minor bugfixing or recent additions 2016-01-27 15:35:16 +01:00
Philipp Jahoda
7b1239ccf2 Fix double tap issue with listener #1411 2016-01-27 12:28:26 +01:00
Philipp Jahoda
4f5a32d667 Remove redundant startAtZero from YAxis, now use setAxisMinValue 2016-01-27 09:22:03 +01:00
Philipp Jahoda
4c4d25b246 Update README.md 2016-01-26 18:26:36 +01:00
Philipp Jahoda
95abc45133 New gradient linechart screenshot 2016-01-26 18:23:14 +01:00
Philipp Jahoda
e556ffb21e Upgrade to realm 0.87.3 2016-01-25 14:58:50 +01:00
Philipp Jahoda
ca6f24ba15 Allow to set Bitmap.Config for LineChartRenderer - memory management 2016-01-25 14:34:37 +01:00
Philipp Jahoda
cf3a09d3e0 Allow drawables for RadarChart area filling. 2016-01-25 13:56:28 +01:00
Philipp Jahoda
981c7b4dc7 Unbind flag that allows unbinding of drawables to counter memory leaks 2016-01-25 13:45:08 +01:00
Philipp Jahoda
43fa3f2338 Fix issue #1401 2016-01-25 13:37:19 +01:00
Philipp Jahoda
d9300cb744 Merge PR #1399 2016-01-24 22:42:37 +01:00
Philipp Jahoda
f09770df38 Merge PR #1399 2016-01-24 22:41:42 +01:00
Andrei Boeru
bfae450eb1 Fill line chart with a Drawable
can be used for gradients, pictures, etc.
2016-01-24 18:44:30 +01:00
Philipp Jahoda
420a444897 Add documentation 2016-01-24 13:28:53 +01:00
Philipp Jahoda
8acc87da75 Update to realm 0.87.2 (issue #1397) 2016-01-24 13:23:52 +01:00
Philipp Jahoda
963bb2a2b1 Documentation changes 2016-01-23 10:04:49 +01:00
Philipp Jahoda
f64cff34d2 DrawGridBackground now defaults to false 2016-01-23 09:59:56 +01:00
Philipp Jahoda
aa5730d19f Introducing WeakReference for Bitmap (issue #1386) 2016-01-20 18:38:04 +01:00
Philipp Jahoda
49621cb4a0 Update README.md 2016-01-20 00:31:23 +01:00
Philipp Jahoda
b6289be3a9 Did some fixing related to #1381, added more useful methods to interfaces. 2016-01-19 22:43:58 +01:00
Philipp Jahoda
d1839b41b7 Merge 2016-01-19 00:26:42 +01:00
Philipp Jahoda
ff5ddbbd92 Fix build gradle 2016-01-19 00:26:16 +01:00
Philipp Jahoda
3bd2110ecb Update README.md 2016-01-19 00:19:28 +01:00
Philipp Jahoda
1f1996c4d3 Update README.md 2016-01-19 00:19:01 +01:00
Philipp Jahoda
2dee57a0dc Minor fixes 2016-01-19 00:00:52 +01:00
Philipp Jahoda
3fa3726f3a Update README.md 2016-01-18 14:36:11 +01:00
Philipp Jahoda
d01f03105d Fixes concerning horizontalbarchart offset 2016-01-18 14:30:07 +01:00
Philipp Jahoda
d487da7b42 Fixes regarding offsets on x-axis 2016-01-18 14:21:11 +01:00
Philipp Jahoda
4281ad1674 Change back default offset 2016-01-18 10:50:03 +01:00
Philipp Jahoda
e1594999a5 Fix bug in HorizontalBarChartRenderer 2016-01-18 10:30:53 +01:00
Philipp Jahoda
d1464ce619 Optimized default y-offsets of legend and xaxis for better default look 2016-01-18 10:25:53 +01:00
Philipp Jahoda
0759db0351 Minor fix 2016-01-17 19:47:04 +01:00
Philipp Jahoda
825bd2a40b Merge PR 2016-01-16 18:03:01 +01:00
Philipp Jahoda
4fcc7cca29 Merge pull request #1377 from danielgindi/circle-radius
Renamed "circle size" to "circle radius", deprecated set/getCircleSize
2016-01-16 17:38:52 +01:00
Daniel Cohen Gindi
989c1ab64c Renamed "circle size" to "circle radius", deprecated set/getCircleSize 2016-01-15 16:26:34 +02:00
Philipp Jahoda
9379008893 Add documentation 2016-01-13 18:07:17 +01:00
Philipp Jahoda
6b0e5f29f3 Merge pull request #1358 from danielgindi/minor-perf
Minor performance improvement
2016-01-11 22:32:49 +01:00
Daniel Cohen Gindi
d20928ab0c Minor performance improvement in pie chart
On large datasets - this will spare many loops over the data just to sum
2016-01-11 23:01:30 +02:00
Philipp Jahoda
ae7959ff8d Add documentation for setHighlighter(...) method 2016-01-10 23:08:55 +01:00
Philipp Jahoda
090df226e0 Merge pull request #1354 from danielgindi/highlighter-protocol
Make highlighter public for extensibility
2016-01-10 23:06:18 +01:00
Philipp Jahoda
deec97f261 Merge pull request #1355 from danielgindi/docs-typo
Fixes minor docs typo
2016-01-10 23:05:38 +01:00
Daniel Cohen Gindi
cb78d48f3c Fixes minor docs typo 2016-01-10 22:47:48 +02:00
Philipp Jahoda
6d870ac813 Merge pull request #1353 from danielgindi/pie-animation-highlight-fix
Fixes base angle for rotate highlight in pie chart
2016-01-10 12:53:55 +01:00
Daniel Cohen Gindi
403b40d573 Fixes base angle for rotate highlight in pie chart 2016-01-10 08:27:31 +02:00
Daniel Cohen Gindi
b2adb97cac Make highlighter public for extensibility
See also: https://github.com/danielgindi/ios-charts/pull/567
2016-01-10 08:12:23 +02:00
Philipp Jahoda
7931ea0c7c Merge pull request #1350 from danielgindi/matrix-inf
Prevent the matrix from reaching invalid values
2016-01-10 01:44:38 +01:00
Philipp Jahoda
ca672e4ff4 Merge pull request #1349 from danielgindi/pie-animation-fixes
Pie animation fixes
2016-01-09 12:37:04 +01:00
Daniel Cohen Gindi
a7b038a43e Fixed highlighted pie animation 2016-01-08 15:58:09 +02:00
Daniel Cohen Gindi
a7dda129ff Renamed variables to be more consistent 2016-01-08 15:56:15 +02:00
Daniel Cohen Gindi
b315153b87 That's too many toRadians calls just for adding numbers 2016-01-08 15:54:10 +02:00
Philipp Jahoda
c44761016e Update version and sdk 2016-01-05 14:20:54 +01:00
Philipp Jahoda
2fc56c5fc7 Improve example 2016-01-05 14:17:48 +01:00
Philipp Jahoda
61aeacdb4b Merge pull request #1322 from mikemonteith/master
Pie animation should be applied after rotationAngle
2016-01-05 14:04:30 +01:00
Philipp Jahoda
b45127d9ec Merge pull request #1333 from matiash/master
Remove PieChart.setCenterText() overloads.
2016-01-05 13:54:45 +01:00
Philipp Jahoda
b74a4d3c57 Merge pull request #1326 from danielgindi/text-lineheight-fix
Text lineheight fix
2016-01-05 11:13:40 +01:00
Matias Hernandez
d33c1b1558 Remove PieChart.setCenterText() overloads.
Replaced them by a single method receiving CharSequence.
2016-01-04 18:47:53 -03:00
Daniel Cohen Gindi
3074744db7 Preparations for rotated multiline text 2016-01-03 21:00:57 +02:00
Daniel Cohen Gindi
4807eca145 Fixes y-offset when rendering rotate-able text 2016-01-03 21:00:43 +02:00
Mike Monteith
c2fbd7ccf1 Pie animation should be applied after rotationAngle 2015-12-30 20:20:48 +00:00
Philipp Jahoda
cbf55db314 Merge pull request #1315 from mikemonteith/master
Fixes #1258
2015-12-29 10:21:09 +01:00
Mike Monteith
b65086f7df Fixes #1258 2015-12-28 10:21:40 +00:00
Philipp Jahoda
59620060da Add documentation 2015-12-25 16:48:30 +01:00
Philipp Jahoda
c2d1c5a049 Add more constructors to realm datasets 2015-12-25 16:47:08 +01:00
Philipp Jahoda
d64d70d07f Allow ScatterDataSet to be created without x-index 2015-12-25 00:44:27 +01:00
Philipp Jahoda
6476ddc0d7 Add more constructors for realm. Allow LineDataSet to be created without x-index. 2015-12-25 00:41:02 +01:00
Philipp Jahoda
4e0e8bbc77 Minor fixes on example project 2015-12-19 17:22:15 +01:00
Philipp Jahoda
3f67ae7c53 Merge readme 2015-12-19 17:02:12 +01:00
Philipp Jahoda
43a729375a Fixes in example project 2015-12-19 17:00:34 +01:00
Philipp Jahoda
c56580b394 Minor fixes on realm model 2015-12-19 16:47:12 +01:00
Philipp Jahoda
f3f7415b34 Create realm related data objects 2015-12-19 16:45:04 +01:00
Philipp Jahoda
5446799103 Update README.md 2015-12-19 00:26:18 +01:00
Philipp Jahoda
cedebdae6a Add realm wiki example code 2015-12-19 00:05:33 +01:00
Philipp Jahoda
3f79bb538b Fix merge conflicts 2015-12-17 20:33:35 +01:00
Philipp Jahoda
c59e59e152 Fix merge issues 2015-12-17 17:28:18 +01:00
Philipp Jahoda
bfcfafe326 merge master 2015-12-17 17:24:02 +01:00
Philipp Jahoda
dd9aa1ae69 Merge pull request #1290 from danielgindi/datanotset
Removed ambiguity of mDataNotSet
2015-12-17 17:20:54 +01:00
Philipp Jahoda
4d37aab147 Merge pull request #1292 from danielgindi/yvaluecount-fix
calcYValueSum should not be ABS
2015-12-17 17:20:38 +01:00
Daniel Cohen Gindi
dd0a8853dc Merge pull request #1293 from danielgindi/pie-center-text-fix
Fixed bounding rect for pie center text
2015-12-17 17:24:53 +02:00
Daniel Cohen Gindi
331385e2ba Fixed bounding rect for pie center text
It was "insetting" by a factor of 100,
because of wrong perception of the percentage property.
2015-12-17 17:08:11 +02:00
Daniel Cohen Gindi
9cf3801148 calcYValueSum should not be ABS 2015-12-17 17:03:47 +02:00
Daniel Cohen Gindi
98943b128a Prevent the matrix from reaching invalid values
9942aee9c4
2015-12-16 22:39:49 +02:00
Daniel Cohen Gindi
200fba72a3 Removed ambiguity of mDataNotSet
We can just check for mData being null,
knowing that this is the situation defined as "no data"
2015-12-16 21:49:00 +02:00
Philipp Jahoda
b19a42e71c Merge pull request #1289 from danielgindi/pie-highlight-fix
Fixed pie-chart highlight position while animating on X
2015-12-16 20:16:14 +01:00
Daniel Cohen Gindi
2c12098281 Fixed pie-chart highlight position while animating on X 2015-12-16 20:56:42 +02:00
Philipp Jahoda
c6e649903d Merge master 2015-12-13 15:46:27 +01:00
Philipp Jahoda
f30c1c90a4 Fix #1266 2015-12-13 15:44:52 +01:00
Philipp Jahoda
02780a321f More example project styling 2015-12-07 21:46:55 +01:00
Philipp Jahoda
c2666ec49c Fix bug in candledataset 2015-12-07 21:41:31 +01:00
Philipp Jahoda
f596bf0eb5 Add feature to allow setting colors with alpha value. 2015-12-07 21:31:26 +01:00
Philipp Jahoda
3c2ecbee5e example styling 2015-12-07 21:29:48 +01:00
Philipp Jahoda
2d7e2382d2 Fix issue in legend renderer concerning CandleStickChart legend 2015-12-07 21:17:44 +01:00
Philipp Jahoda
f096b39b53 Extend example project 2015-12-07 21:12:02 +01:00
Philipp Jahoda
838f9bf434 Improve example project 2015-12-07 21:00:03 +01:00
Philipp Jahoda
8ee89e9048 Work on example project styling 2015-12-07 20:41:32 +01:00
Philipp Jahoda
8099446441 Add feature to convert hex string to rgb color 2015-12-07 20:24:08 +01:00
Philipp Jahoda
aa0558d87f Further extend example project 2015-12-07 15:06:14 +01:00
Philipp Jahoda
1ff85cdb32 Fix BubbleDataSet bug. 2015-12-07 14:59:49 +01:00
Philipp Jahoda
9a55419b0e Work on realm.io database example 2015-12-07 14:59:34 +01:00
Philipp Jahoda
e633c06df3 Bugfixing & example app extension 2015-12-07 12:15:36 +01:00
Philipp Jahoda
5cc8676689 Implement calcMinMax for all datasets 2015-12-07 11:15:17 +01:00
Philipp Jahoda
5e67200a23 Implement feature to add & remove entries 2015-12-07 11:10:32 +01:00
Philipp Jahoda
2a8c0f2358 Merge master 2015-12-05 17:02:40 +01:00
Philipp Jahoda
a877526ab6 Merge master 2015-12-05 16:40:21 +01:00
Philipp Jahoda
fc5099d452 Merge 2015-12-05 15:57:32 +01:00
Philipp Jahoda
7b90352473 Added feature to set custom angle for PieChart (#989) 2015-12-05 15:57:05 +01:00
Philipp Jahoda
db1fc396ef Merge pull request #1234 from danielgindi/master
Fix for rounding error at the edges
2015-11-26 23:27:24 +01:00
Daniel Cohen Gindi
8e934788b8 Fix for rounding error at the edges
Related to: https://github.com/danielgindi/ios-charts/pull/558
2015-11-26 23:59:11 +02:00
Philipp Jahoda
e5e104b322 Merge pull request #1230 from cdeange/master
Fixed rounding issue with LineChartRenderer
2015-11-26 16:53:43 +01:00
Christian De Angelis
0796908917 Fixed rounding issue with LineChartRenderer 2015-11-25 14:56:00 -08:00
Philipp Jahoda
44b8ebb341 Merge pull request #1213 from bbarnhill/upgrade_dependencies
Upgrade Dependencies
2015-11-21 17:11:58 +01:00
Brad Barnhill
6b2bfddfda upgrade dependencies (gradle plugin 1.5.0, appcompat 23.1.1, build tools 23.0.2, gradle 2.9, android-maven plugin 1.3), remove unnecessary version definitions in manifest, auto generated wrapper files 2015-11-19 22:06:47 -06:00
Philipp Jahoda
9caca4b1cb Merge master 2015-11-16 10:48:18 +01:00
Philipp Jahoda
67c4d41939 Update README.md 2015-11-16 10:47:07 +01:00
Philipp Jahoda
78aa0b034c Implement constructors to support realm-xvalues 2015-11-10 13:02:52 +01:00
Philipp Jahoda
f4421699bd Bugfixing concerning stacked bars 2015-11-09 16:57:18 +01:00
Philipp Jahoda
aa24187673 Work on supporting stacked entries via realm 2015-11-09 16:50:31 +01:00
Philipp Jahoda
d8a898f114 Work on implementing realm stacked-bars support 2015-11-09 12:10:28 +01:00
Philipp Jahoda
00574b75a5 Update gradle dependency 2015-11-09 11:21:57 +01:00
Philipp Jahoda
3f942bf003 Work on realm-linedataset example 2015-11-08 18:24:06 +01:00
Philipp Jahoda
566e8018a0 Add cler method 2015-11-08 18:15:36 +01:00
Philipp Jahoda
60dcf5bd1d Move color related methods to BaseDataSet 2015-11-08 18:09:59 +01:00
Philipp Jahoda
58e629fd1f Add documentation 2015-11-08 18:08:24 +01:00
Philipp Jahoda
c482df559e Add necessary styling methods 2015-11-08 17:55:37 +01:00
Philipp Jahoda
691ce133b8 Package refactoring 2015-11-08 17:45:07 +01:00
Philipp Jahoda
ee0fd10fc4 Complete realm model 2015-11-08 17:44:03 +01:00
Philipp Jahoda
6773bad9d5 Add abstract RealmBarLineScatterCandleBubbleDataSet 2015-11-08 17:32:08 +01:00
Philipp Jahoda
b7e0e40d52 Documentation 2015-11-08 11:44:06 +01:00
Philipp Jahoda
af541451d8 Implement all RealmDataSets 2015-11-08 11:42:38 +01:00
Philipp Jahoda
faa02b87ea Test RealmBarDataSet, fix stack-size issue 2015-11-07 23:25:38 +01:00
Philipp Jahoda
0c729ac64c Add realm x-values support for BarData 2015-11-07 23:18:04 +01:00
Philipp Jahoda
29fdf185cf Implement 1st version of RealmBarDataSet 2015-11-07 23:15:22 +01:00
Philipp Jahoda
9399db9ec7 Change void addEntry(...) to boolean addEntry(...) 2015-11-07 23:00:25 +01:00
Philipp Jahoda
5ca17914f0 Implement 1st version of RealmLineDataSet 2015-11-07 22:56:23 +01:00
Philipp Jahoda
5aab431cff Impleme3nt RealmBaseDataSet 2015-11-06 18:53:38 +01:00
Philipp Jahoda
5bc50bd780 Work on realm datasets 2015-11-06 18:37:58 +01:00
Philipp Jahoda
fdf8a152af Merge master 2015-11-05 10:54:43 +01:00
Philipp Jahoda
7d385a243d Merge PR 2015-11-05 10:54:18 +01:00
Philipp Jahoda
b495a7d9eb Fix #1168 2015-11-05 10:52:33 +01:00
Philipp Jahoda
b257c0e7e7 Merge pull request #1179 from Adric/save-options
Set image format and subdirectory when saving to gallery
2015-11-05 00:04:14 +01:00
Adric Rukkila
277a19af4a Added ability to set image format and subdirectory when saving to gallery 2015-11-04 13:04:11 -07:00
Philipp Jahoda
e7201dc42f Merge master 2015-11-04 19:04:31 +01:00
Philipp Jahoda
b2f4e26e67 Change default minoffset to 15 (instead of 10) 2015-11-04 19:04:03 +01:00
Philipp Jahoda
5b31e14a98 Remove getYVals() method from Radar- & PieRenderer 2015-11-04 18:50:31 +01:00
Philipp Jahoda
d1432aaa8b Fix calcminmax 2015-11-04 18:48:07 +01:00
Philipp Jahoda
293361fba1 Remove laststart & lastend 2015-11-04 18:37:23 +01:00
Philipp Jahoda
20fa3ce17b Remove getYVals() method Candle- & BubbleRenderer 2015-11-04 18:22:34 +01:00
Philipp Jahoda
6e66acb7a0 Remove getYVals() method ScatterRenderer 2015-11-04 18:18:32 +01:00
Philipp Jahoda
088d0ad6f3 Remove getYVals() method HorizontalBarRenderer 2015-11-04 18:16:22 +01:00
Philipp Jahoda
41e52e791f Remove getYVals() method BarRenderer 2015-11-04 18:14:27 +01:00
Philipp Jahoda
20141a0499 Remove getYVals() method LineRenderer 2015-11-04 18:10:28 +01:00
Philipp Jahoda
a57104e6af Move data interfaces to different package 2015-11-03 22:09:35 +01:00
Philipp Jahoda
98f375f9f9 Fix compile errors in example project 2015-11-03 22:01:57 +01:00
Philipp Jahoda
3a451e238b Fix compile errors in Pie- and RadarChartRenderer 2015-11-03 21:58:54 +01:00
Philipp Jahoda
642d648046 Fix compile errors in PieChart & RadarChart 2015-11-03 21:54:41 +01:00
Philipp Jahoda
e0c518ecb2 Minor refactoring 2015-11-03 21:50:59 +01:00
Philipp Jahoda
a4d1946486 Add IRadarDataSet to RadarData object 2015-11-03 21:45:04 +01:00
Philipp Jahoda
d687c8ff18 Add IPieDataSet interface to PieData object 2015-11-03 21:44:28 +01:00
Philipp Jahoda
f8d8f4ce6c Add IPieDataSet & IRadarDataSet, add getStackLabels to IBarDataSet 2015-11-03 21:43:19 +01:00
Philipp Jahoda
dad180ec96 Merge master 2015-11-02 20:34:45 +01:00
Philipp Jahoda
0c9794180d Update README.md 2015-11-02 20:33:56 +01:00
Philipp Jahoda
af0c5acffb Update version 2015-11-02 20:31:37 +01:00
Philipp Jahoda
269ae4ca00 Merge master 2015-11-02 14:52:51 +01:00
Philipp Jahoda
dd3bd71027 Fix #1168 2015-11-02 14:52:10 +01:00
Philipp Jahoda
16ffc975f9 Remove contains(...) method from data object 2015-10-30 17:21:02 +01:00
Philipp Jahoda
94b13d4200 Did some refactoring on interfaces and abstract data classes 2015-10-30 17:20:41 +01:00
Philipp Jahoda
72bd6d904e Delete data interfaces 2015-10-28 00:14:42 +01:00
Philipp Jahoda
3fb8a54771 Merge master 2015-10-27 23:53:33 +01:00
Philipp Jahoda
f71f85f16b Merge pull request #1155 from danielgindi/x-axis-label-rotation
Implemented support for rotated labels on the x-axis
2015-10-27 23:52:56 +01:00
Daniel Cohen Gindi
8490f80d38 Implemented support for rotated labels on the x-axis 2015-10-27 22:30:57 +02:00
Philipp Jahoda
024cbbe1b0 Merge pull request #1144 from danielgindi/master
Fix missing argument causing an overflow loop
2015-10-23 20:09:46 +02:00
Daniel Cohen Gindi
548381bcf5 Fix missing argument causing an overflow loop 2015-10-23 16:49:12 +03:00
Philipp Jahoda
600496a3d5 Merged PRs 2015-10-23 14:34:53 +02:00
Philipp Jahoda
fd3b2a164a Merge pull request #1143 from danielgindi/highlight-value
Moved highlightTouch logic to highlightValue & deprecated highlightTouch
2015-10-23 14:34:09 +02:00
Philipp Jahoda
ed8720f29e Merge pull request #1142 from danielgindi/first-last-clipping-fix
Fixed the avoidFirstLastClipping feature
2015-10-23 14:33:38 +02:00
Philipp Jahoda
fd2add5f7a Merge pull request #1141 from danielgindi/combined-line-fix
Fixed a potential crash in CombinedChart with lineData and only one x…
2015-10-23 14:33:17 +02:00
Philipp Jahoda
5aafe92e06 Merge pull request #1140 from danielgindi/draw-circles-crash
Fixed potential crash when line data is empty
2015-10-23 14:33:02 +02:00
Daniel Cohen Gindi
0298122d20 Fixed the avoidFirstLastClipping feature 2015-10-23 15:16:14 +03:00
Daniel Cohen Gindi
9a3d2ad1ca Moved highlightTouch logic to highlightValue & deprecated highlightTouch 2015-10-23 15:12:36 +03:00
Daniel Cohen Gindi
25336b88dc Fixed potential crash when line data is empty 2015-10-23 15:05:10 +03:00
Daniel Cohen Gindi
58845ebd7d Fixed a potential crash in CombinedChart with lineData and only one x-value
Deployed same deltaX fix as in LineChart
2015-10-23 15:02:46 +03:00
Philipp Jahoda
f28c5ce67c Merge master 2015-10-23 14:00:15 +02:00
Philipp Jahoda
5f5950b441 Fix issue #1136 2015-10-23 13:58:43 +02:00
Philipp Jahoda
38ea630a7b Worked on example and realm data plotting 2015-10-23 00:15:46 +02:00
Philipp Jahoda
f26a20652a Minor changes 2015-10-22 14:22:22 +02:00
Philipp Jahoda
a0f901c63a More work on RealmLineDataSet 2015-10-22 14:14:52 +02:00
Philipp Jahoda
496f1b143a Minor changes on BaseDataSet 2015-10-22 14:04:34 +02:00
Philipp Jahoda
71cef8509b Setup example for realm 2015-10-22 13:59:09 +02:00
Philipp Jahoda
01b5826e73 Remove RealmLineData - no longer needed 2015-10-22 11:25:25 +02:00
Philipp Jahoda
aab951a5e0 Add Realm optional dependency 2015-10-22 11:24:18 +02:00
Philipp Jahoda
063b395b8c Realm example cleanup 2015-10-22 11:21:09 +02:00
Philipp Jahoda
3455343555 Example adjustments due to changes in library 2015-10-22 11:18:46 +02:00
Philipp Jahoda
6f8158041d Library cleanup and fix final compile errors 2015-10-22 10:58:28 +02:00
Philipp Jahoda
48a713affc Update FillFormatter with new interface 2015-10-22 10:19:32 +02:00
Philipp Jahoda
9b655d186a Implement ILineDataInterface 2015-10-22 10:18:52 +02:00
Philipp Jahoda
0d6dc4e44d Further implementation of interfaces 2015-10-21 17:29:15 +02:00
Philipp Jahoda
0307b7d76f Interface improvements, get rid of IBaseDataSet 2015-10-21 17:13:54 +02:00
Philipp Jahoda
7de07205ef More refactoring, introducing base interface 2015-10-21 17:00:31 +02:00
Philipp Jahoda
a38b9f5daf More refactoring due to interfaces 2015-10-21 16:47:37 +02:00
Philipp Jahoda
f264c813d7 Remove y-value-sum from DataSets as it is not needed 2015-10-21 14:58:18 +02:00
Philipp Jahoda
1482f9331e Major refactorings and implementation if line interface 2015-10-21 14:53:53 +02:00
Philipp Jahoda
83e8911290 Work on creating interfaces for realm 2015-10-21 11:00:44 +02:00
Philipp Jahoda
8065d17016 Critical fix in radarchart (issue #1121) 2015-10-19 14:20:30 +02:00
Philipp Jahoda
5190f8198c Code cleanup, documentation. 2015-10-16 17:05:15 +02:00
Philipp Jahoda
2e475b8d7d Improve touch-listener code style 2015-10-16 14:30:48 +02:00
Philipp Jahoda
f6fd3abaa1 Add docs 2015-10-16 12:07:12 +02:00
Philipp Jahoda
86e6a2e521 Remove unused variable 2015-10-16 12:06:24 +02:00
Philipp Jahoda
5cbc6b7245 Allow disabling tap-highlight while still being able to highlight programatically or via drag. 2015-10-16 12:05:49 +02:00
Philipp Jahoda
18e3b07b9d Add new highlighting method. 2015-10-15 18:16:03 +02:00
Philipp Jahoda
1fdb182720 Fix #924 2015-10-15 18:13:32 +02:00
Philipp Jahoda
4f508dd7c0 Merge pull request #1108 from NasaGeek/master
Make Entry class Parcelable.
2015-10-15 16:54:17 +02:00
Philipp Jahoda
c91507525b Remove chart.setHighlightEnabled(...) method because it led to confusions when no data was set (issue #1110). 2015-10-15 16:24:39 +02:00
Christopher Roberts
47b78b4308 Make Entry class Parcelable.
As an Entry object may contain arbitrary data (in the form of a single object),
I took the route of checking if that object is also parcelable and parceling it
if so. If the object is not parcelable, then an Exception is thrown.
2015-10-15 00:45:11 -04:00
Philipp Jahoda
7b27f47552 Merge PR 2015-10-13 20:15:29 +02:00
Philipp Jahoda
006e62a435 Minor changes 2015-10-13 20:15:18 +02:00
Philipp Jahoda
1615c4114e Merge pull request #1104 from danielgindi/minoffset_accessors
Allow getting/settings minOffset of the charts
2015-10-13 20:14:30 +02:00
Daniel Cohen Gindi
a7898f191a Allow getting/settings minOffset of the charts, instead of zeroing them out totally 2015-10-13 20:56:34 +03:00
Philipp Jahoda
a2ecebca0c add javadoc link 2015-10-11 23:13:40 +02:00
Philipp Jahoda
89ea5bd15c Update README.md 2015-10-11 19:39:01 +02:00
Philipp Jahoda
e3a7b0969b Update version. 2015-10-11 19:24:06 +02:00
Philipp Jahoda
1eae8e050e Improvements on piechart. 2015-10-11 19:23:16 +02:00
Philipp Jahoda
280cb5c648 Improve example 2015-10-11 16:47:55 +02:00
Philipp Jahoda
70e2c3899b Fix SpannableString PieChart center text issues (#993). 2015-10-11 16:34:50 +02:00
Philipp Jahoda
d15f253336 Work on supporting SpannableString for PieChart center text (#993). 2015-10-10 18:11:48 +02:00
Philipp Jahoda
657255e866 Additional fix 2015-10-09 18:53:27 +02:00
Philipp Jahoda
d1d590d48e Fix PieChart offset issue #1092 2015-10-09 18:46:36 +02:00
Philipp Jahoda
a4b099ef7b Merge pull request #1084 from danielgindi/flex-XAxisRenderer
Make the XAxisRenderer more flexible
2015-10-08 14:53:22 +02:00
Daniel Cohen Gindi
78441499b8 Make the XAxisRenderer more flexible
It is now possible to overwrite drawing the line or label of the LimitLine
2015-10-08 12:50:45 +03:00
Philipp Jahoda
7e4151e86e Additional fix 2015-10-07 22:51:45 +02:00
Philipp Jahoda
9dde506afb Fix IOOB exception 2015-10-07 22:48:03 +02:00
Philipp Jahoda
9fec6d0455 Merge 2015-10-07 21:46:16 +02:00
Philipp Jahoda
a277152d98 Moved references and performance to wiki. 2015-10-07 21:46:04 +02:00
Philipp Jahoda
01916b5a72 Update README.md 2015-10-07 21:45:18 +02:00
Philipp Jahoda
a2d7a6896d Merge 2015-10-06 23:04:45 +02:00
Philipp Jahoda
662a846d22 Merge PR + cleanup 2015-10-06 23:04:00 +02:00
Philipp Jahoda
4c06674012 Minor adjustments to PR 2015-10-06 19:47:28 +02:00
Philipp Jahoda
8c973d3de5 Merge pull request #1074 from georgelin422/master
Release Bitmap
2015-10-06 19:42:21 +02:00
Philipp Jahoda
0e379d31c1 Fix #1066 2015-10-06 17:37:59 +02:00
Philipp Jahoda
0d0c056681 Merged. 2015-10-06 17:12:28 +02:00
Philipp Jahoda
eae7df48a0 Add docs. 2015-10-06 17:12:08 +02:00
Philipp Jahoda
2dd38e2e06 Minor adjustments. 2015-10-06 17:09:37 +02:00
Philipp Jahoda
764ed2fd27 Update docs. 2015-10-06 09:11:51 +02:00
George Lin
cd04e50cb4 Release Bitmap in LineChartRenderer and PieChartRenderer to avoid OOM issues 2015-10-06 13:36:14 +08:00
Christian De Angelis
92ea5b3892 Fix disappearing line when zooming into LineChart 2015-10-05 13:48:13 -07:00
Philipp Jahoda
314a9d8104 Improvements to gesture start-end callbacks. 2015-10-04 20:18:39 +02:00
Philipp Jahoda
0e9495261b Allow callbacks on touch-start and end (#1069) 2015-10-04 18:15:14 +02:00
Philipp Jahoda
f2e3e13a14 Minor refactorings #1065 2015-10-04 12:07:09 +02:00
Philipp Jahoda
89b864f9b2 Code cleanup. 2015-10-04 11:40:10 +02:00
Philipp Jahoda
9c365ee36e Merge pull request #1050 from AngelOfMors/Feature
Added new features and minor adjustments
2015-10-04 11:31:47 +02:00
Philipp Jahoda
497beacf9a Merge pull request #1061 from danielgindi/highlight-animation-fix
Fix highlight animation bug in stacked bar chart
2015-10-02 00:03:12 +02:00
Daniel Cohen Gindi
8bb5e1ad54 Fix highlight animation bug in stacked bar chart 2015-10-02 00:47:07 +03:00
AngelOfMors
ade17f5328 Set custom Suffix for Large Value 2015-10-01 23:16:16 +06:00
Philipp Jahoda
10a392d4dc Merge pull request #1059 from danielgindi/features
Some new features
2015-10-01 18:39:16 +02:00
Philipp Jahoda
beee1269bb Merge pull request #1058 from danielgindi/bugfixes
Make skipWebLineCount consistent
2015-10-01 18:35:44 +02:00
Daniel Cohen Gindi
5b1b98fabc Avoid trying to draw cubic fill when there's no points
More info: https://github.com/danielgindi/ios-charts/issues/419
2015-10-01 18:25:45 +03:00
Daniel Cohen Gindi
5b31bb63fd Add support for a legend above the chart 2015-10-01 17:27:37 +03:00
Daniel Cohen Gindi
c5c19d4f91 Allow the minimum offset to be customized 2015-10-01 16:13:40 +03:00
Daniel Cohen Gindi
ae10a9fdb5 Make skipWebLineCount consistent 2015-10-01 15:55:06 +03:00
AngelOfMors
8cad9ec226 Merge remote-tracking branch 'PhilJay/master' into Feature 2015-10-01 11:27:32 +06:00
AngelOfMors
e4a6764361 Set custom Suffix for Large Value 2015-10-01 10:57:48 +06:00
Philipp Jahoda
5c06046ee2 Merge 2015-09-30 12:51:53 +02:00
Philipp Jahoda
507a75c006 Add possibility to remove first and last Entry from DataSet. 2015-09-30 12:49:49 +02:00
AngelOfMors
48619deabb Added in function formatNumber new param: separateChar.
Corrected params in Log.e
2015-09-30 13:59:41 +06:00
Philipp Jahoda
5effa1ed54 Update README.md 2015-09-25 23:21:14 +02:00
Philipp Jahoda
f11cd2caf8 Update README.md 2015-09-25 23:20:48 +02:00
Philipp Jahoda
c51f00e2a4 Allow custom Typeface for LimitLine (#1044). 2015-09-24 12:21:46 +02:00
Philipp Jahoda
6ae1eefc40 Fixed typo in classname 2015-09-20 11:18:33 +02:00
Philipp Jahoda
eb04293027 Update README.md 2015-09-20 11:08:44 +02:00
Philipp Jahoda
5a15715b25 New formatters for YAxis and XAxis with greater customizeability. 2015-09-20 10:21:13 +02:00
Philipp Jahoda
94dae2ef6f Remove comments 2015-09-15 12:47:31 +02:00
Philipp Jahoda
ba152072a6 Allow setting maximum y-scale factor. 2015-09-15 12:38:05 +02:00
Philipp Jahoda
2e6bfeb87e Add documentation. 2015-09-14 21:01:15 +02:00
Philipp Jahoda
996c79f568 Added feature for custom-formatting x-values #848. 2015-09-14 20:47:48 +02:00
Philipp Jahoda
e21e919aa9 Update README.md 2015-09-14 11:36:19 +02:00
Philipp Jahoda
e198679f76 Update README.md 2015-09-14 11:27:34 +02:00
Philipp Jahoda
2c28843fc1 Merged 2015-09-14 10:30:07 +02:00
Philipp Jahoda
2da68a792a Merged PR #959 2015-09-14 10:28:37 +02:00
Philipp Jahoda
766fb9a009 Refactoring of PR. 2015-09-14 09:56:14 +02:00
Philipp Jahoda
97a4d44d4a Merge pull request #759 from fmt-Println-MKO/master
Added possibility to skip labels and web-lines in RadarChart
2015-09-14 09:44:58 +02:00
Philipp Jahoda
a9cb766310 Allow FillFormatter for individual LineDataSets. 2015-09-12 18:27:39 +02:00
Philipp Jahoda
d93a5614d2 Update README.md 2015-09-12 11:29:06 +02:00
Philipp Jahoda
bfd781a4dc Update README.md 2015-09-12 11:16:13 +02:00
Philipp Jahoda
71965049c8 CombinedChart highlight improvements - WIP 2015-09-12 10:40:03 +02:00
Philipp Jahoda
239cf862b5 Fix #970 2015-09-12 09:25:41 +02:00
Philipp Jahoda
4b9af4c189 Fix #931. 2015-09-12 00:24:46 +02:00
Philipp Jahoda
0a0fca165c Added feature for dashed-highlight-lines (#938). 2015-09-11 21:43:41 +02:00
Philipp Jahoda
ff86e1772c Added more documentation. Possible fix of #927. 2015-09-11 20:50:35 +02:00
Philipp Jahoda
1c2b45e52c Formatting 2015-09-11 16:59:46 +02:00
Philipp Jahoda
f7f509ffb2 Added bounds check for issue #952 2015-09-11 16:58:42 +02:00
Philipp Jahoda
14810e3dfd Code cleanup, possible fix #1022 2015-09-11 16:55:55 +02:00
Philipp Jahoda
da394b779e Update readme. 2015-09-10 12:19:33 +02:00
Philipp Jahoda
3712d8589d Added markerview support for PieChart. 2015-09-10 12:19:09 +02:00
Philipp Jahoda
fcfea4e181 Fixed horizontal-markerview animation issues. 2015-09-10 12:07:44 +02:00
Philipp Jahoda
75be29ef03 Added markerview support for HorizontalBarChart (#1010) - still bugfixing needed. 2015-09-10 12:04:19 +02:00
Philipp Jahoda
16d011b2bf Update README.md 2015-09-10 10:46:58 +02:00
Philipp Jahoda
9ecce154e2 Update Projects_using_MPAndroidChart.txt 2015-09-08 10:45:43 +02:00
Philipp Jahoda
3235131b43 Merge pull request #1007 from danielgindi/combined-fix
Fixes an issue with X min/max in combined charts without bubble data
2015-09-08 10:44:46 +02:00
Philipp Jahoda
85738d6b2d Merge pull request #982 from xizzhu/update-build-tool
Updated build tools.
2015-09-08 10:44:04 +02:00
Daniel Cohen Gindi
fe95442413 Fixes an issue with X min/max in combined charts without bubble data 2015-09-05 20:57:36 +03:00
Philipp Jahoda
5a028c56a6 Merge pull request #987 from danielgindi/improvements-and-bugfixes
Improvements and bugfixes
2015-09-03 23:21:18 +02:00
Daniel Cohen Gindi
f9d8e365f0 Minor performance improvement to candle chart 2015-08-27 17:53:44 +03:00
Daniel Cohen Gindi
a7e9f19ecc Prevent pie slices from clipping when selected 2015-08-27 17:51:36 +03:00
Daniel Cohen Gindi
318c308d1b Avoid crashes when datasets are empty 2015-08-27 17:46:06 +03:00
Xizhi Zhu
ee183816b5 Updated build tools. 2015-08-26 14:14:37 +03:00
Philipp Jahoda
8c5e694f3f Merge pull request #964 from danielgindi/bugfixes 2015-08-19 20:36:24 +02:00
Daniel Cohen Gindi
9952c222fd Exclude label width when drawLabelsEnabled=false 2015-08-19 14:01:34 +03:00
Daniel Cohen Gindi
9eb6298960 Improved startAtZero logic to ignore spacing when needed
And still allow negative ranges when necessary (negative charts, stacked negative etc.)
2015-08-19 14:00:11 +03:00
Vladislav Bauer
72e4ec3c55 Remove redundant modifiers from interfaces 2015-08-16 06:13:46 +06:00
Philipp Jahoda
154997cbf7 Merge pull request #930 from SilverFoxA/patch-1 2015-08-13 11:25:37 +02:00
Philipp Jahoda
d32a3f6da0 Merge pull request #943 from danielgindi/y-axis-negative-fixes 2015-08-13 11:23:50 +02:00
Philipp Jahoda
2e96670900 Merge pull request #937 from danielgindi/limit-label-position 2015-08-13 04:15:07 +02:00
Daniel Cohen Gindi
5f8666b4ee Prevent yAxis in radar charts from bleeding into another x index on the other side 2015-08-12 16:13:36 +03:00
Daniel Cohen Gindi
35d6928422 Handle negative values when startAtZeroEnabled 2015-08-12 16:07:08 +03:00
Daniel Cohen Gindi
d51de23d8a More control over limit line labels' position 2015-08-11 16:41:02 +03:00
Abhijit Das
c9623fc74b Updated the list of projects
Added a new project that uses the following library.
2015-08-09 18:24:50 +05:30
Philipp Jahoda
62f192e886 Merge pull request #920 from dakotasanchez/valueformatter-fix
Do not serialize ValueFormatter interface member variable
2015-08-03 14:12:49 +02:00
Philipp Jahoda
3cf2210184 Merge pull request #919 from Doddophonique/patch-1
Update Projects_using_MPAndroidChart.txt
2015-08-03 14:12:23 +02:00
Dakota Sanchez
1a52eff833 Do not serialize ValueFormetter interface member variable 2015-08-02 21:50:55 -07:00
Davide Oddone
51f7940039 Update Projects_using_MPAndroidChart.txt 2015-08-02 23:50:53 +02:00
Philipp Jahoda
3e17def76c Update README.md 2015-08-01 00:10:42 +02:00
Philipp Jahoda
d473196b36 Update gradle and manifest 2015-07-31 23:59:40 +02:00
Philipp Jahoda
d722da590a Minor fix in BarChart 2015-07-31 22:36:36 +02:00
Philipp Jahoda
4aabae1de0 Allow setting transparency amout for transparent circle / hole (#902). 2015-07-29 18:39:21 +02:00
Philipp Jahoda
4bb9076deb Fix markerposition for grouped bars 2015-07-29 18:25:04 +02:00
Philipp Jahoda
a451672c43 Code cleanup (#900). 2015-07-28 19:08:44 +02:00
Philipp Jahoda
6dada9eaea Fixed issue concerning grouped-barchart (issue danielgindi/ios-charts#242) 2015-07-27 23:50:40 +02:00
Philipp Jahoda
39b4e0f70d Added outofbounds check in getEntryForHighlight (#898) 2015-07-27 23:10:45 +02:00
Philipp Jahoda
af9ac446cf More fixes. 2015-07-26 22:00:02 +02:00
Philipp Jahoda
464bbd9133 Fixed issue in vertical stacked bars 2015-07-26 20:39:23 +02:00
Philipp Jahoda
54023aaf56 Undo testing changes 2015-07-25 17:14:41 +02:00
Philipp Jahoda
44154c9564 Fix issue concerning combined-data reset (#851) 2015-07-25 17:13:47 +02:00
Philipp Jahoda
cd96679bda Update build.gradle 2015-07-25 00:16:00 +02:00
Philipp Jahoda
5ab7242aac update version 2015-07-25 00:08:42 +02:00
Philipp Jahoda
d07ceda265 Added feature that allows the label-count to be exactly set and evenly distributed over the y-axis. 2015-07-24 23:57:41 +02:00
Philipp Jahoda
a09d6a7ac1 Code cleanup & bugfixing. 2015-07-24 19:31:05 +02:00
Philipp Jahoda
bc2c4e2b68 Fixed #868 2015-07-24 19:03:59 +02:00
Philipp Jahoda
5d19d4b1bc Code cleanup. 2015-07-24 17:03:08 +02:00
Philipp Jahoda
8d529bd999 Fix markerview position when stacked-bars. 2015-07-24 17:02:01 +02:00
Philipp Jahoda
539a89446f Improvements and bugfixes concerning highlighting. 2015-07-24 16:31:36 +02:00
Philipp Jahoda
232e4a3e1a Improvements concerning value-drawing in barcharts. 2015-07-24 14:41:54 +02:00
Philipp Jahoda
3514aaedf9 Major improvements to stacked bars and bar highlighting. 2015-07-24 13:11:08 +02:00
Philipp Jahoda
374de0da4c Update README.md 2015-07-21 19:33:25 +02:00
Philipp Jahoda
3b089daa4c Minor fix in example. 2015-07-20 13:01:32 +02:00
Philipp Jahoda
10f30768cd Merge pull request #873 from danielgindi/bug-fixes
Bug fixes
2015-07-19 21:48:42 +02:00
Daniel Cohen Gindi
1f571a3d56 Removed redundant calls 2015-07-17 16:27:57 +03:00
Daniel Cohen Gindi
077b25446b Fixed a crash when removing an entry 2015-07-17 16:27:08 +03:00
Daniel Cohen Gindi
37e971ef8e Fixed negative stacked bars when there's more than two values in stack 2015-07-17 16:25:54 +03:00
Daniel Cohen Gindi
3fc5397fe3 startAtZeroEnabled killed that range when all values are negative 2015-07-17 16:19:42 +03:00
Daniel Cohen Gindi
9611421506 Maximum negative value was confused... 2015-07-17 16:16:53 +03:00
Josh Friend
8963d04e51 Add javadocs to artifacts
Also removed `deploy.gradle` which was added in #20 since it was unused and
moved the relevant javadoc targets to `build.gradle` instead.

Jitpack will host javadocs for you if a javadocs jar is built. The URL ends up
being something like: https://jitpack.io/com/github/PhilJay/MPAndroidChart/v2.1.0/javadoc/

Fixes #835
2015-07-13 15:54:48 -04:00
Philipp Jahoda
5ac58fc69c Update README.md 2015-07-12 13:41:37 +02:00
Philipp Jahoda
034e05997d Highlight indicator color, width and horizontal vertical can now be set (issue #814). 2015-07-11 23:58:44 +02:00
Philipp Jahoda
658aab0169 Merge pull request #844 from danielgindi/candle-shadow-color
Feature for making candle shadow color same as inc/dec
2015-07-09 21:44:57 +02:00
Philipp Jahoda
3419dff3eb Merge pull request #843 from danielgindi/minor-improvements
Minor improvements
2015-07-09 21:44:12 +02:00
Daniel Cohen Gindi
3e08a13ebc Fixed highlight arrow height to a sensible size in relation to its width 2015-07-09 21:13:19 +03:00
Daniel Cohen Gindi
0259079328 Avoid making too many multiplications in transformer
Each value takes 3 multiplications (3 matrices), when each Matrix is actually 9 values.
Now for one value, multiplying 3 time with the matrix (X *= M1, X *= M2, X *= M3)
When you take 10 values - it's 30 multiplications (and X9)

The new approach pre-multiplies the 3 matrices into 1. So:
First value is multiplied by the matrix, meaning 3 multiplications for the first value (M1 * M2 * M3 * X)
But for 10 values, we have 12 multiplications (M = M1 * M2 * M3, M * X1, M * X2, M * X3 ... M * X10)
2015-07-09 21:13:11 +03:00
Daniel Cohen Gindi
f502664158 Fixed highlights in negative stacked bar chart 2015-07-09 19:11:56 +03:00
Daniel Cohen Gindi
d739467cb2 Update yAxis size after scale/pan 2015-07-09 17:17:36 +03:00
Daniel Cohen Gindi
b5fb9e9761 addEntryOrdered to automatically place the entry in the correct index 2015-07-09 17:00:40 +03:00
Daniel Cohen Gindi
d54efba3f1 Fixed possible case of incorrect x/ymax after addEntry 2015-07-09 17:00:40 +03:00
Daniel Cohen Gindi
4d2495c902 Fixed a case where removeEntry(xIndex) removes the wrong entry 2015-07-09 17:00:40 +03:00
Daniel Cohen Gindi
91103911c0 Feature for making candle shadow color same as inc/dec 2015-07-09 16:43:15 +03:00
Philipp Jahoda
44e12a4e5e Update README.md 2015-07-05 16:35:53 +02:00
Philipp Jahoda
950d6a2354 Update Projects_using_MPAndroidChart.txt 2015-07-01 18:28:15 +02:00
Philipp Jahoda
bef5b0828c Merge pull request #818 from danielgindi/fix-inf-in-matrix
Fixed a crash after matrix transformation when only one bar is visible
2015-06-29 23:10:59 +02:00
Philipp Jahoda
31419f04f5 Merge pull request #817 from danielgindi/fix-nan-highlights
Fixed an issue where highlights disappear on multi-datasets
2015-06-29 23:10:55 +02:00
Daniel Cohen Gindi
3a9ad3db32 Fixed a crash after matrix transformation when only one bar is visible
Float.MIN_VALUE is not the minimum... -Float.MIN_VALUE is!
And of course we need to also account for a case where we are looping over zero elements.
2015-06-29 22:52:16 +03:00
Daniel Cohen Gindi
9a4c3287d1 Fixed an issue where highlights disappear on multi-datasets
They disappeared because of NaN values introduces in the previous iteration, when the previous dataset does not contain a yValue for that specific index.

(And a little refactoring to make this thing consistent across all appearances)
2015-06-29 21:55:38 +03:00
Philipp Jahoda
adc268cb9a Merge pull request #800 from danielgindi/dry-code
Removed duplicate code
2015-06-24 16:35:25 +02:00
Daniel Cohen Gindi
932405a2ef Removed duplicate code
Testing for `mInverted` in the main `if` or inner `if` do not have a meaning performance-wise, as in both cases it's just one boolean check.
2015-06-24 11:49:58 +03:00
Philipp Jahoda
a9e335079d Update README.md 2015-06-24 10:32:05 +02:00
Philipp Jahoda
6b5f38811a Merge pull request #798 from danielgindi/stacked-negative
Support for negative values in stacked vertical bar chart
2015-06-24 10:31:17 +02:00
Daniel Cohen Gindi
15b0578aa1 Support for negative values in stacked vertical bar chart 2015-06-24 10:57:25 +03:00
Daniel Cohen Gindi
4e8aaf4561 Refactored cnt into idx for clarification 2015-06-24 10:57:19 +03:00
Philipp Jahoda
43e9c26ef5 Refactored some stuff. 2015-06-22 23:00:25 +03:00
Philipp Jahoda
0c81966d67 Did some refactoring concerning SelInfo. 2015-06-22 22:59:48 +03:00
Daniel Cohen Gindi
b6ab5f2475 Allow NaN values in Radar chart (Skip points) 2015-06-22 22:59:43 +03:00
Daniel Cohen Gindi
10301a7359 Fix a crash where dataSetIndex is -1 2015-06-22 22:59:40 +03:00
Philipp Jahoda
6e456da042 Exclude un-highlightable datasets from being highlighted (issue #777). 2015-06-22 22:59:00 +03:00
Philipp Jahoda
8cf9336935 Added comparator for comparing entries by their x-index. 2015-06-22 22:58:51 +03:00
Philipp Jahoda
7f79c27469 Worked on negative values for stacked-bars, not yet complete, bugs in highlighting. 2015-06-22 22:57:12 +03:00
Philipp Jahoda
9a9c9ab2a6 Address moveView issue concerning refresh (issue #765) 2015-06-17 09:28:32 +02:00
Philipp Jahoda
633722f90b Legend code cleanup, fix issue #773 2015-06-17 09:14:40 +02:00
Philipp Jahoda
be95c277e9 Did some refactoring in the touch-listeners. 2015-06-13 14:40:57 +02:00
Matthias Koch
28c9eaf6bb added possibility to skip labels and WebLines in RadarChart 2015-06-13 01:01:59 +02:00
Philipp Jahoda
19a0e03efa Fix issue concerning highlighting (issue #745). 2015-06-12 18:34:37 +02:00
Philipp Jahoda
f3635b69f7 Fix issue that ignored y-offset on YAxis (issue #754). 2015-06-12 18:17:14 +02:00
Philipp Jahoda
978201c072 Fixed dashed line issue on x-axis grid (issue #755). 2015-06-12 18:13:16 +02:00
Philipp Jahoda
9db1b2f2d6 Add possiblity to set custom axis renderers (#752). 2015-06-12 11:17:18 +02:00
Philipp Jahoda
425cb61c03 Merge pull request #744 from danielgindi/master
Highlight bugfixes when y values are possibly omitted
2015-06-11 13:27:09 +02:00
Daniel Cohen Gindi
c92d32659b Bugfix: In some cases involving missing y-values, the highlight would not draw 2015-06-11 12:35:11 +03:00
Daniel Cohen Gindi
273828526f Bugfix: Highlights on xIndex that miss yValues were still highlighting 2015-06-11 12:34:34 +03:00
Philipp Jahoda
10fedf2e2b Fix issue #740 2015-06-11 08:17:22 +02:00
Philipp Jahoda
a4e1d26805 Update README.md 2015-06-09 09:24:02 +02:00
Philipp Jahoda
6e614c04c8 Indroducing chart minimum height of 50dp if no other height attribute is set (fix issue #566, #720) 2015-06-07 22:34:27 +02:00
Philipp Jahoda
04bb22b6ef Merge pull request #715 from itvdonsk/patch-1
Update Projects_using_MPAndroidChart.txt
2015-06-03 13:35:25 +02:00
Alexandr
6f652724d7 Update Projects_using_MPAndroidChart.txt 2015-06-03 13:05:42 +03:00
Philipp Jahoda
a018e65957 Merge & code cleanup. 2015-06-03 00:01:47 +02:00
Philipp Jahoda
73c60d58b9 Merge pull request #713 from danielgindi/max-x-scale
Allow limiting x-scaling by a maximum value
2015-06-02 23:31:47 +02:00
Philipp Jahoda
2a40c87240 Merge pull request #714 from danielgindi/highlight-enabled-per-ds
Allow to `setHighlightEnabled` on a single DataSet
2015-06-02 23:31:05 +02:00
Daniel Cohen Gindi
4ec22d7995 Allow to setHighlightEnabled on a single DataSet
https://github.com/danielgindi/ios-charts/issues/114
2015-06-02 23:53:51 +03:00
Daniel Cohen Gindi
83ad059966 Allow limiting x-scaling by a maximum value 2015-06-02 23:21:26 +03:00
Philipp Jahoda
f32cfd04d2 Code cleanup. 2015-06-01 23:43:52 +02:00
Philipp Jahoda
b765b90959 Merge pull request #710 from danielgindi/master
Improvements to legend drawing
2015-06-01 21:41:54 +02:00
Daniel Cohen Gindi
f57b0a623e Improvements to legend drawing
Line spacing is used correctly now
2015-06-01 22:23:01 +03:00
Philipp Jahoda
9f5123228f Merge. 2015-06-01 19:29:42 +02:00
Philipp Jahoda
913e92ae01 Minor changes. 2015-06-01 18:58:59 +02:00
Philipp Jahoda
ea80c0bf81 Merge pull request #695 from danielgindi/extra-offsets
Allow controlling the extra offsets caused by the legends
2015-06-01 18:58:12 +02:00
Philipp Jahoda
fde9ce83c6 Fix issue #625. 2015-05-31 21:44:51 +02:00
Philipp Jahoda
3e4ff0be58 Code cleanup. 2015-05-31 21:37:43 +02:00
Philipp Jahoda
e07bbeaff1 Merge pull request #702 from danielgindi/word-wrapping-legend
Word wrapping legend
2015-05-31 21:09:14 +02:00
Philipp Jahoda
0cdc041a00 Merge pull request #698 from danielgindi/legend-limits
Allow limiting the legend size based on a percentage of the chart size
2015-05-31 21:09:09 +02:00
Philipp Jahoda
9fdd30bbe0 Merge pull request #694 from danielgindi/auto-scale-y-axis
Auto scale y axis
2015-05-31 21:08:15 +02:00
Daniel Cohen Gindi
66068538ce Added the auto-scale to the options in the demo app 2015-05-28 16:01:49 +03:00
Daniel Cohen Gindi
bc8b7105d8 Support for word wrapping legend (below chart) 2015-05-28 15:57:10 +03:00
Daniel Cohen Gindi
87781bac31 Allow limiting the legend size based on a percentage of the chart size 2015-05-27 19:11:46 +03:00
Philipp Jahoda
2ac47eadaf Merge pull request #693 from danielgindi/hide-xlabels-bugfix
Offset for labels shouldn't be calculated when they are disabled
2015-05-27 09:39:50 +02:00
Daniel Cohen Gindi
1ee9fa7978 Allow controlling the extra offsets caused by the legends 2015-05-27 10:29:06 +03:00
Daniel Cohen Gindi
8760d9f2ff Offset for labels shouldn't be calculated when they are disabled 2015-05-27 10:15:27 +03:00
Daniel Cohen Gindi
8040ebe52e autoScaleMinMaxEnabled feature 2015-05-27 00:26:22 +03:00
Daniel Cohen Gindi
8f0c29f34f Fixed an issue where combined chart calculated min/max for only one of the Data objects 2015-05-27 00:26:10 +03:00
Philipp Jahoda
16685844ff Merge pull request #683 from Pitel/patch-1
Fix stack size on values change
2015-05-26 11:19:52 +02:00
Ing. Jan Kaláb
893c8f8a76 Update BarEntry.java 2015-05-25 13:51:04 +02:00
Philipp Jahoda
79af9181c3 Minor fix. 2015-05-25 00:03:32 +02:00
Philipp Jahoda
328db4329b Code cleanup and minor changes to custom & extra legend. 2015-05-25 00:02:52 +02:00
Philipp Jahoda
bdc3485843 Fixed issue concerning RadarChart offsets (issue #679). 2015-05-24 19:10:17 +02:00
Philipp Jahoda
78ca707f27 Remove unnecessary code from linechart. 2015-05-24 18:56:39 +02:00
Philipp Jahoda
1330fc4a3f Fix issue in piechartrenderer. 2015-05-24 15:31:40 +02:00
Philipp Jahoda
6224440a82 Merge pull request #671 from danielgindi/wordwrap
Support for word wrapping center text in pie chart
2015-05-23 15:24:37 +02:00
Philipp Jahoda
cd68c6f648 Merge legend customization. 2015-05-23 15:23:25 +02:00
Philipp Jahoda
7c57220794 Merge pull request #657 from danielgindi/legend-customization
Legend customization
2015-05-23 15:11:20 +02:00
Daniel Cohen Gindi
b4469dc9b4 Support for word wrapping center text in pie chart (default: false) 2015-05-21 21:57:50 +03:00
Daniel Cohen Gindi
13e0b11807 Allow a null label for a DataSet 2015-05-21 17:43:31 +03:00
Daniel Cohen Gindi
8be106f49e No need for the extra call to getLabel 2015-05-21 17:43:11 +03:00
Daniel Cohen Gindi
c3cae65b39 Allow custom legend data 2015-05-19 12:10:09 +03:00
Daniel Cohen Gindi
d8af1923fc Allow adding extra labels to the legend, after the calculated ones 2015-05-19 12:10:09 +03:00
Philipp Jahoda
1afbe59f72 Considering feature of rounded pie-slices, not complete yet. 2015-05-08 19:55:55 +02:00
Philipp Jahoda
40f2c6d776 Minor changes. 2015-05-08 19:20:57 +02:00
Philipp Jahoda
8cdae745b1 Merge pull request #629 from danielgindi/master
Update contentRect when resizing
2015-05-08 19:16:56 +02:00
Daniel Cohen Gindi
35c5bec02a Update contentRect when resizing 2015-05-07 15:40:35 +03:00
Philipp Jahoda
d8cb907465 Minor fix in CombinedData. 2015-05-06 12:14:54 +02:00
Philipp Jahoda
d94bf5bc0d Update README.md 2015-05-05 18:29:45 +02:00
Philipp Jahoda
2eca41fc8f Fixed BubbleChart issue. 2015-05-05 09:04:52 +02:00
Philipp Jahoda
710d5de4e6 Minor fixes on BubbleChart. 2015-05-04 23:43:20 +02:00
Philipp Jahoda
fb2439da71 Merge pull request #618 from danielgindi/master
Minor improvements to Bubble chart
2015-05-04 22:06:53 +02:00
Daniel Cohen Gindi
3382c2f1af Minor improvements to Bubble chart 2015-05-04 22:34:46 +03:00
Philipp Jahoda
39a9d2ea29 Fixed issue concerning elevation (issue #492, #512). 2015-05-04 17:06:24 +02:00
Philipp Jahoda
a34e52ccc9 Merge readme. 2015-05-04 16:23:04 +02:00
Philipp Jahoda
02b6e35664 Update README.md 2015-05-04 16:22:42 +02:00
Philipp Jahoda
df2a11d8ad Updated screenshots. 2015-05-04 16:22:11 +02:00
Philipp Jahoda
faeac0cc0b Update README.md 2015-05-04 16:11:25 +02:00
Philipp Jahoda
2576308412 Added bubblechart screenshot. 2015-05-04 16:09:24 +02:00
Philipp Jahoda
83cb3eec70 Minor changes on BubbleChart. 2015-05-04 15:58:42 +02:00
Philipp Jahoda
82d8881e9d Merge pull request #617 from danielgindi/master
Minor bug fix to cubic line rendering while scrolling
2015-05-03 22:35:47 +02:00
Daniel Cohen Gindi
207af8993a Minor bug fix to cubic line rendering while scrolling 2015-05-03 23:04:04 +03:00
Philipp Jahoda
1c5819274d Worked on integrating BubbleChart into CombinedChart. 2015-05-03 11:18:24 +02:00
Philipp Jahoda
1301f1189e Minor fix in large valueformatter. 2015-05-02 19:55:58 +02:00
Philipp Jahoda
6a60e2c94b Merged recent PRs. 2015-05-02 19:51:31 +02:00
Philipp Jahoda
c7b6e07bef Merge pull request #616 from danielgindi/master
Improvements for radial chart deceleration
2015-05-02 19:44:41 +02:00
Daniel Cohen Gindi
fb70ef74ae An improved velocity tracker for radial charts + typo fixes 2015-05-02 20:38:04 +03:00
Daniel Cohen Gindi
b78f4e8071 Theoretically these values could be negative 2015-05-02 20:38:04 +03:00
Philipp Jahoda
478c37ee3b Merge pull request #614 from aint/large_value_formatter
Large value formatter now can appends a specified text to the result string
2015-05-02 17:27:22 +02:00
Oleksandr Tyshkovets
e16c2de7de Large value formatter now can appends a specified text to the result string 2015-05-01 21:28:24 +03:00
Philipp Jahoda
0b25bd3cbf Update README.md 2015-05-01 10:48:21 +02:00
Philipp Jahoda
d4b2422103 Minor improvements to recent PR. 2015-05-01 10:27:00 +02:00
Philipp Jahoda
f629df992b Merge pull request #612 from danielgindi/decelerate
Deceleration after dragging
2015-05-01 09:57:31 +02:00
Philipp Jahoda
e3af5cac01 Merge pull request #611 from danielgindi/minor-improvements
Minor improvements to Bubble chart
2015-05-01 09:54:53 +02:00
Daniel Cohen Gindi
1e59b095e0 Deceleration after dragging in Line and Pie/Radar charts 2015-05-01 09:38:43 +03:00
Daniel Cohen Gindi
21cb642441 Minor improvements to Bubble chart 2015-05-01 07:24:42 +03:00
Philipp Jahoda
fe9f904c35 Minor improvements to BubbleChart. 2015-05-01 00:00:09 +02:00
Philipp Jahoda
4ba73f4c47 Merge pull request #608 from danielgindi/bubble-chart
Bubble chart implementation, ported from the iOS version :-)
2015-04-30 23:32:59 +02:00
Philipp Jahoda
5d5f8348f4 Merge pull request #607 from danielgindi/minor-bugfixes
Minor bugfixes
2015-04-30 23:32:16 +02:00
Philipp Jahoda
872e121a9c Minor bugfix concerning addXValue(). 2015-04-30 23:30:51 +02:00
Daniel Cohen Gindi
ce069c60c6 Prevent labels from drawing way out of bounds 2015-05-01 00:17:15 +03:00
Daniel Cohen Gindi
3e5d4e6e6e Safety checks 2015-05-01 00:16:15 +03:00
Daniel Cohen Gindi
9a2d5fcc8b Bubble chart implementation, ported from the iOS version :-) 2015-05-01 00:14:16 +03:00
Philipp Jahoda
24a3b1cdef Enhanced possibility to set the number of x-labels to be skipped upon drawing. 2015-04-30 19:47:51 +02:00
Philipp Jahoda
36fb5734bd Merge pull request #606 from danielgindi/custom-xaxis-modulus
Allow custom axis label modulus
2015-04-30 19:21:15 +02:00
Daniel Cohen Gindi
1a7413f550 Allow custom axis label modulus 2015-04-30 19:30:33 +03:00
Philipp Jahoda
f887144e00 Update README.md 2015-04-30 13:08:58 +02:00
Philipp Jahoda
24ad450813 Update README.md 2015-04-30 13:08:32 +02:00
Philipp Jahoda
9e100286f9 Update README.md 2015-04-30 13:07:51 +02:00
Philipp Jahoda
674cd8b975 Major bugfixes, fixed issue concerning x-axis labels jumping. 2015-04-30 00:05:07 +02:00
Philipp Jahoda
a74d1d7bfb Merge pull request #590 from Evisceration/master
Readme: add notice about Proguard
2015-04-27 23:57:25 +02:00
Alexander Martinz
d86a5cbcb2 Readme: add notice about Proguard
* When using proguard and NOT whitelisting MPAndroidChart, some functionality
    will break like animate methods.

Change-Id: If329842301eb41f7f713c1148b5ca364917e3d7a
Signed-off-by: Alexander Martinz <eviscerationls@gmail.com>
2015-04-25 17:49:09 +02:00
Philipp Jahoda
f86abe6bf8 Merge pull request #581 from danielgindi/pie-chart-legend-offset
Consider yOffsest when rendering pie-chart legend
2015-04-25 00:25:07 +02:00
Philipp Jahoda
591fd379a9 Merge pull request #580 from danielgindi/cubic-line-animation-fix
Sync cubic line drawing to animation
2015-04-25 00:24:56 +02:00
Daniel Cohen Gindi
e9f8ae6385 Consider yOffsest when rendering pie-chart legend 2015-04-23 03:50:21 +03:00
Daniel Cohen Gindi
3d9d292736 Sync cubic line drawing to animation 2015-04-23 03:34:17 +03:00
Philipp Jahoda
52d58c7098 Now highlighting values via drag gesture is possible (issue #567, #106). 2015-04-20 11:59:20 +02:00
Philipp Jahoda
5b6ab3cf32 Fixed issue that caused candle-body not to be drawn. 2015-04-17 19:52:55 +02:00
Philipp Jahoda
80d32174d8 Merge pull request #565 from mesropd/fixCubicFillBug
Fix cubic fill bug for the LineChart
2015-04-17 12:31:41 +02:00
mesrop_davoyan
e249a15c58 - fix cubic fill bug for the LineChart 2015-04-17 13:23:16 +04:00
Philipp Jahoda
497bc296cf Additional fix. 2015-04-17 10:12:54 +02:00
Philipp Jahoda
2aa96b156c Merged. 2015-04-17 10:11:06 +02:00
Philipp Jahoda
bff6171819 Fixed issue concerning drawbitmap (issue #554). 2015-04-17 10:10:27 +02:00
Philipp Jahoda
055050b4e2 Enhanced customizability of description text (issue #563). 2015-04-17 10:01:06 +02:00
Philipp Jahoda
55cc174732 Update README.md 2015-04-13 18:33:28 +02:00
Philipp Jahoda
c6980d40f8 Merge pull request #545 from dexterbg/master
Extended gesture listener by translate/drag callback
2015-04-12 21:54:38 +02:00
Philipp Jahoda
65c6189bba Merge pull request #544 from danielgindi/viewport-bugs
Viewport bugfixes in LineChart
2015-04-12 21:52:44 +02:00
Philipp Jahoda
847e6c3545 Update README.md 2015-04-12 21:36:33 +02:00
Michael Balzer
9531ba6989 Merge branch 'master' of https://github.com/PhilJay/MPAndroidChart.git
Conflicts:
	MPChartLib/src/com/github/mikephil/charting/renderer/LineChartRenderer.java
	MPChartLib/src/com/github/mikephil/charting/renderer/PieChartRenderer.java
2015-04-12 19:56:53 +02:00
Michael Balzer
1b351934e2 - Fixed LineChart & PieChart data rendering bug on resized views 2015-04-12 19:43:07 +02:00
Michael Balzer
ca256ace28 - Extended gesture listener by translate/drag callback
- Disabled debug log output in ViewPortHandler
2015-04-12 18:58:20 +02:00
Daniel Cohen Gindi
791a487456 Bugfix: Last label were sometimes invisible due to rounding errors 2015-04-12 16:57:46 +03:00
Daniel Cohen Gindi
5d84b0055a Bugfix: Consider viewport for second point in cubic line 2015-04-12 16:57:34 +03:00
Philipp Jahoda
aa7cbce033 Fixed issue concerning transparent circle when animating (issue #543). 2015-04-12 14:18:53 +02:00
Philipp Jahoda
43418902cd Fixed bug concerning cubic-lines (issue #528). 2015-04-11 13:12:10 +02:00
Philipp Jahoda
6b0a32aa90 More fixes concerning Animation easing. 2015-04-11 11:08:47 +02:00
Philipp Jahoda
80525905dc Worked on animation easing. 2015-04-11 11:00:42 +02:00
Philipp Jahoda
4a385ba5f3 Update README.md 2015-04-10 17:14:19 +02:00
Philipp Jahoda
2eb93e75dd Update README.md 2015-04-10 17:13:48 +02:00
Philipp Jahoda
b495c7a432 Update README.md 2015-04-10 16:53:29 +02:00
Philipp Jahoda
b40964b735 Fixed issues concerning PieChart (issue #519, #527, #535). 2015-04-10 16:35:52 +02:00
Philipp Jahoda
9e65dca8aa Merge pull request #533 from mesropd/stableYVals
Stable reference for the yVals array
2015-04-09 23:52:21 +02:00
Philipp Jahoda
3561cb0b79 Update README.md 2015-04-09 23:28:01 +02:00
Philipp Jahoda
79bd4456f4 Merged. 2015-04-09 15:31:16 +02:00
Philipp Jahoda
721ee5f3ca Fixed issue concerning linechart crash (issue #529). 2015-04-09 15:30:48 +02:00
Philipp Jahoda
c962926b3e Fixed issue concerning screen rotation (issue #531). 2015-04-09 14:31:26 +02:00
mesrop_davoyan
b9d22b4b3b - stable reference for the yVals array 2015-04-09 14:06:46 +04:00
Philipp Jahoda
1befb9a88d Worked on improving animation easing, better performance. 2015-04-09 09:55:55 +02:00
Philipp Jahoda
75cc593864 Worked on simplifying animation easing. 2015-04-08 23:57:55 +02:00
Philipp Jahoda
b6edbece67 Update gradle and manifest. 2015-04-08 13:38:44 +02:00
Philipp Jahoda
cbaa52383b Update Projects_using_MPAndroidChart.txt 2015-04-08 09:49:33 +02:00
Philipp Jahoda
1b542a61f9 Update example gradle and manifest. 2015-04-07 21:39:43 +02:00
Philipp Jahoda
8e5f3b1513 Update gradle and maven dependency. 2015-04-07 17:09:28 +02:00
Philipp Jahoda
a0347bb782 Merged. 2015-04-07 17:02:48 +02:00
Philipp Jahoda
49ca2ad0e3 Added example custom easing function. 2015-04-07 17:02:25 +02:00
Philipp Jahoda
231a34f49f Update README.md 2015-04-07 16:55:52 +02:00
Philipp Jahoda
10c539c3dd Minor bugfix in line animation. 2015-04-07 16:51:16 +02:00
Philipp Jahoda
fa1c6d5039 Documentation. 2015-04-07 16:46:48 +02:00
Philipp Jahoda
5dd5ab4b37 Code cleanup. 2015-04-07 15:52:17 +02:00
Philipp Jahoda
5de182214f Merge pull request #525 from danielgindi/master
Animation improvements
2015-04-07 15:43:35 +02:00
Daniel Cohen Gindi
32799d42bc Default animation curve reverted 2015-04-07 14:49:17 +03:00
Daniel Cohen Gindi
9a8e63b4a7 Animation improvements 2015-04-07 14:39:54 +03:00
Philipp Jahoda
6713dfc352 Merge pull request #524 from danielgindi/animation-curves
Support for animation easing functions. Animation support for all Android versions.
2015-04-07 12:20:38 +02:00
Daniel Cohen Gindi
54b92ffc62 Support for animation easing functions
Demonstrated in PieChartActivity
Animations are now supported on all Android versions
2015-04-07 12:43:55 +03:00
Philipp Jahoda
338afb31d1 Fix issue #521 & address issue #520. 2015-04-06 18:54:07 +02:00
Philipp Jahoda
0c45981aad Merged PR, code cleanup. 2015-04-05 23:20:49 +02:00
Philipp Jahoda
8f62fda714 Merge pull request #515 from dexterbg/master
LimitLine support for XAxis
2015-04-05 22:59:32 +02:00
Philipp Jahoda
9c112a2c64 Merge pull request #516 from danielgindi/line-viewport-range-fix
Bugfixes.
2015-04-05 22:58:21 +02:00
Michael Balzer
29fdd5cd43 - LimitLine support for XAxis
- centerViewTo method for BarLineChartBase
2015-04-05 22:29:20 +02:00
Daniel Cohen Gindi
71e3ca1b77 Bugfix: Line chart was not considering visible range when animating 2015-04-05 22:53:09 +03:00
Daniel Cohen Gindi
ebdcfc0899 Do not cut off end-values because of Int rounding 2015-04-05 21:53:48 +03:00
Daniel Cohen Gindi
809b44c69e Fixed searching algorithms 2015-04-05 21:52:34 +03:00
Philipp Jahoda
d9ae5fae0a Fixed bug that caused single entries to disappear when startatzero = false (issue #511). 2015-04-04 12:29:19 +02:00
Philipp Jahoda
83eadc108b Minor changes to PR. 2015-04-03 21:33:44 +02:00
Philipp Jahoda
922e479364 Merge pull request #509 from mesropd/candleColors
Implement customizing colors and paint styles for increasing and decreasing candle entries
2015-04-03 21:10:19 +02:00
mesrop_davoyan
5440639e3c - implement coloring functionality for CandleDataSet class 2015-04-03 17:06:30 +04:00
Philipp Jahoda
03a6c49798 Added feature to color candle shadow lines (issue #507). 2015-04-03 14:45:54 +02:00
Philipp Jahoda
72170fd548 Added listener for chart scale gesture. 2015-04-03 14:35:08 +02:00
Philipp Jahoda
959c4e0d36 Fixed bug in dashed LimitLine (issue #494). 2015-04-02 19:47:53 +02:00
Philipp Jahoda
cbfd198e74 Added access methods to scheduled jobs. 2015-04-02 14:54:08 +02:00
Philipp Jahoda
a4272e2646 Fixed bug in viewport-offset custom setting. 2015-04-02 14:50:58 +02:00
Philipp Jahoda
dabcaa7ee6 Fixed no data bug. 2015-04-02 14:18:46 +02:00
Philipp Jahoda
d881e5f411 Bugfixes concerning viewport modifications. Introduced jobs that await the complete setup of the chart (waiting for onSizeChanged(...)) before modifying it's viewport. 2015-04-02 14:03:14 +02:00
Philipp Jahoda
0809d3d667 LimitLines can now be drawn behind or in front of the actual data (issue #493). 2015-04-02 12:56:30 +02:00
Philipp Jahoda
34fbeb5882 Improved grid dashed lines. 2015-04-02 00:32:27 +02:00
Philipp Jahoda
7d9dcdbc80 Merge pull request #499 from mesropd/dashGridLines
Implement dash path effect for the grid lines
2015-04-02 00:25:33 +02:00
Philipp Jahoda
b6a2d662d7 Fixed issue concerning no data text (issue #473). 2015-04-02 00:24:53 +02:00
Mesrop Davoyan
bed8d788fa - implement dash path effect for the grid lines 2015-04-01 23:12:33 +04:00
Philipp Jahoda
1000b5d9b1 Merge pull request #495 from danielgindi/inverted-bugs
Fixed inverted axis bugs.
2015-04-01 19:19:51 +02:00
Daniel Cohen Gindi
b8cee9dc64 Corrected drawing of labels on when axis is inverted 2015-04-01 17:57:31 +03:00
Daniel Cohen Gindi
787a481836 Fixed dragging inverted horizontal bar chart 2015-04-01 17:49:41 +03:00
Philipp Jahoda
92d15d80bd Fixed issue concerning scatterchart color (issue #490). 2015-03-30 13:40:01 +02:00
Philipp Jahoda
2572740072 Fixed bug concerning PieChart value drawing. 2015-03-30 00:10:41 +02:00
Philipp Jahoda
fef49b90cb Worked on inverted HorizontalBarChart. 2015-03-29 14:06:11 +02:00
Philipp Jahoda
05c8f9cc59 Fixed bugs concerning inverted BarChart. 2015-03-29 12:30:01 +02:00
Philipp Jahoda
0b6b14fa36 Added share buttons. 2015-03-28 13:41:43 +01:00
Philipp Jahoda
ad4b340ea6 Merge 2015-03-28 13:25:57 +01:00
Philipp Jahoda
120a3b5bb4 Update icons. 2015-03-28 13:25:42 +01:00
Philipp Jahoda
45b5719bba Update README.md 2015-03-28 11:56:24 +01:00
Philipp Jahoda
89f4a406c7 Update README.md 2015-03-28 11:53:01 +01:00
Philipp Jahoda
6ace2785f1 Merge. 2015-03-28 11:51:37 +01:00
Philipp Jahoda
456626f846 Added share images. 2015-03-28 11:51:17 +01:00
Philipp Jahoda
e0ff2af2f6 Update README.md 2015-03-27 00:21:50 +01:00
Philipp Jahoda
66d80a07bf Fixed issue concerning all equal values (issue #409). 2015-03-26 19:11:46 +01:00
Philipp Jahoda
64f6ab0a41 Fixed issue concerning PieChart center text (issue #467). 2015-03-25 21:28:41 +01:00
Philipp Jahoda
fba34b19b6 Code cleanup and minor fixes. 2015-03-25 19:03:37 +01:00
Philipp Jahoda
44eac7b564 Merge pull request #469 from danielgindi/rtl-legend
Rtl legend & left-of-chart legend
2015-03-25 18:53:12 +01:00
Daniel Cohen Gindi
2cfa247267 Support for left-of-chart legends 2015-03-25 17:51:39 +02:00
Daniel Cohen Gindi
e87a6921d8 Do not add extra spacing after last legend element
This affected mainly RTL legend, but occasionally cause more spacing than the xOffset set for the legend even for LTR.
2015-03-25 17:48:59 +02:00
Daniel Cohen Gindi
759f4d8b64 Support RightToLeft direction for legend 2015-03-25 17:48:59 +02:00
Philipp Jahoda
c0af43cd63 Merged PRs, minor bugfixes. 2015-03-24 22:18:49 +01:00
Philipp Jahoda
2e3687afe6 Merge pull request #457 from danielgindi/master
Fix PieChart bugs considering phaseY
2015-03-24 21:59:26 +01:00
Philipp Jahoda
e4598fe7e2 Merge pull request #463 from danielgindi/legend-convenience
Allow configuring the legend before setting data
2015-03-24 21:57:32 +01:00
Philipp Jahoda
5987862d46 Merge pull request #460 from danielgindi/element-count-bugs
Element count bugs
2015-03-24 21:43:41 +01:00
Philipp Jahoda
0b867a07a7 Merge pull request #468 from danielgindi/set-dataset-label
Allow setting the label for legend
2015-03-24 21:42:57 +01:00
Daniel Cohen Gindi
829f93ab16 Allow setting the label for legend 2015-03-24 09:34:48 +02:00
Daniel Cohen Gindi
d2483fa054 Allow configuring the legend before setting data
This will allow a proper flow of code- configuring and then setting data and rendering
2015-03-22 21:07:06 +02:00
Philipp Jahoda
fe8cfcea27 Update README.md 2015-03-22 09:15:57 +01:00
Philipp Jahoda
a0c091ee41 Update README.md 2015-03-22 09:13:22 +01:00
Philipp Jahoda
6ac95c9baa Update README.md 2015-03-21 22:45:17 +01:00
Daniel Cohen Gindi
83dcabfe01 Missing one xAxis entry 2015-03-20 10:18:26 +02:00
Daniel Cohen Gindi
44b75a6b5d Missing one xAxis entry 2015-03-20 09:19:26 +02:00
Daniel Cohen Gindi
699a9f4ce9 Missing one xAxis entry 2015-03-20 09:19:01 +02:00
Daniel Cohen Gindi
66f97a25e0 Missing one xAxis entry 2015-03-20 09:17:48 +02:00
Daniel Cohen Gindi
efdd4f73e7 Consider anim phase on pie taps for highlights
To fix a case where tapping a slice during Y axis animation highlights the wrong slice
2015-03-20 08:42:01 +02:00
Daniel Cohen Gindi
e00aad12fb Consider anim phase when drawing pie highlights 2015-03-20 08:38:17 +02:00
Philipp Jahoda
633a5318f7 Update README.md 2015-03-19 21:40:42 +01:00
Philipp Jahoda
c42b88082d Merged. 2015-03-19 21:37:32 +01:00
Philipp Jahoda
304415a84c Added methods for getting highest and lowest visible x-index. 2015-03-19 21:37:19 +01:00
Philipp Jahoda
45cedbc870 Update README.md 2015-03-19 20:01:54 +01:00
Philipp Jahoda
56c7c1105b Update README.md 2015-03-19 19:59:55 +01:00
Philipp Jahoda
4bd9efc1e9 Minor bugfix. 2015-03-19 19:17:42 +01:00
Philipp Jahoda
d4ab6598d6 Merge. 2015-03-19 19:04:56 +01:00
Philipp Jahoda
03a08220fb Update feature graphic. 2015-03-19 19:04:37 +01:00
Philipp Jahoda
f1fd3d9324 Update README.md 2015-03-19 19:03:17 +01:00
Philipp Jahoda
524bc2530d Update README.md 2015-03-19 19:01:02 +01:00
Philipp Jahoda
908255b0ad Merge readme. 2015-03-19 18:59:33 +01:00
Philipp Jahoda
052c550c29 Created new feature-graphic. 2015-03-19 18:59:12 +01:00
Philipp Jahoda
5de0244a6a Update README.md 2015-03-19 18:07:55 +01:00
Philipp Jahoda
02d3a5dcf9 Merge pull request #454 from Maragues/drawBarShadow-default
Change drawBarShadow default value to false.
2015-03-19 17:06:08 +01:00
Maragues
38fdac761d drawBarShadow is false by default. Set variable accessor in BarChart to private 2015-03-19 17:02:19 +01:00
Philipp Jahoda
2b932395d5 Code cleanup. 2015-03-19 16:45:48 +01:00
Philipp Jahoda
0ee1299c4d Merged. 2015-03-19 16:40:43 +01:00
Philipp Jahoda
d7455422c4 Minor changes in line-renderer. 2015-03-19 16:28:17 +01:00
Philipp Jahoda
084b7e0f66 Changes to address issue #403. 2015-03-16 12:31:14 +01:00
Philipp Jahoda
0fb67f31ec Fixed issue concerning gestures. 2015-03-16 12:02:29 +01:00
Philipp Jahoda
0cb2272f38 Fixed min-max issue (#396). 2015-03-16 11:55:53 +01:00
Philipp Jahoda
8ea97dbd1f Merged. 2015-03-15 18:39:09 +01:00
Philipp Jahoda
08e5f5f3ea Fixed LimitLine issue in HorizontalBarChart (issue #439). 2015-03-15 18:38:42 +01:00
Philipp Jahoda
d57a86e8f2 Update README.md 2015-03-14 10:37:12 +01:00
Philipp Jahoda
0b153157de Update README.md 2015-03-13 22:12:51 +01:00
Philipp Jahoda
ddf205f57b Minor bugfix. 2015-03-13 20:52:36 +01:00
Philipp Jahoda
a543bb2b36 Improved CombinedChart. 2015-03-13 11:47:04 +01:00
Philipp Jahoda
67f0889723 Example cleanup. 2015-03-12 16:41:34 +01:00
Philipp Jahoda
f5d6a477de Added convenience methods. Code cleanup. 2015-03-12 16:37:41 +01:00
Philipp Jahoda
49373ac80e Merged readme. 2015-03-11 22:29:23 +01:00
Philipp Jahoda
bdae6f5c0b Update README.md 2015-03-11 22:28:10 +01:00
Philipp Jahoda
94ee5e8d79 Update manifest and build.gradle. 2015-03-11 22:14:08 +01:00
Philipp Jahoda
173c7e10de Bugfixes. 2015-03-11 22:12:00 +01:00
Philipp Jahoda
cf10bf9c6d General bugfixes. 2015-03-11 14:41:44 +01:00
Philipp Jahoda
26f8f655fb Introducing the clearValues() method that only removes entries but not x-values. 2015-03-11 12:25:46 +01:00
Philipp Jahoda
4484809ff7 More bugfixes. 2015-03-11 11:50:17 +01:00
Philipp Jahoda
191ec27d2c Bugfixes in LineChart. 2015-03-11 11:35:00 +01:00
Philipp Jahoda
bdac172d2e Fixed some issues with barchart and piechart. 2015-03-11 00:00:12 +01:00
Philipp Jahoda
6f74b3dff7 Merge readme. 2015-03-10 11:33:01 +01:00
Philipp Jahoda
4dff747b02 Worked on Cubic-LineChart. 2015-03-10 11:32:42 +01:00
Philipp Jahoda
f2945ec0ef Improved performance of cubic-lines. 2015-03-09 13:26:18 +01:00
Philipp Jahoda
bd6b122303 Update README.md 2015-03-08 15:21:34 +01:00
Philipp Jahoda
f4e58ba599 Worked on CandleStick chart. 2015-03-08 15:09:27 +01:00
Philipp Jahoda
a493362de7 Update README.md 2015-03-08 14:41:51 +01:00
Philipp Jahoda
af1ed0fb15 Update README.md 2015-03-08 14:36:06 +01:00
Philipp Jahoda
1be6751615 Update README.md 2015-03-08 14:33:48 +01:00
Philipp Jahoda
32efcf18fb Update README.md 2015-03-08 11:43:51 +01:00
Philipp Jahoda
e58b9f7951 Worked on ScatterChart performance. 2015-03-08 10:46:17 +01:00
Philipp Jahoda
7735226b90 Worked on LineChart Performance. 2015-03-08 01:01:04 +01:00
Philipp Jahoda
aca66bb6d4 Minor bugfixes and new BarChart example. 2015-03-07 18:59:20 +01:00
Philipp Jahoda
5e2fb7bf9b Bugfixes and performance boost concerning BarChart. 2015-03-07 17:31:15 +01:00
Philipp Jahoda
fa97f6143a Performance improvements concerning BarChart. 2015-03-07 15:34:29 +01:00
Philipp Jahoda
80ebcb7ab6 Improved CandleStickChart performance. 2015-03-05 23:06:23 +01:00
Philipp Jahoda
6020ed39ee Log fix. 2015-03-05 17:50:52 +01:00
Philipp Jahoda
4d223ba624 Performance improvements concerning bar- and linechart. 2015-03-05 17:49:35 +01:00
Philipp Jahoda
9fcb637069 Merge readme. 2015-03-04 22:37:43 +01:00
Philipp Jahoda
c739d62713 Performance improvements concerning LineChart, still bugs. 2015-03-04 22:34:03 +01:00
Philipp Jahoda
cbbddd3231 Update README.md 2015-03-01 17:19:20 +01:00
Philipp Jahoda
edd513208b LineDataSet can now enable/disable the hole in circles. 2015-03-01 13:56:15 +01:00
Philipp Jahoda
233c44eb01 Update README.md 2015-03-01 11:44:18 +01:00
Philipp Jahoda
143402a401 Merged. 2015-03-01 11:43:14 +01:00
Philipp Jahoda
e0ede6054d Added horizontal barchart. 2015-03-01 11:42:46 +01:00
Philipp Jahoda
32d4c1fb71 Update gradle and maven. 2015-03-01 10:56:08 +01:00
Philipp Jahoda
822e578f9b Removed logcat ouput. 2015-03-01 10:39:22 +01:00
Philipp Jahoda
28bcb18271 Merged readme. 2015-03-01 10:31:04 +01:00
Philipp Jahoda
6b57fa74d4 Update gradle, fixed issue #284. 2015-03-01 10:30:29 +01:00
Philipp Jahoda
33ebc9d192 Update README.md 2015-03-01 10:04:57 +01:00
Philipp Jahoda
b622ea5561 Update gradle and maven info. 2015-03-01 01:24:44 +01:00
Philipp Jahoda
ec7130acb4 Minor fixes. 2015-03-01 01:22:44 +01:00
Philipp Jahoda
68964e8683 Update gradle and maven. 2015-03-01 01:14:43 +01:00
Philipp Jahoda
8c649ed8a9 Update build.gradle 2015-03-01 01:08:22 +01:00
Philipp Jahoda
4a1a8027a4 Update gradle and maven. 2015-02-28 21:15:26 +01:00
Philipp Jahoda
226dced911 merged. 2015-02-28 21:14:54 +01:00
Philipp Jahoda
c35189ad4d Fix gradle issue. 2015-02-28 21:14:16 +01:00
Philipp Jahoda
ef2a10aeec Update README.md 2015-02-28 20:50:05 +01:00
Philipp Jahoda
9d9e330ed3 Update README.md 2015-02-28 19:18:16 +01:00
Philipp Jahoda
10b8e09a1d Update example build.gradle 2015-02-28 18:09:03 +01:00
Philipp Jahoda
f52c3cedef Update example build.gradle 2015-02-28 18:08:30 +01:00
Philipp Jahoda
1b1f639be2 Added sources for documentation. 2015-02-28 18:05:10 +01:00
Philipp Jahoda
4b69d8bb5b Update gradle and maven info. 2015-02-28 16:38:06 +01:00
Philipp Jahoda
9f4bbeb336 Added jar file. 2015-02-28 16:37:25 +01:00
Philipp Jahoda
049d5fc23b Update gradle and manifest. 2015-02-28 16:32:08 +01:00
Philipp Jahoda
9dfa682f85 Fixed issue #391. 2015-02-28 16:23:06 +01:00
Philipp Jahoda
90c2662d33 Fixed issue in stacked-barchart concerning disappearing values. 2015-02-28 16:01:18 +01:00
Philipp Jahoda
542913082c Fixed BarChart highlight crash (issue #390). 2015-02-28 15:23:07 +01:00
Philipp Jahoda
350851c011 Update gradle and manifest file. 2015-02-28 11:45:22 +01:00
Philipp Jahoda
31dff04146 Minor fixes. 2015-02-28 11:43:30 +01:00
Philipp Jahoda
8ccc75ffe0 Update README.md 2015-02-28 11:41:47 +01:00
Philipp Jahoda
a2e92e6ef0 Update README.md 2015-02-28 11:41:06 +01:00
Philipp Jahoda
61b493deeb Update README.md 2015-02-28 11:26:34 +01:00
Philipp Jahoda
27b7ec16d1 Update README.md 2015-02-28 11:20:40 +01:00
Philipp Jahoda
7d37dcb975 Update README.md 2015-02-28 11:17:25 +01:00
Philipp Jahoda
ca027fdfda Update README.md 2015-02-28 11:07:51 +01:00
Philipp Jahoda
74fb504a7e Merged. 2015-02-28 01:17:24 +01:00
Philipp Jahoda
1901fd82c5 Update README.md 2015-02-27 22:24:20 +01:00
Philipp Jahoda
370604bb4b Update README.md 2015-02-27 22:17:41 +01:00
Philipp Jahoda
85382309eb Update README.md 2015-02-27 22:13:38 +01:00
Philipp Jahoda
6927a6db99 Update README.md 2015-02-27 22:10:31 +01:00
Philipp Jahoda
c8d6d7fd73 Added API level badge. 2015-02-27 20:00:27 +01:00
Philipp Jahoda
43046425fc Fixed bug in BarChart, improved example. 2015-02-27 19:14:39 +01:00
Philipp Jahoda
ebb1468560 Added feature that allows to set the grid-line width for each axis. 2015-02-27 18:52:47 +01:00
Philipp Jahoda
0a00522d24 Update gradle and maven. 2015-02-27 17:23:36 +01:00
Philipp Jahoda
d41be04a3e Added jar to example. 2015-02-27 17:15:11 +01:00
Philipp Jahoda
365ea5fe38 Removed unneccessary logs. 2015-02-27 17:12:30 +01:00
Philipp Jahoda
02e8149f5d Fixes concerning BarChart. Stacked values can now be highlighted separately, HorizontalBarChart now supports stacked-values. 2015-02-27 17:05:28 +01:00
Philipp Jahoda
74c4c166a5 Added method setViewPortOffsets(...) to customly set the chart border offsets. 2015-02-27 12:46:50 +01:00
Philipp Jahoda
9bd5ce6b98 Fixed clipping issues in HorizontalBarChart. 2015-02-27 12:21:24 +01:00
Philipp Jahoda
408eaeb127 Inverting chart y-axis is now possible avain. 2015-02-27 11:48:56 +01:00
Philipp Jahoda
47e251e1f1 Fixed bugs in RadarChart. 2015-02-27 11:20:29 +01:00
Philipp Jahoda
951c3f1a3f Code cleanup. 2015-02-27 10:19:00 +01:00
Philipp Jahoda
f5e93c6efb Fixed some issues concerning offset calculation. 2015-02-27 10:15:01 +01:00
Philipp Jahoda
82f2d5595a Fixed bug concerning axis rendering. Axes can now be enabled/disabled totally, added possibility to enable / disable drawing axis labels. 2015-02-27 09:57:10 +01:00
Philipp Jahoda
0a0c22cc73 Update README.md 2015-02-27 00:19:44 +01:00
Philipp Jahoda
b01c5e2b32 Value textsize, textcolor and typeface can now be set via DataSet or ChartData object. 2015-02-27 00:16:06 +01:00
Philipp Jahoda
bd75e6c2a6 Horizontal barchart highlighting working. 2015-02-26 10:56:52 +01:00
Philipp Jahoda
8b932a71ab Grouped BarChart highlighting now working. 2015-02-26 10:54:54 +01:00
Philipp Jahoda
598992c7a0 Merge readme. 2015-02-26 09:56:14 +01:00
Philipp Jahoda
7b1fb38415 Added convenience methods for PieChart, issue #380. 2015-02-26 09:55:22 +01:00
Philipp Jahoda
c755ab6472 Update Projects_using_MPAndroidChart.txt 2015-02-26 09:49:29 +01:00
Philipp Jahoda
657567b3d2 Minor changes. 2015-02-25 23:45:59 +01:00
Philipp Jahoda
be4ea0e1dc Merge pull request #378 from Maragues/examples-improve-ombinedchart
Improved CombinedChart example
2015-02-25 23:41:16 +01:00
Philipp Jahoda
e63c1fa870 ValueFormatter can now be separately set for each DataSet. 2015-02-25 23:39:30 +01:00
Maragues
c72f76577a Improved CombinedChart example. DataSets depend on different YAxis. Added a menu to toggle values annd YAxis dependency. 2015-02-25 14:29:57 +01:00
Philipp Jahoda
93ff1bb5a4 Update README.md 2015-02-25 11:03:17 +01:00
Philipp Jahoda
7b31ec2ea1 Update README.md 2015-02-25 11:01:22 +01:00
Philipp Jahoda
4cb9089fe4 Added more documentation, created ComponentBase. 2015-02-25 09:52:16 +01:00
Philipp Jahoda
3d1649aa1d Merged. 2015-02-25 09:40:26 +01:00
Philipp Jahoda
5bb32e16c9 Update README.md 2015-02-25 09:36:13 +01:00
Philipp Jahoda
536b9100dd Update README.md 2015-02-25 09:06:44 +01:00
Philipp Jahoda
2229715bea Included PercentFormatter into the library. 2015-02-25 00:44:31 +01:00
Philipp Jahoda
c8c0f08d65 Merged. 2015-02-24 22:00:09 +01:00
Philipp Jahoda
6c1acd570b Update README.md 2015-02-24 21:55:01 +01:00
Philipp Jahoda
d2a46e90e4 Update README.md 2015-02-24 21:54:06 +01:00
Philipp Jahoda
ab5bf11726 Merge pull request #373 from jitpack/patch-1
Added gradle dependency information
2015-02-24 21:32:18 +01:00
JitPack.io
f941206292 Added gradle dependency information
So that MPAndroidChart can be easily added to gradle Android projects
2015-02-24 19:53:55 +00:00
Philipp Jahoda
9f1b8f726b Merged, removed support library. 2015-02-24 15:56:48 +01:00
Philipp Jahoda
2de0ad65e4 Merge pull request #371 from gburca/master
Fixed null pointer exception in design view (issue #370)
2015-02-24 07:44:42 +01:00
Gabriel Burca
bbfb6c6648 Fixed null pointer exception in design view (issue #370)
- In the Android Studio Preview mode, mData is null and throws an exception.
2015-02-23 17:37:51 -06:00
Philipp Jahoda
99bb96be0a Merge pull request #369 from Maragues/renderers-drawmethods-accesslevel
Change Rendeder's access level modifiers for extra draw methods
2015-02-23 21:30:36 +01:00
Maragues
85e9795a75 Change Rendeder's access level modifiers for extra draw methods 2015-02-23 18:15:47 +01:00
Maragues
9b5e70fa01 Upgraded example build tools to 21.1.1. Now it matches the one used by the library 2015-02-23 18:12:35 +01:00
Philipp Jahoda
865d5f33ec More improvements concerning offset calculation. 2015-02-23 12:40:25 +01:00
Philipp Jahoda
d386512b9c Worked on HorizontalBarChart value drawing and offset calculation. 2015-02-23 11:17:47 +01:00
Philipp Jahoda
ae2b97bb53 Further improved offset calculation. 2015-02-23 09:49:52 +01:00
Philipp Jahoda
918a91869f Worked on offset calculation for pie- and radarchart. 2015-02-23 01:43:14 +01:00
Philipp Jahoda
50edcd1868 Worked on offset calculation for the Legend. TODO: Pie- and RadarChart. 2015-02-23 00:13:54 +01:00
Philipp Jahoda
a7dd58ab2a Worked on LegendRenderer. 2015-02-22 22:24:00 +01:00
Philipp Jahoda
8e193e26d7 Worked on LegendRenderer. 2015-02-22 19:24:30 +01:00
Philipp Jahoda
cf40c0846d Code cleanup. 2015-02-22 19:16:40 +01:00
Philipp Jahoda
5696d6d562 Introducing LegendRenderer class. 2015-02-22 17:51:15 +01:00
Philipp Jahoda
3fdc451758 Fixed bug concerning x-label centering in BarChart. 2015-02-22 15:19:44 +01:00
Philipp Jahoda
61799c0932 Code cleanup. 2015-02-22 15:11:51 +01:00
Philipp Jahoda
74040310d1 Improved Horizontal-BarChart, now x- and y-axis working. TODO: offset-calculation. 2015-02-22 12:27:20 +01:00
Philipp Jahoda
ccfbf3da4a Worked on horizontal barchart. 2015-02-22 11:10:57 +01:00
Philipp Jahoda
aee1ed09da Worked on Horizontal-BarChart. 2015-02-21 22:22:24 +01:00
Philipp Jahoda
de8322334c Merged. 2015-02-21 15:09:36 +01:00
Philipp Jahoda
e29f40112b Removed nineoldandroids library. Animations now only supported for API level 11 and higher. (issue #362) 2015-02-21 14:56:03 +01:00
Philipp Jahoda
d6ddb47d20 Fixed Stacked-BarChart legend issue. 2015-02-21 12:18:18 +01:00
Philipp Jahoda
8ea1b3b234 Fixed issue concerning start-at-zero. 2015-02-20 22:41:28 +01:00
Philipp Jahoda
976dbbbdef Fixed issues concerning limit lines. 2015-02-20 22:25:02 +01:00
Philipp Jahoda
c9df99a643 Removed chart-borders, instead intruducing axis-lines alongside each axis. 2015-02-20 21:59:06 +01:00
Philipp Jahoda
1871519f24 Merge pull request #355 from wching/master
Update README.md
2015-02-20 16:54:58 +01:00
Philipp Jahoda
266fb4d5d6 Highlighting with multiple datasets and different axes now working. 2015-02-19 11:28:04 +01:00
Philipp Jahoda
28e8ae56d3 PieChart can now again represent percent values. 2015-02-18 22:21:41 +01:00
Philipp Jahoda
9bdfbf72a1 General bugfixes, fixed issues concerning RadarChart labels and offset. 2015-02-18 15:16:29 +01:00
Walter Ching
ddde6c8dc0 Update README.md
Just a minor typo I found. Awesome lib.
2015-02-17 10:37:57 -06:00
Philipp Jahoda
d91e47ea71 Fixed bug in CandleStickChart, worked on combined charts. 2015-02-17 10:05:31 +01:00
Philipp Jahoda
ac22b06a96 Worked on combined charts. 2015-02-17 01:08:29 +01:00
Philipp Jahoda
934b20bd5f Worked on multi-dataset barchart selection. 2015-02-16 21:35:40 +01:00
Philipp Jahoda
58ad281d63 Worked on combined charts. 2015-02-16 16:15:52 +01:00
Philipp Jahoda
fb11b6e07c Added new realtime-chart example. 2015-02-15 17:47:36 +01:00
Philipp Jahoda
5bd73bcb0a Worked on chart viewport handling and dynamical data adding. 2015-02-15 17:11:49 +01:00
Philipp Jahoda
bbc81841cf Improved dynamical data adding. 2015-02-14 19:03:09 +01:00
Philipp Jahoda
131ecce798 Fixed bug in dynamical data adding. 2015-02-14 18:50:25 +01:00
Philipp Jahoda
6492d59eb1 Fixed bug concerning x-axis enable / disable, improved example. 2015-02-14 16:05:22 +01:00
Philipp Jahoda
a59887f72c Improved example, fixed more bugs. 2015-02-14 15:11:11 +01:00
Philipp Jahoda
8029f91f2f Fixed issues concerning grid lines and axis enabling / disabling. 2015-02-14 14:50:43 +01:00
Philipp Jahoda
576d5b6bd0 Now possible to plot with 2 different axes. 2015-02-14 11:20:49 +01:00
Philipp Jahoda
a621b1aee6 Fixed more issues concerning axis, custom axis range now working. 2015-02-14 11:06:09 +01:00
Philipp Jahoda
d78756e928 Fixed axis issues. 2015-02-14 10:44:31 +01:00
Philipp Jahoda
0ab6605e42 More bugfixes, still some issues with axis. 2015-02-13 22:07:24 +01:00
Philipp Jahoda
7beee61c22 Worked on dual-axis support. 2015-02-13 18:03:06 +01:00
Philipp Jahoda
eae0e80ce1 Did some bugfixing. 2015-02-13 11:06:28 +01:00
Philipp Jahoda
a84056024c Finished applying all changes to the example project. 2015-02-12 18:32:43 +01:00
Philipp Jahoda
7cdadaa410 Started fixing the example-project. 2015-02-12 18:17:24 +01:00
Philipp Jahoda
a3bf07615f Removed all errors from Lib-project. 2015-02-12 18:01:54 +01:00
Philipp Jahoda
ed145616bc Did some cleanup. 2015-02-12 17:54:05 +01:00
Philipp Jahoda
e3f3dded5b Worked on RadarChart, out-commented Horizontal-BarChart. 2015-02-12 17:41:46 +01:00
Philipp Jahoda
8d59446596 Some changes to the package structure, implemented PieChart renderer. 2015-02-11 11:32:16 +01:00
Philipp Jahoda
027f11adbd Merged remote. 2015-02-11 00:21:01 +01:00
Philipp Jahoda
7c512cd7d4 Did some work on Pie- and RadarChart. 2015-02-11 00:17:39 +01:00
Philipp Jahoda
442585756e Implemented CandleStickChartRenderer. 2015-02-11 00:04:20 +01:00
Philipp Jahoda
174bf4da91 Worked on XAxisRenderer, worked on Scatter- and BarChart Renderer. 2015-02-10 22:27:05 +01:00
Philipp Jahoda
ba18feecf8 Worked on BarChartRenderer. 2015-02-10 17:13:37 +01:00
Philipp Jahoda
0a5202da00 Massive changes to the architecture, implementing two axis feature. 2015-02-10 16:36:38 +01:00
Philipp Jahoda
7a01c2ac47 Merge pull request #345 from jitpack/master
Added android-maven plugin
2015-02-09 22:41:44 +01:00
JitPack.io
c2dd6d20d1 Update build.gradle 2015-02-09 20:47:04 +00:00
JitPack.io
a6470f5ec0 Update build.gradle 2015-02-09 20:45:55 +00:00
Philipp Jahoda
f6ad237f6f Update Projects_using_MPAndroidChart.txt 2015-01-27 17:36:45 +01:00
Philipp Jahoda
ea89131832 Merge pull request #308 from Praveen2106/master
Added Health Infinity app reference.
2015-01-18 15:48:34 +01:00
Philipp Jahoda
ae7cbb4cc0 Individual DataSets can now be hidden/shown via a setVisible(...) method. 2015-01-18 00:31:45 +01:00
Philipp Jahoda
a12c5e5ab7 Bugfix in setOffsets(...) method. 2015-01-16 21:50:49 +01:00
Praveen2106
7599c6beca Health Infinity loves MPAndroidChart
Hey Phil, Thanks to your library! It is an awesome charting solution for Android.
Planning to use it my future works as well.
2015-01-15 21:01:08 +05:30
Philipp Jahoda
5cb2c1a6a6 Update Projects_using_MPAndroidChart.txt 2015-01-14 14:20:14 +01:00
Philipp Jahoda
4a52e26dbd Update Projects_using_MPAndroidChart.txt 2015-01-14 14:20:02 +01:00
Philipp Jahoda
2de56406b5 Improved MarkerView, fix issues. 2015-01-13 19:47:59 +01:00
Philipp Jahoda
e5578bf8ba Minor changes to PieChart. 2015-01-13 17:00:59 +01:00
Philipp Jahoda
7240729df7 Fixed PieChart highligting math. 2015-01-13 10:07:26 +01:00
Philipp Jahoda
c5b79024db Minor fixes, added PieChart transparent hole. 2015-01-13 10:01:22 +01:00
Philipp Jahoda
40f54dc862 Merge pull request #273 from pingany/linear-form-pos-fix
Fix position of linear legend form.
2015-01-13 09:55:19 +01:00
Philipp Jahoda
b83a13415b Merge pull request #298 from LiJohnson/master
update gradle-wrapper.properties(2.2.1)
2015-01-12 12:58:59 +01:00
LiJohnson
13682a154c update gradle-wrapper.properties(2.2.1) 2015-01-12 11:21:12 +08:00
Philipp Jahoda
284702beb0 Merge pull request #286 from almilli/master
Fixes Issue #262 where it throws an exception when using the include xml tag
2015-01-02 22:18:33 +01:00
David Almilli
0e08509b0c Reverted spacing to match source repo 2014-12-31 10:23:43 -08:00
David Almilli
30ee7af1c1 Fixed bug where an exception is thrown when the view has 0 sized dimensions. This can happen when using the <include> xml tag. 2014-12-31 10:19:59 -08:00
Philipp Jahoda
02309d118b Minor changes. 2014-12-29 12:29:37 +01:00
Philipp Jahoda
4ab4c0ba2e Minor changes concerning horizontal barchart, changed superclass to ViewGroup. 2014-12-29 12:28:25 +01:00
Philipp Jahoda
cd5e3a42b7 Removed resource folder. 2014-12-28 11:23:42 +01:00
Philipp Jahoda
4a57822706 Merge pull request #281 from robertschmid/master
Added Horizontal-BarChart
2014-12-27 20:16:39 +01:00
Robert Schmid
30e301ffd8 Simple Horizontal bar chart example 2014-12-26 19:37:58 -06:00
Robert Schmid
ae428c2ef7 Undo changes not meant for pull request 2014-12-26 11:00:35 -06:00
Robert Schmid
b0387da3e2 Merge branch 'refs/heads/github/philjay/master' into github/rds/opensource 2014-12-26 10:43:55 -06:00
Robert Schmid
e562aeb301 Merge branch 'master' of https://github.com/robertschmid/MPAndroidChart into OpenSource
Conflicts:
	MPChartExample/build.gradle
	MPChartLib/build.gradle
2014-12-18 14:09:34 -06:00
Robert Schmid
85ed5e001d Add flexibility to offsets 2014-12-18 13:50:56 -06:00
Pingan Yi
95d7eaae46 Fix wrong position of linear legend form 2014-12-18 18:14:18 +08:00
Robert Schmid
ade2a8f603 remove reliance on xLabelModulus. 2014-12-17 14:51:39 -06:00
Philipp Jahoda
73724d17cf Fixed issue #255 and #258. 2014-12-16 11:30:57 +01:00
Robert Schmid
8904ed6cb5 Merge branch 'master' of https://github.com/PhilJay/MPAndroidChart into OpenSource 2014-12-11 19:45:38 -06:00
Philipp Jahoda
ea1944edfe Update build.gradle 2014-12-11 18:14:09 +01:00
Philipp Jahoda
e893ca108a Update build.gradle 2014-12-11 18:13:02 +01:00
Philipp Jahoda
42f6fb6932 Update build.gradle 2014-12-11 18:12:09 +01:00
Philipp Jahoda
61755d4d77 Update build.gradle 2014-12-11 18:11:24 +01:00
Philipp Jahoda
249725fe96 Update build.gradle 2014-12-11 10:54:31 +01:00
Philipp Jahoda
9068563a2b Update build.gradle 2014-12-11 10:53:52 +01:00
Robert Schmid
553acb04f6 Merge branch 'develop' of ssh://dev-git:7999/java/mpandroidchart into develop 2014-12-10 14:08:27 -06:00
Robert Schmid
d6c5fe0ae6 upgrade to AS1 2014-12-10 14:08:18 -06:00
Robert Schmid
c1c3715a14 Merge pull request #3 in JAVA/mpandroidchart from update_to_Android_Studio_1.0 to develop
* commit '49456e835f58a10779d25692706b78169e4e893f':
  Update build.gradle for Android Studio 1.0
2014-12-10 10:35:36 -06:00
Dale King
49456e835f Update build.gradle for Android Studio 1.0 2014-12-09 21:35:05 -05:00
Robert Schmid
140a1ea5cf Fix bug in HorizontalBarChart 2014-12-04 11:38:18 -06:00
Robert Schmid
2b380fe188 Fix extend 2014-12-04 11:24:29 -06:00
Robert Schmid
ace7765ba2 Merge pull request #2 in JAVA/mpandroidchart from OpenSource to develop
* commit 'e1b5fc1aa1bcc39207edb3d7c8eb1dfb752b6342':
  Add HorizontalBarChart and ColumnToBarTransformer
2014-12-04 11:20:47 -06:00
Robert Schmid
e1b5fc1aa1 Add HorizontalBarChart and ColumnToBarTransformer 2014-12-04 10:48:52 -06:00
Robert Schmid
fdc70fb8de Merge branch 'refs/heads/OpenSource' into develop 2014-12-03 14:25:34 -06:00
Robert Schmid
eeb160c7fe Merge branch 'refs/heads/OpenSource' into develop 2014-12-03 14:21:58 -06:00
Robert Schmid
c5de8516e4 Add extensibility elements to BarCharts 2014-12-03 14:21:11 -06:00
Robert Schmid
0d5db0e152 Fix willNotDraw in Chart.java 2014-12-01 11:13:23 -06:00
Robert Schmid
c6349bdc82 set WillNotDraw to false - needed since now a ViewGroup 2014-12-01 11:08:45 -06:00
Philipp Jahoda
58b42df504 Merge pull request #245 from MPieter/patch-1
Update Projects_using_MPAndroidChart.txt
2014-11-27 00:16:47 +01:00
Pieter Meiresone
cb78c15a43 Update Projects_using_MPAndroidChart.txt 2014-11-27 00:09:49 +01:00
Robert Schmid
a0243154b2 Make member bar objects protected 2014-11-25 12:53:28 -06:00
Robert Schmid
6f55d8ea43 make members protected 2014-11-25 12:52:54 -06:00
Robert Schmid
0ee2a7b35a Merge branch 'refs/heads/OpenSource' into develop
Conflicts:
	MPChartLib/src/com/github/mikephil/charting/charts/Chart.java
2014-11-25 12:34:52 -06:00
Robert Schmid
20cde649b4 Make BarChart more extendable 2014-11-25 12:33:56 -06:00
Robert Schmid
98eacbcdb0 Make Chart pass layout on to children 2014-11-24 12:46:42 -06:00
Robert Schmid
d4a0a4cf85 Make Chart tell children to do layout 2014-11-24 12:45:11 -06:00
Robert Schmid
2cb955268e Make CPoint accessible to subclass 2014-11-24 11:03:52 -06:00
Robert Schmid
b257057a66 make CPoint accessible to subclasses 2014-11-24 11:03:23 -06:00
Robert Schmid
63d1a1547f AB-400: Integrated MPAndroidChart as a submodule @nopush 2014-11-21 12:24:01 -06:00
Robert Schmid
e1693dc65a Merge pull request #1 in JAVA/mpandroidchart from Airstrip to develop
* commit '473134d39a36809bc4c980dbdcf675ec203ff6e0':
  Convert chart from View to ViewGroup
  refactor line chart to be more extendable
  Adjust gradle to be more compatible.  Eliminate the dependency on nineoldandroids
2014-11-21 11:48:52 -06:00
Robert Schmid
cd2b2ac39c Refactor Chart from View to ViewGroup 2014-11-20 14:40:09 -06:00
Robert Schmid
473134d39a Convert chart from View to ViewGroup 2014-11-20 14:37:39 -06:00
Robert Schmid
d1cb68e707 refactor line chart for more extensibility 2014-11-20 14:14:11 -06:00
Robert Schmid
806fdfe989 refactor line chart to be more extendable 2014-11-20 14:13:47 -06:00
Robert Schmid
c1358af6fa Adjust gradle to be more compatible. Eliminate the dependency on nineoldandroids 2014-11-20 13:42:34 -06:00
Philipp Jahoda
7ad2cc5643 Minor improvements and changes to the arcitecture. 2014-11-18 20:52:22 +01:00
Philipp Jahoda
86f77709f2 Removed renderers, merged with experimental. 2014-11-18 15:44:49 +01:00
Philipp Jahoda
b4d80e8aa4 Major changes to the architecture, introducing Transformer class. 2014-11-18 15:43:34 +01:00
Philipp Jahoda
22d855cee2 Minor changes. 2014-10-30 12:49:59 +01:00
Philipp Jahoda
b98781e0a2 Minor fixes. 2014-10-30 12:49:04 +01:00
Philipp Jahoda
3a1abec3ac Replaced .jar file. 2014-10-30 12:38:08 +01:00
Philipp Jahoda
192dbe0fb5 Minor changes. 2014-10-30 12:35:55 +01:00
Philipp Jahoda
60f4f52c5e Merge readme and projects using lib. 2014-10-30 12:31:43 +01:00
Philipp Jahoda
04a3ed9c72 Fixed issue concering LineChart filling (#179). Made changes to the logic of filling and added FillFormatter interface for implementing a custom fill logic. 2014-10-30 12:30:18 +01:00
Philipp Jahoda
accdd0ef5c Fixed issue concerning XLabels crash (issue #176). 2014-10-28 15:15:07 +01:00
Philipp J.
17fb4857b4 Merge pull request #178 from androideveloper/patch-1
Update Projects_using_MPAndroidChart.txt
2014-10-27 20:13:49 +01:00
Roland
a31ed90353 Update Projects_using_MPAndroidChart.txt 2014-10-27 10:03:16 +04:00
Philipp J.
e63dcdee00 Update README.md 2014-10-26 18:18:29 +01:00
Philipp J.
c4f523e534 Update Projects_using_MPAndroidChart.txt 2014-10-26 15:58:43 +01:00
Philipp J.
0816f7dbb7 Update README.md 2014-10-23 17:55:47 +02:00
Philipp Jahoda
2cd355b8eb Added new .jar file. 2014-10-22 19:58:42 +02:00
Philipp Jahoda
b422a0bed6 Added callbacks for fling gestures on the chart (OnChartGestureListener) (issue #165). 2014-10-22 19:07:31 +02:00
Philipp Jahoda
e829b43460 Added feature to enable/disable logging (issue #173). Added new legend position RIGHT_INSIDE (issue #172). 2014-10-22 19:02:10 +02:00
Philipp J.
b7c0c0b304 Merge pull request #170 from vicktor/master
Added NONE to LegendPosition
2014-10-22 18:33:18 +02:00
Victor Bautista
bf609b828b Added NONE to LegendPosition
Added NONE to LegendPosition, useful to hide Legend in certain cases
2014-10-21 11:05:56 +02:00
Philipp Jahoda
a7a349869e Minor fixes. 2014-10-17 09:52:30 +02:00
Philipp Jahoda
98824fc9c4 Merge readme. 2014-10-16 21:21:37 +02:00
Philipp Jahoda
e12e521537 Minor fixes. 2014-10-16 21:21:18 +02:00
Philipp J.
46f14a193f Update README.md 2014-10-16 11:41:43 +02:00
Philipp J.
98acdda335 Update README.md 2014-10-16 11:40:56 +02:00
Philipp J.
05d2b91333 Update README.md 2014-10-16 11:39:50 +02:00
Philipp Jahoda
bb6a556765 Fixed issue concerning PieChart Legend offsets (issue #158). 2014-10-16 11:37:49 +02:00
Philipp Jahoda
17091c7934 Merge readme. 2014-10-16 00:18:38 +02:00
Philipp Jahoda
a4214dda7a Minor fixes, created new .jar file. 2014-10-16 00:18:14 +02:00
Philipp Jahoda
cee10216fc Added feature to enable/disable dragging and scaling separately. 2014-10-15 22:01:53 +02:00
Philipp Jahoda
2cde3f51cf Added feature to add and remove Entrys from PieChart (PieDataSet) dynamically. 2014-10-15 20:28:32 +02:00
Philipp J.
454a7fc73e Update README.md 2014-10-15 18:30:18 +02:00
Philipp Jahoda
6084b81e13 Fixed issue that caused LineChart to crash. 2014-10-15 17:36:00 +02:00
Philipp Jahoda
c0d263c7a9 Improvements concerning Pie- and RadarChart offset calculation. Improvements concerning Pie- and RadarChart touch listener. 2014-10-15 17:31:56 +02:00
Philipp Jahoda
9c3bffdd97 Worked on PieChart offset calculation and legend position (issue #139, #148, #149). 2014-10-15 12:18:57 +02:00
Philipp Jahoda
254a16f079 Fixed issue concerning Activity attribute 'screenSize|orientation' (issue #15, #114, #153). 2014-10-13 21:42:09 +02:00
Philipp Jahoda
2297afc332 Fixed issue concerning values position in BarChart (issue #146). 2014-10-12 17:10:18 +02:00
Philipp Jahoda
5fcdda2da1 Fixed issue concerning static Resources reference (issue #145). 2014-10-12 16:59:12 +02:00
Philipp Jahoda
e2413a4a9e Minor fixes. 2014-10-12 16:54:34 +02:00
Philipp J.
0fdf6d57e6 Merge pull request #150 from driventokill/master
draw line by path to prevent thick line looks fractured
2014-10-12 16:54:08 +02:00
Fang Yang
2e354e740e draw line by path to prevent thick line looks fractured 2014-10-11 15:23:08 +08:00
Philipp Jahoda
45cdfca994 Fixed issue concerning PieChart legend offsets (issue #137). 2014-10-08 09:52:07 +02:00
Philipp Jahoda
2719cefbf3 Fixed longpress-drag issue. 2014-10-07 00:02:39 +02:00
Philipp Jahoda
3c5523b0d2 Fixed issue concerning PieChart center-text crash (issue #135). 2014-10-06 23:14:52 +02:00
Philipp Jahoda
9eb932c3ce Fixed issue concerning PieChart crashing when tapped empty (issue #134). 2014-10-06 19:00:36 +02:00
Philipp Jahoda
bb650946be Added .jar file. 2014-10-06 15:27:03 +02:00
Philipp Jahoda
1d99ab4108 Adjust build. 2014-10-06 15:24:01 +02:00
Philipp Jahoda
6d32d76a71 Merge readme. 2014-10-06 15:21:38 +02:00
Philipp Jahoda
e707cbe6f9 Fixed issue concerning ScatterChart shape clipping. 2014-10-06 15:21:22 +02:00
Philipp J.
22b4d114fd Update README.md 2014-10-06 15:13:01 +02:00
Philipp Jahoda
43ca04697c Fixed issues concerning background color (issue #9, issue #53). Fixed issue concerning zero values. General bugfixes and improvements. 2014-10-06 11:36:29 +02:00
Philipp Jahoda
cb5ca58c61 Added LargeValueFormatter class that helps format large numbers in a pretty way. 2014-10-03 11:23:19 +02:00
Philipp Jahoda
25cafdcfa8 Improved LimitLines, added feature to draw labels for LimitLines. 2014-10-02 19:30:34 +02:00
Philipp Jahoda
42d40d8c35 Added OnChartGestureListener, touch improvements. 2014-10-02 18:18:03 +02:00
Philipp Jahoda
bbb9df10a8 Adjust build. 2014-10-01 23:55:06 +02:00
Philipp Jahoda
40eee50348 Fixed issue concerning scrolling in ListView. 2014-10-01 23:54:00 +02:00
Philipp Jahoda
70454009bc Fixed example project crash, fixed issues concerning dynamical data adding. 2014-10-01 21:05:00 +02:00
Philipp Jahoda
f516b4587d Fixed issue concerning multiple lines not being drawn with one entry (issue #127). 2014-09-30 10:47:10 +02:00
455 changed files with 51721 additions and 19481 deletions

12
.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1,12 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: mpandroidchart
open_collective: philippjahoda
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

37
.github/ISSUE_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,37 @@
<!---
BEFORE YOU SUBMIT please read the following:
Please search open/closed issues before submitting since someone might have asked
the same thing before!
If you have a support request or question please submit them on StackOverflow:
https://stackoverflow.com/questions/tagged/mpandroidchart
using the tags `android` & `mpandroidchart`
Please also look at the CONTRIBUTING file before opening an issue:
https://github.com/PhilJay/MPAndroidChart/blob/master/CONTRIBUTING.md
Issues on GitHub are only related to problems with MPAndroidChart itself and we
cannot answer support questions here. We will close your issue without a response.
-->
**Summary**
<!-- A clear and concise description of what the bug is. -->
**Expected Behavior**
<!-- A clear and concise description of what you expected to happen. -->
**Possible Solution**
<!-- Not required, but suggest a fix/ reason for the bug, -->
<!-- or ideas how to implement the addition or change -->
**Device (please complete the following information):**
- Device: [e.g. Google Pixel]
- Android Version [e.g. 7.0]
- Library Version (e.g. 3.1.0-alpha)
**Additional Context**
<!-- Add any other context about the problem here.
If you have source code demonstrating this bug, create a Gist:
https://help.github.com/articles/creating-gists/
and link to it here. -->

44
.github/ISSUE_TEMPLATE/Bug_report.md vendored Normal file
View file

@ -0,0 +1,44 @@
---
name: Bugs
about: Create a bug report to help us improve
---
<!---
BEFORE YOU SUBMIT please read the following:
Please search open/closed issues before submitting since someone might have asked the same thing before!
If you have a support request or question please submit them on StackOverflow:
https://stackoverflow.com/questions/tagged/mpandroidchart
using the tags `android` & `mpandroidchart`
Please also look at the CONTRIBUTING file before opening an issue:
https://github.com/PhilJay/MPAndroidChart/blob/master/CONTRIBUTING.md
Issues on GitHub are only related to problems with MPAndroidChart itself and we cannot answer
support questions here. We will close your issue without a response.
-->
**Summary**
<!-- A clear and concise description of what the bug is. -->
**Expected Behavior**
<!-- A clear and concise description of what you expected to happen. -->
**Possible Solution**
<!-- Not required, but suggest a fix/ reason for the bug, -->
<!-- or ideas how to implement the addition or change -->
**Device (please complete the following information):**
- Device: [e.g. Google Pixel]
- Android Version [e.g. 7.0]
- Library Version (e.g. 3.1.0-alpha)
**Additional Context**
<!-- Add any other context about the problem here.
If you have source code demonstrating this bug, create a Gist:
https://help.github.com/articles/creating-gists/
and link to it here. -->
ADD A REWARD using [Speed](speedoss.com) to SOLVE this issue QUICKLY and SUPPORT this project.

View file

@ -0,0 +1,34 @@
---
name: Feature Request
about: Suggest an idea for this project
---
<!---
BEFORE YOU SUBMIT please read the following:
Please search open/closed issues before submitting since someone might have asked the same thing before!
If you have a support request or question please submit them on StackOverflow:
https://stackoverflow.com/questions/tagged/mpandroidchart
using the tags `android` & `mpandroidchart`
Please also look at the CONTRIBUTING file before opening an issue:
https://github.com/PhilJay/MPAndroidChart/blob/master/CONTRIBUTING.md
Issues on GitHub are only related to problems with MPAndroidChart itself and we cannot answer
support questions here. We will close your issue without a response.
-->
**Is your feature request related to a problem? Please describe.**
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
**Describe the solution you'd like**
<!-- A clear and concise description of what you want to happen. -->
**Describe alternatives you've considered**
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
**Additional context**
<!-- Add any other context or screenshots about the feature request here. -->
ADD A REWARD using [Speed](speedoss.com) to SOLVE this issue QUICKLY and SUPPORT this project.

27
.github/ISSUE_TEMPLATE/Support_help.md vendored Normal file
View file

@ -0,0 +1,27 @@
---
name: Support
about: I need help!
---
# *STOP RIGHT THERE!*
Issues are ***NOT*** for getting help, only for reporting bugs and feature requests.
Search open and closed issues to see if your question already has an answer. However, **do not create a new issue.**
Instead, do the following:
1. Download the [Example App](https://play.google.com/store/apps/details?id=com.xxmassdeveloper.mpchartexample) and check out the [source code](https://github.com/PhilJay/MPAndroidChart/tree/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample). 90% of the time there is an example that does exactly what you are trying to do.
1. Look at the [Wiki](https://github.com/PhilJay/MPAndroidChart/wiki) for the official documentation for MPAndroidChart. You can also browse the [javadoc](https://jitpack.io/com/github/philjay/mpandroidchart/v3.1.0-alpha/javadoc/) for a more detailed tutorial of the API.
1. Go to [StackOverflow](https://stackoverflow.com/questions/tagged/mpandroidchart) and ask your questions there. The community will be much more helpful and willing to offer guidance.
### You have been warned!
From now on, any issues asking for help will get closed with a link to this file.
### Additional Context
ADD A REWARD using [Speed](speedoss.com) to SOLVE this issue QUICKLY and SUPPORT this project.

15
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,15 @@
## PR Checklist:
- [ ] I have tested this extensively and it does not break any existing behavior.
- [ ] I have added/updated examples and tests for any new behavior.
- [ ] If this is a significant change, an issue has already been created where the problem / solution was discussed: [N/A, or add link to issue here]
<!-- If you'd like to suggest a significant change, please
create an issue to discuss those changes and gather
feedback BEFORE submitting your PR. -->
## PR Description
<!-- Describe Your PR Here! -->
<!-- What does this add/ remove/ fix/ change? -->
<!-- WHY should this PR be merged into the main library? -->

12
.gitignore vendored
View file

@ -11,6 +11,11 @@
# generated files
bin/
gen/
generated/
finalOutput/
projectFilesBackup/
build.xml
# Local configuration file (sdk path, etc)
local.properties
@ -18,6 +23,8 @@ local.properties
# Eclipse project files
.classpath
.project
.settings/
.vscode/
# Proguard folder generated by Eclipse
proguard/
@ -26,7 +33,8 @@ proguard/
*.iml
*.ipr
*.iws
.idea/
/.idea/*
!/.idea/runConfigurations
.directory
@ -37,3 +45,5 @@ build/
# maven
target/
.DS_Store

View file

@ -0,0 +1,52 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="MPChartExample" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false">
<module name="MPChartExample" />
<option name="DEPLOY" value="true" />
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
<option name="ARTIFACT_NAME" value="" />
<option name="PM_INSTALL_OPTIONS" value="" />
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="" />
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
<option name="MODE" value="default_activity" />
<option name="CLEAR_LOGCAT" value="false" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
<option name="FORCE_STOP_RUNNING_APP" value="true" />
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
<option name="USE_LAST_SELECTED_DEVICE" value="false" />
<option name="PREFERRED_AVD" value="" />
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
<option name="DEBUGGER_TYPE" value="Auto" />
<Auto>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Auto>
<Hybrid>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Hybrid>
<Java />
<Native>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Native>
<Profilers>
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Sampled (Java)" />
</Profilers>
<option name="DEEP_LINK" value="" />
<option name="ACTIVITY_CLASS" value="" />
<method />
</configuration>
</component>

66
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,66 @@
> ### Notice
> *Before you continue, this is the* **ANDROID** *library. If you have an* **iOS** *device, please go here instead*:
>
> https://github.com/danielgindi/Charts
>
> They might tell you to come back here, if they do, listen to them and ignore this notice.
# How to contribute
Bug-fixes and features often come from users of the MPAndroidChart library and improve it greatly. We want to keep it as easy as possible to contribute changes that improve the experience for users all around the world. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.
## Creating Issues
There are two main issue templates, one for bugs and another for feature requests. Please use them! You're issue will be much easier to understand, and bugs easier to fix, if you follow the templates. If your issue doesn't fit into those, just use the generic template.
Search existing [issues] to see if your bug has already been reported or if a feature request already exists. Don't forget to remove `is:open` so you see all the issues! If you find that one already exists, use reactions to show how much you care!
## Making Pull Requests
Careful! If you fail to follow these guidlines, you're pull request may be closed, *even if it's really awesome*.
0. **Search** open [pull requests] AND existing [issues] to make sure what you want to do isn't already being worked on or already has an open pull request.
1. **Fork** the repository
1. **Create** a new branch based on `master`, and name it according to your changes
1. **Add** your commits, they MUST follow the [Commit Style](#commit-style) below
1. **Test** your changes by actually running the example app, or create a new example
1. **Create** a pull request, following the auto-generated template
1. ???
1. Profit :money_with_wings:
You are encouraged to use [GitHub Desktop] to inspect your code changes before committing them. It can reveal small changes that might have gone unnoticed, and would be requested for removal before merging.
Check out [#3975](https://github.com/PhilJay/MPAndroidChart/pull/3975) for an example of a good-made-better pull request.
## Commit Style
* **Make commits of logical units**
Don't load your commits with tons of changes, this makes it hard to follow what is happening. However, if you have done a lot of work, and there are commits and merges all over the place, squash them down into fewer commits.
* **Conform to the code style**
It's easy, just look around!
* **Write good commit messages**
You may prefer [Tim Pope's style], you might like the [commitizen-friendly] way. Regardless of the color you pick, you MUST stay within the lines!
```
The commit title CANNOT exceed 50 characters
The body of the message comes after an empty new line, and describes the
changes more thoroughly. If the change is obvious and self-explanatory
from the title, you can omit the body. You should describe all changes
if many were made, or maybe some trickery that only code wizards can
understand.
Be polite and wrap your lines to 72 characters, but if you prefer going
to 100 characters then I guess we can't stop you.
```
## Final Notes
Thanks for reading the contributing file! Have some cake! :cake:
[issues]: https://github.com/PhilJay/MPAndroidChart/issues
[pull requests]: https://github.com/PhilJay/MPAndroidChart/pulls
[GitHub Desktop]: https://desktop.github.com/
[Tim Pope's style]: https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[commitizen-friendly]: https://github.com/commitizen/cz-cli

201
LICENSE Normal file
View file

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View file

@ -1 +1,2 @@
/build
/release

View file

@ -1,47 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxmassdeveloper.mpchartexample"
android:versionCode="22"
android:versionName="1.6.2" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.xxmassdeveloper.mpchartexample.notimportant.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="LineChartActivity"></activity>
<activity android:screenOrientation="landscape" android:name="MultipleChartsActivity"></activity>
<activity android:name="BarChartActivity"></activity>
<activity android:name="PieChartActivity"></activity>
<activity android:name="MultiLineChartActivity"></activity>
<activity android:name="BarChartActivityMultiDataset"></activity>
<activity android:name="DrawChartActivity"></activity>
<activity android:name="ScatterChartActivity"></activity>
<activity android:name="com.xxmassdeveloper.mpchartexample.fragments.SimpleChartDemo"></activity>
<activity android:name="ListViewBarChartActivity"></activity>
<activity android:name="ListViewMultiChartActivity"></activity>
<activity android:name="StackedBarActivity"></activity>
<activity android:name="AnotherBarActivity"></activity>
<activity android:name="InvertedLineChartActivity"></activity>
<activity android:name="CandleStickChartActivity"></activity>
<activity android:name="CubicLineChartActivity"></activity>
<activity android:name="RadarChartActivitry"></activity>
<activity android:name="LineChartActivityColored"></activity>
<activity android:name="DynamicalAddingActivity"></activity>
</application>
</manifest>

View file

@ -1,42 +1,26 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
compileSdkVersion 28
defaultConfig {
applicationId 'com.xxmassdeveloper.mpchartexample'
applicationId "com.xxmassdeveloper.mpchartexample"
minSdkVersion 16
targetSdkVersion 19
versionCode 22
versionName '1.6.2'
sourceSets {
main {
java.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
manifest.srcFile 'AndroidManifest.xml'
}
}
targetSdkVersion 28
versionCode 57
versionName '3.1.0'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
runProguard false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
dependencies {
//compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:19.+'
compile project(':MPChartLib')
implementation "androidx.appcompat:appcompat:1.0.2"
implementation 'com.google.android.material:material:1.0.0'
implementation project(':MPChartLib')
}

View file

@ -1,20 +0,0 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

21
MPChartExample/proguard-rules.pro vendored Normal file
View file

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View file

@ -1,14 +0,0 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-19

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View file

@ -1,53 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/actionToggleValues"
android:title="Toggle Values">
</item>
<item
android:id="@+id/actionToggleHighlight"
android:title="Toggle Highlight">
</item>
<item
android:id="@+id/actionToggleHighlightArrow"
android:title="Toggle Highlight Arrow">
</item>
<item
android:id="@+id/actionToggle3D"
android:title="Toggle 3D">
</item>
<item
android:id="@+id/animateX"
android:title="Animate X">
</item>
<item
android:id="@+id/animateY"
android:title="Animate Y">
</item>
<item
android:id="@+id/animateXY"
android:title="Animate XY">
</item>
<item
android:id="@+id/actionToggleStartzero"
android:title="Toggle StartZero">
</item>
<item
android:id="@+id/actionToggleAdjustXLegend"
android:title="Toggle AdjustXLegend">
</item>
<item
android:id="@+id/actionToggleFilter"
android:title="Toggle filter">
</item>
<item
android:id="@+id/actionSave"
android:title="Save to Gallery">
</item>
<item
android:id="@+id/actionTogglePinch"
android:title="Toggle PinchZoom">
</item>
</menu>

View file

@ -1,37 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/actionToggleHighlight"
android:title="Toggle Highlight">
</item>
<item
android:id="@+id/actionToggleStartzero"
android:title="Toggle StartZero">
</item>
<item
android:id="@+id/animateX"
android:title="Animate X">
</item>
<item
android:id="@+id/animateY"
android:title="Animate Y">
</item>
<item
android:id="@+id/animateXY"
android:title="Animate XY">
</item>
<item
android:id="@+id/actionToggleAdjustXLegend"
android:title="Toggle AdjustXLegend">
</item>
<item
android:id="@+id/actionSave"
android:title="Save to SD-Card">
</item>
<item
android:id="@+id/actionTogglePinch"
android:title="Toggle PinchZoom">
</item>
</menu>

View file

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/actionToggleValues"
android:title="Toggle Values">
</item>
<item
android:id="@+id/actionToggleFilled"
android:title="Toggle Filled">
</item>
<item
android:id="@+id/actionToggleCircles"
android:title="Toggle Circles">
</item>
<item
android:id="@+id/actionToggleHighlight"
android:title="Toggle Highlight">
</item>
<item
android:id="@+id/actionToggleStartzero"
android:title="Toggle StartZero">
</item>
<item
android:id="@+id/actionToggleAdjustXLegend"
android:title="Toggle AdjustXLegend">
</item>
<item
android:id="@+id/actionToggleFilter"
android:title="Toggle filter">
</item>
<item
android:id="@+id/actionSave"
android:title="Save to Gallery">
</item>
<item
android:id="@+id/actionTogglePinch"
android:title="Toggle PinchZoom">
</item>
</menu>

View file

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/actionAddEntry"
android:title="Add Entry">
</item>
<item
android:id="@+id/actionRemoveEntry"
android:title="Remove Entry">
</item>
<item
android:id="@+id/actionAddDataSet"
android:title="Add DataSet">
</item>
<item
android:id="@+id/actionRemoveDataSet"
android:title="Remove DataSet">
</item>
<item
android:id="@+id/actionAddEmptyLineData"
android:title="Add empty LineData">
</item>
<item
android:id="@+id/actionClear"
android:title="Clear chart">
</item>
</menu>

View file

@ -1,56 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/actionToggleValues"
android:title="Toggle Values">
</item>
<item
android:id="@+id/actionToggleFilled"
android:title="Toggle Filled">
</item>
<item
android:id="@+id/actionToggleCircles"
android:title="Toggle Circles">
</item>
<item
android:id="@+id/actionToggleCubic"
android:title="Toggle Cubic">
</item>
<item
android:id="@+id/actionToggleHighlight"
android:title="Toggle Highlight">
</item>
<item
android:id="@+id/actionToggleStartzero"
android:title="Toggle StartZero">
</item>
<item
android:id="@+id/animateX"
android:title="Animate X">
</item>
<item
android:id="@+id/animateY"
android:title="Animate Y">
</item>
<item
android:id="@+id/animateXY"
android:title="Animate XY">
</item>
<item
android:id="@+id/actionToggleAdjustXLegend"
android:title="Toggle AdjustXLegend">
</item>
<item
android:id="@+id/actionToggleFilter"
android:title="Toggle filter">
</item>
<item
android:id="@+id/actionSave"
android:title="Save to SD-Card">
</item>
<item
android:id="@+id/actionTogglePinch"
android:title="Toggle PinchZoom">
</item>
</menu>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/viewGithub" android:title="View on GitHub"></item>
<item android:id="@+id/website" android:title="Developer Website"></item>
<item android:id="@+id/report" android:title="Problem Report"></item>
</menu>

View file

@ -1,41 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/actionToggleValues"
android:title="Toggle Y-Values">
</item>
<item
android:id="@+id/actionToggleXVals"
android:title="Toggle X-Values">
</item>
<item
android:id="@+id/actionTogglePercent"
android:title="Toggle Percent">
</item>
<item
android:id="@+id/actionToggleHole"
android:title="Toggle Hole">
</item>
<item
android:id="@+id/animateX"
android:title="Animate X">
</item>
<item
android:id="@+id/animateY"
android:title="Animate Y">
</item>
<item
android:id="@+id/animateXY"
android:title="Animate XY">
</item>
<item
android:id="@+id/actionDrawCenter"
android:title="Draw CenterText">
</item>
<item
android:id="@+id/actionSave"
android:title="Save to Gallery">
</item>
</menu>

View file

@ -1,37 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/actionToggleValues"
android:title="Toggle Values">
</item>
<item
android:id="@+id/actionToggleFilled"
android:title="Toggle Filled">
</item>
<item
android:id="@+id/actionToggleHighlight"
android:title="Toggle Highlight">
</item>
<item
android:id="@+id/actionSave"
android:title="Save to SD">
</item>
<item
android:id="@+id/actionToggleRotate"
android:title="Toggle Rotation">
</item>
<item
android:id="@+id/actionToggleYLabels"
android:title="Toggle Y-Labels">
</item>
<item
android:id="@+id/actionToggleXLabels"
android:title="Toggle X-Labels">
</item>
<item
android:id="@+id/actionToggleSpin"
android:title="Spin Animation">
</item>
</menu>

View file

@ -1,45 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/actionToggleValues"
android:title="Toggle Values">
</item>
<item
android:id="@+id/actionToggleHighlight"
android:title="Toggle Highlight">
</item>
<item
android:id="@+id/actionToggleStartzero"
android:title="Toggle StartZero">
</item>
<item
android:id="@+id/actionToggleAdjustXLegend"
android:title="Toggle AdjustXLegend">
</item>
<item
android:id="@+id/animateX"
android:title="Animate X">
</item>
<item
android:id="@+id/animateY"
android:title="Animate Y">
</item>
<item
android:id="@+id/animateXY"
android:title="Animate XY">
</item>
<item
android:id="@+id/actionToggleFilter"
android:title="Toggle filter">
</item>
<item
android:id="@+id/actionSave"
android:title="Save to Gallery">
</item>
<item
android:id="@+id/actionTogglePinch"
android:title="Toggle PinchZoom">
</item>
</menu>

View file

@ -1,8 +0,0 @@
<resources>
<!--
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw600dp devices (e.g. 7" tablets) here.
-->
</resources>

View file

@ -1,9 +0,0 @@
<resources>
<!--
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
-->
<dimen name="activity_horizontal_margin">128dp</dimen>
</resources>

View file

@ -1,11 +0,0 @@
<resources>
<!--
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!-- API 11 theme customizations can go here. -->
</style>
</resources>

View file

@ -1,12 +0,0 @@
<resources>
<!--
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- API 14 theme customizations can go here. -->
</style>
</resources>

View file

@ -1,7 +0,0 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">MPAndroidChart Example</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>
</resources>

View file

@ -1,20 +0,0 @@
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>

View file

@ -1,247 +0,0 @@
package com.xxmassdeveloper.mpchartexample;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import android.widget.Toast;
import com.github.mikephil.charting.charts.BarChart;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry;
import com.github.mikephil.charting.data.filter.Approximator;
import com.github.mikephil.charting.data.filter.Approximator.ApproximatorType;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.github.mikephil.charting.utils.XLabels;
import com.github.mikephil.charting.utils.XLabels.XLabelPosition;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
public class AnotherBarActivity extends DemoBase implements OnSeekBarChangeListener {
private BarChart mChart;
private SeekBar mSeekBarX, mSeekBarY;
private TextView tvX, tvY;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_barchart);
tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarX.setOnSeekBarChangeListener(this);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarY.setOnSeekBarChangeListener(this);
mChart = (BarChart) findViewById(R.id.chart1);
mChart.setDrawYValues(false);
mChart.setUnit("");
mChart.setDescription("");
mChart.setDrawYValues(true);
// if more than 60 entries are displayed in the chart, no values will be
// drawn
mChart.setMaxVisibleValueCount(60);
// disable 3D
mChart.set3DEnabled(false);
// scaling can now only be done on x- and y-axis separately
mChart.setPinchZoom(false);
mChart.setDrawBarShadow(false);
mChart.setDrawVerticalGrid(false);
mChart.setDrawHorizontalGrid(false);
mChart.setDrawGridBackground(false);
XLabels xLabels = mChart.getXLabels();
xLabels.setPosition(XLabelPosition.BOTTOM);
xLabels.setCenterXLabelText(true);
xLabels.setSpaceBetweenLabels(0);
mChart.setDrawYLabels(false);
mChart.setDrawLegend(false);
// setting data
mSeekBarX.setProgress(10);
mSeekBarY.setProgress(100);
// add a nice and smooth animation
mChart.animateY(2500);
// Legend l = mChart.getLegend();
// l.setPosition(LegendPosition.BELOW_CHART_CENTER);
// l.setFormSize(8f);
// l.setFormToTextSpace(4f);
// l.setXEntrySpace(6f);
// mChart.setDrawLegend(false);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.bar, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.actionToggleValues: {
if (mChart.isDrawYValuesEnabled())
mChart.setDrawYValues(false);
else
mChart.setDrawYValues(true);
mChart.invalidate();
break;
}
case R.id.actionToggle3D: {
if (mChart.is3DEnabled())
mChart.set3DEnabled(false);
else
mChart.set3DEnabled(true);
mChart.invalidate();
break;
}
case R.id.actionToggleHighlight: {
if (mChart.isHighlightEnabled())
mChart.setHighlightEnabled(false);
else
mChart.setHighlightEnabled(true);
mChart.invalidate();
break;
}
case R.id.actionTogglePinch: {
if (mChart.isPinchZoomEnabled())
mChart.setPinchZoom(false);
else
mChart.setPinchZoom(true);
mChart.invalidate();
break;
}
case R.id.actionToggleHighlightArrow: {
if (mChart.isDrawHighlightArrowEnabled())
mChart.setDrawHighlightArrow(false);
else
mChart.setDrawHighlightArrow(true);
mChart.invalidate();
break;
}
case R.id.actionToggleStartzero: {
if (mChart.isStartAtZeroEnabled())
mChart.setStartAtZero(false);
else
mChart.setStartAtZero(true);
mChart.invalidate();
break;
}
case R.id.actionToggleAdjustXLegend: {
XLabels xLabels = mChart.getXLabels();
if (xLabels.isAdjustXLabelsEnabled())
xLabels.setAdjustXLabels(false);
else
xLabels.setAdjustXLabels(true);
mChart.invalidate();
break;
}
case R.id.animateX: {
mChart.animateX(3000);
break;
}
case R.id.animateY: {
mChart.animateY(3000);
break;
}
case R.id.animateXY: {
mChart.animateXY(3000, 3000);
break;
}
case R.id.actionToggleFilter: {
Approximator a = new Approximator(ApproximatorType.DOUGLAS_PEUCKER, 25);
if (!mChart.isFilteringEnabled()) {
mChart.enableFiltering(a);
} else {
mChart.disableFiltering();
}
mChart.invalidate();
break;
}
case R.id.actionSave: {
if (mChart.saveToGallery("title" + System.currentTimeMillis(), 50)) {
Toast.makeText(getApplicationContext(), "Saving SUCCESSFUL!",
Toast.LENGTH_SHORT).show();
} else
Toast.makeText(getApplicationContext(), "Saving FAILED!", Toast.LENGTH_SHORT)
.show();
break;
}
}
return true;
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
tvX.setText("" + (mSeekBarX.getProgress() + 1));
tvY.setText("" + (mSeekBarY.getProgress()));
ArrayList<BarEntry> yVals1 = new ArrayList<BarEntry>();
for (int i = 0; i < mSeekBarX.getProgress()+1; i++) {
float mult = (mSeekBarY.getProgress() + 1);
float val1 = (float) (Math.random() * mult) + mult / 3;
yVals1.add(new BarEntry((int) val1, i));
}
ArrayList<String> xVals = new ArrayList<String>();
for (int i = 0; i < mSeekBarX.getProgress()+1; i++) {
xVals.add((int) yVals1.get(i).getVal() + " " + mChart.getUnit());
}
BarDataSet set1 = new BarDataSet(yVals1, "Data Set");
set1.setColors(ColorTemplate.VORDIPLOM_COLORS);
ArrayList<BarDataSet> dataSets = new ArrayList<BarDataSet>();
dataSets.add(set1);
BarData data = new BarData(xVals, dataSets);
mChart.setData(data);
mChart.invalidate();
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
}

View file

@ -1,292 +0,0 @@
package com.xxmassdeveloper.mpchartexample;
import android.annotation.SuppressLint;
import android.graphics.PointF;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import android.widget.Toast;
import com.github.mikephil.charting.charts.BarChart;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.filter.Approximator;
import com.github.mikephil.charting.data.filter.Approximator.ApproximatorType;
import com.github.mikephil.charting.interfaces.OnChartValueSelectedListener;
import com.github.mikephil.charting.utils.Legend;
import com.github.mikephil.charting.utils.Legend.LegendPosition;
import com.github.mikephil.charting.utils.XLabels;
import com.github.mikephil.charting.utils.XLabels.XLabelPosition;
import com.github.mikephil.charting.utils.YLabels;
import com.github.mikephil.charting.utils.YLabels.YLabelPosition;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
public class BarChartActivity extends DemoBase implements OnSeekBarChangeListener, OnChartValueSelectedListener {
private BarChart mChart;
private SeekBar mSeekBarX, mSeekBarY;
private TextView tvX, tvY;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_barchart);
tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mChart = (BarChart) findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);
// enable the drawing of values
mChart.setDrawYValues(true);
mChart.setDescription("");
// if more than 60 entries are displayed in the chart, no values will be
// drawn
mChart.setMaxVisibleValueCount(60);
// disable 3D
mChart.set3DEnabled(false);
// scaling can now only be done on x- and y-axis separately
mChart.setPinchZoom(false);
// draw shadows for each bar that show the maximum value
// mChart.setDrawBarShadow(true);
mChart.setUnit("");
// mChart.setDrawXLabels(false);
mChart.setDrawGridBackground(false);
mChart.setDrawHorizontalGrid(true);
mChart.setDrawVerticalGrid(false);
// mChart.setDrawYLabels(false);
// sets the text size of the values inside the chart
mChart.setValueTextSize(10f);
mChart.setDrawBorder(false);
// mChart.setBorderPositions(new BorderPosition[] {BorderPosition.LEFT,
// BorderPosition.RIGHT});
Typeface tf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
XLabels xl = mChart.getXLabels();
xl.setPosition(XLabelPosition.BOTTOM);
xl.setCenterXLabelText(true);
xl.setTypeface(tf);
YLabels yl = mChart.getYLabels();
yl.setTypeface(tf);
yl.setLabelCount(8);
yl.setPosition(YLabelPosition.BOTH_SIDED);
mChart.setValueTypeface(tf);
setData(12, 50);
// setting data
mSeekBarY.setProgress(50);
mSeekBarX.setProgress(12);
mSeekBarY.setOnSeekBarChangeListener(this);
mSeekBarX.setOnSeekBarChangeListener(this);
Legend l = mChart.getLegend();
l.setPosition(LegendPosition.BELOW_CHART_LEFT);
l.setFormSize(8f);
l.setXEntrySpace(4f);
// mChart.setDrawLegend(false);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.bar, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.actionToggleValues: {
if (mChart.isDrawYValuesEnabled())
mChart.setDrawYValues(false);
else
mChart.setDrawYValues(true);
mChart.invalidate();
break;
}
case R.id.actionToggle3D: {
if (mChart.is3DEnabled())
mChart.set3DEnabled(false);
else
mChart.set3DEnabled(true);
mChart.invalidate();
break;
}
case R.id.actionToggleHighlight: {
if (mChart.isHighlightEnabled())
mChart.setHighlightEnabled(false);
else
mChart.setHighlightEnabled(true);
mChart.invalidate();
break;
}
case R.id.actionTogglePinch: {
if (mChart.isPinchZoomEnabled())
mChart.setPinchZoom(false);
else
mChart.setPinchZoom(true);
mChart.invalidate();
break;
}
case R.id.actionToggleHighlightArrow: {
if (mChart.isDrawHighlightArrowEnabled())
mChart.setDrawHighlightArrow(false);
else
mChart.setDrawHighlightArrow(true);
mChart.invalidate();
break;
}
case R.id.actionToggleStartzero: {
if (mChart.isStartAtZeroEnabled())
mChart.setStartAtZero(false);
else
mChart.setStartAtZero(true);
mChart.invalidate();
break;
}
case R.id.animateX: {
mChart.animateX(3000);
break;
}
case R.id.animateY: {
mChart.animateY(3000);
break;
}
case R.id.animateXY: {
mChart.animateXY(3000, 3000);
break;
}
case R.id.actionToggleAdjustXLegend: {
XLabels xLabels = mChart.getXLabels();
if (xLabels.isAdjustXLabelsEnabled())
xLabels.setAdjustXLabels(false);
else
xLabels.setAdjustXLabels(true);
mChart.invalidate();
break;
}
case R.id.actionToggleFilter: {
Approximator a = new Approximator(ApproximatorType.DOUGLAS_PEUCKER, 25);
if (!mChart.isFilteringEnabled()) {
mChart.enableFiltering(a);
} else {
mChart.disableFiltering();
}
mChart.invalidate();
break;
}
case R.id.actionSave: {
if (mChart.saveToGallery("title" + System.currentTimeMillis(), 50)) {
Toast.makeText(getApplicationContext(), "Saving SUCCESSFUL!",
Toast.LENGTH_SHORT).show();
} else
Toast.makeText(getApplicationContext(), "Saving FAILED!", Toast.LENGTH_SHORT)
.show();
break;
}
}
return true;
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
tvX.setText("" + (mSeekBarX.getProgress() + 1));
tvY.setText("" + (mSeekBarY.getProgress()));
setData(mSeekBarX.getProgress(), mSeekBarY.getProgress());
mChart.invalidate();
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
private void setData(int count, float range) {
ArrayList<String> xVals = new ArrayList<String>();
for (int i = 0; i < count; i++) {
xVals.add(mMonths[i % 12]);
}
ArrayList<BarEntry> yVals1 = new ArrayList<BarEntry>();
for (int i = 0; i < count; i++) {
float mult = (range + 1);
float val = (float) (Math.random() * mult);
yVals1.add(new BarEntry(val, i));
}
BarDataSet set1 = new BarDataSet(yVals1, "DataSet");
set1.setBarSpacePercent(35f);
ArrayList<BarDataSet> dataSets = new ArrayList<BarDataSet>();
dataSets.add(set1);
BarData data = new BarData(xVals, dataSets);
mChart.setData(data);
}
@SuppressLint("NewApi")
@Override
public void onValueSelected(Entry e, int dataSetIndex) {
RectF bounds = mChart.getBarBounds((BarEntry) e);
PointF position = mChart.getPosition(e);
Log.i("bounds", bounds.toString());
Log.i("position", position.toString());
}
public void onNothingSelected() {};
}

View file

@ -1,263 +0,0 @@
package com.xxmassdeveloper.mpchartexample;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import com.github.mikephil.charting.charts.BarChart;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.interfaces.OnChartValueSelectedListener;
import com.github.mikephil.charting.utils.Legend;
import com.github.mikephil.charting.utils.Legend.LegendPosition;
import com.github.mikephil.charting.utils.XLabels;
import com.github.mikephil.charting.utils.YLabels;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
public class BarChartActivityMultiDataset extends DemoBase implements OnSeekBarChangeListener, OnChartValueSelectedListener {
private BarChart mChart;
private SeekBar mSeekBarX, mSeekBarY;
private TextView tvX, tvY;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_barchart);
tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarX.setOnSeekBarChangeListener(this);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarY.setOnSeekBarChangeListener(this);
mChart = (BarChart) findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);
mChart.setDescription("");
// disable the drawing of values
mChart.setDrawYValues(false);
// scaling can now only be done on x- and y-axis separately
mChart.setPinchZoom(false);
mChart.setDrawBarShadow(false);
mChart.setDrawGridBackground(false);
mChart.setDrawHorizontalGrid(false);
// create a custom MarkerView (extend MarkerView) and specify the layout
// to use for it
MyMarkerView mv = new MyMarkerView(this, R.layout.custom_marker_view);
// define an offset to change the original position of the marker
// (optional)
mv.setOffsets(-mv.getMeasuredWidth() / 2, -mv.getMeasuredHeight());
// set the marker to the chart
mChart.setMarkerView(mv);
mSeekBarX.setProgress(10);
mSeekBarY.setProgress(100);
Typeface tf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
Legend l = mChart.getLegend();
l.setPosition(LegendPosition.RIGHT_OF_CHART);
l.setTypeface(tf);
XLabels xl = mChart.getXLabels();
xl.setCenterXLabelText(true);
xl.setTypeface(tf);
YLabels yl = mChart.getYLabels();
yl.setTypeface(tf);
mChart.setValueTypeface(tf);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.bar, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.actionToggleValues: {
if (mChart.isDrawYValuesEnabled())
mChart.setDrawYValues(false);
else
mChart.setDrawYValues(true);
mChart.invalidate();
break;
}
case R.id.actionTogglePinch: {
if (mChart.isPinchZoomEnabled())
mChart.setPinchZoom(false);
else
mChart.setPinchZoom(true);
mChart.invalidate();
break;
}
case R.id.actionToggle3D: {
if (mChart.is3DEnabled())
mChart.set3DEnabled(false);
else
mChart.set3DEnabled(true);
mChart.invalidate();
break;
}
case R.id.actionToggleHighlight: {
if (mChart.isHighlightEnabled())
mChart.setHighlightEnabled(false);
else
mChart.setHighlightEnabled(true);
mChart.invalidate();
break;
}
case R.id.actionToggleHighlightArrow: {
if (mChart.isDrawHighlightArrowEnabled())
mChart.setDrawHighlightArrow(false);
else
mChart.setDrawHighlightArrow(true);
mChart.invalidate();
break;
}
case R.id.actionToggleStartzero: {
if (mChart.isStartAtZeroEnabled())
mChart.setStartAtZero(false);
else
mChart.setStartAtZero(true);
mChart.invalidate();
break;
}
case R.id.actionToggleAdjustXLegend: {
XLabels xLabels = mChart.getXLabels();
if (xLabels.isAdjustXLabelsEnabled())
xLabels.setAdjustXLabels(false);
else
xLabels.setAdjustXLabels(true);
mChart.invalidate();
break;
}
case R.id.actionSave: {
// mChart.saveToGallery("title"+System.currentTimeMillis());
mChart.saveToPath("title" + System.currentTimeMillis(), "");
break;
}
case R.id.animateX: {
mChart.animateX(3000);
break;
}
case R.id.animateY: {
mChart.animateY(3000);
break;
}
case R.id.animateXY: {
mChart.animateXY(3000, 3000);
break;
}
}
return true;
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
tvX.setText("" + (mSeekBarX.getProgress() + 1));
tvY.setText("" + (mSeekBarY.getProgress()));
ArrayList<String> xVals = new ArrayList<String>();
for (int i = 0; i < mSeekBarX.getProgress(); i++) {
xVals.add((i+1990) + "");
}
ArrayList<BarEntry> yVals1 = new ArrayList<BarEntry>();
ArrayList<BarEntry> yVals2 = new ArrayList<BarEntry>();
ArrayList<BarEntry> yVals3 = new ArrayList<BarEntry>();
for (int i = 0; i < mSeekBarX.getProgress(); i++) {
float val = (float) (Math.random() * mSeekBarY.getProgress()) + 3;
yVals1.add(new BarEntry(val, i));
}
for (int i = 0; i < mSeekBarX.getProgress(); i++) {
float val = (float) (Math.random() * mSeekBarY.getProgress()) + 3;
yVals2.add(new BarEntry(val, i));
}
for (int i = 0; i < mSeekBarX.getProgress(); i++) {
float val = (float) (Math.random() * mSeekBarY.getProgress()) + 3;
yVals3.add(new BarEntry(val, i));
}
// create 3 datasets with different types
BarDataSet set1 = new BarDataSet(yVals1, "Company A");
// set1.setColors(ColorTemplate.createColors(getApplicationContext(), ColorTemplate.FRESH_COLORS));
set1.setColor(Color.rgb(104, 241, 175));
BarDataSet set2 = new BarDataSet(yVals2, "Company B");
set2.setColor(Color.rgb(164, 228, 251));
BarDataSet set3 = new BarDataSet(yVals3, "Company C");
set3.setColor(Color.rgb(242, 247, 158));
ArrayList<BarDataSet> dataSets = new ArrayList<BarDataSet>();
dataSets.add(set1);
dataSets.add(set2);
dataSets.add(set3);
BarData data = new BarData(xVals, dataSets);
// add space between the dataset groups in percent of bar-width
data.setGroupSpace(110f);
mChart.setData(data);
mChart.invalidate();
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
@Override
public void onValueSelected(Entry e, int dataSetIndex) {
Log.i("Activity", "Selected: " + e.toString() + ", dataSet: " + dataSetIndex);
}
@Override
public void onNothingSelected() {
Log.i("Activity", "Nothing selected.");
}
}

View file

@ -1,211 +0,0 @@
package com.xxmassdeveloper.mpchartexample;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import android.widget.Toast;
import com.github.mikephil.charting.charts.CandleStickChart;
import com.github.mikephil.charting.data.CandleData;
import com.github.mikephil.charting.data.CandleDataSet;
import com.github.mikephil.charting.data.CandleEntry;
import com.github.mikephil.charting.utils.XLabels;
import com.github.mikephil.charting.utils.XLabels.XLabelPosition;
import com.github.mikephil.charting.utils.YLabels;
import com.github.mikephil.charting.utils.YLabels.YLabelPosition;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
public class CandleStickChartActivity extends DemoBase implements OnSeekBarChangeListener {
private CandleStickChart mChart;
private SeekBar mSeekBarX, mSeekBarY;
private TextView tvX, tvY;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_candlechart);
tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarX.setOnSeekBarChangeListener(this);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarY.setOnSeekBarChangeListener(this);
mChart = (CandleStickChart) findViewById(R.id.chart1);
mChart.setDescription("");
// if more than 60 entries are displayed in the chart, no values will be
// drawn
mChart.setMaxVisibleValueCount(60);
// scaling can now only be done on x- and y-axis separately
mChart.setPinchZoom(false);
mChart.setDrawVerticalGrid(false);
mChart.setDrawGridBackground(false);
XLabels xLabels = mChart.getXLabels();
xLabels.setPosition(XLabelPosition.BOTTOM);
xLabels.setCenterXLabelText(true);
xLabels.setSpaceBetweenLabels(2);
YLabels yLabels = mChart.getYLabels();
yLabels.setLabelCount(7);
yLabels.setPosition(YLabelPosition.LEFT);
mChart.setDrawYLabels(true);
mChart.setDrawLegend(false);
// setting data
mSeekBarX.setProgress(15);
mSeekBarY.setProgress(100);
// Legend l = mChart.getLegend();
// l.setPosition(LegendPosition.BELOW_CHART_CENTER);
// l.setFormSize(8f);
// l.setFormToTextSpace(4f);
// l.setXEntrySpace(6f);
// mChart.setDrawLegend(false);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.candle, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.actionToggleHighlight: {
if (mChart.isHighlightEnabled())
mChart.setHighlightEnabled(false);
else
mChart.setHighlightEnabled(true);
mChart.invalidate();
break;
}
case R.id.actionTogglePinch: {
if (mChart.isPinchZoomEnabled())
mChart.setPinchZoom(false);
else
mChart.setPinchZoom(true);
mChart.invalidate();
break;
}
case R.id.actionToggleStartzero: {
if (mChart.isStartAtZeroEnabled())
mChart.setStartAtZero(false);
else
mChart.setStartAtZero(true);
mChart.invalidate();
break;
}
case R.id.actionToggleAdjustXLegend: {
XLabels xLabels = mChart.getXLabels();
if (xLabels.isAdjustXLabelsEnabled())
xLabels.setAdjustXLabels(false);
else
xLabels.setAdjustXLabels(true);
mChart.invalidate();
break;
}
case R.id.animateX: {
mChart.animateX(3000);
break;
}
case R.id.animateY: {
mChart.animateY(3000);
break;
}
case R.id.animateXY: {
mChart.animateXY(3000, 3000);
break;
}
case R.id.actionSave: {
if (mChart.saveToGallery("title" + System.currentTimeMillis(), 50)) {
Toast.makeText(getApplicationContext(), "Saving SUCCESSFUL!",
Toast.LENGTH_SHORT).show();
} else
Toast.makeText(getApplicationContext(), "Saving FAILED!", Toast.LENGTH_SHORT)
.show();
break;
}
}
return true;
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
int prog = (mSeekBarX.getProgress() + 1) * 2;
tvX.setText("" + prog);
tvY.setText("" + (mSeekBarY.getProgress()));
ArrayList<CandleEntry> yVals1 = new ArrayList<CandleEntry>();
for (int i = 0; i < prog; i++) {
float mult = (mSeekBarY.getProgress() + 1);
float val = (float) (Math.random() * 40) + mult;
float high = (float) (Math.random() * 9) + 8f;
float low = (float) (Math.random() * 9) + 8f;
float open = (float) (Math.random() * 6) + 1f;
float close = (float) (Math.random() * 6) + 1f;
boolean even = i % 2 == 0;
yVals1.add(new CandleEntry(i, val + high, val - low, even ? val + open : val - open,
even ? val - close : val + close));
}
ArrayList<String> xVals = new ArrayList<String>();
for (int i = 0; i < prog; i++) {
xVals.add("" + (1990 + i));
}
CandleDataSet set1 = new CandleDataSet(yVals1, "Data Set");
set1.setColor(Color.rgb(80, 80, 80));
CandleData data = new CandleData(xVals, set1);
mChart.setData(data);
mChart.invalidate();
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
}

View file

@ -1,297 +0,0 @@
package com.xxmassdeveloper.mpchartexample;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import android.widget.Toast;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.data.filter.Approximator;
import com.github.mikephil.charting.data.filter.Approximator.ApproximatorType;
import com.github.mikephil.charting.utils.XLabels;
import com.github.mikephil.charting.utils.YLabels;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
public class CubicLineChartActivity extends DemoBase implements OnSeekBarChangeListener {
private LineChart mChart;
private SeekBar mSeekBarX, mSeekBarY;
private TextView tvX, tvY;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_linechart);
tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarX.setProgress(45);
mSeekBarY.setProgress(100);
mSeekBarY.setOnSeekBarChangeListener(this);
mSeekBarX.setOnSeekBarChangeListener(this);
mChart = (LineChart) findViewById(R.id.chart1);
// if enabled, the chart will always start at zero on the y-axis
mChart.setStartAtZero(true);
// disable the drawing of values into the chart
mChart.setDrawYValues(false);
mChart.setDrawBorder(false);
mChart.setDrawLegend(false);
// no description text
mChart.setDescription("");
mChart.setUnit(" $");
// enable value highlighting
mChart.setHighlightEnabled(true);
// enable touch gestures
mChart.setTouchEnabled(true);
// enable scaling and dragging
mChart.setDragScaleEnabled(true);
// if disabled, scaling can be done on x- and y-axis separately
mChart.setPinchZoom(false);
mChart.setDrawGridBackground(false);
mChart.setDrawVerticalGrid(false);
Typeface tf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
mChart.setValueTypeface(tf);
XLabels x = mChart.getXLabels();
x.setTypeface(tf);
YLabels y = mChart.getYLabels();
y.setTypeface(tf);
y.setLabelCount(5);
// add data
setData(45, 100);
mChart.animateXY(2000, 2000);
// dont forget to refresh the drawing
mChart.invalidate();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.line, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.actionToggleValues: {
if (mChart.isDrawYValuesEnabled())
mChart.setDrawYValues(false);
else
mChart.setDrawYValues(true);
mChart.invalidate();
break;
}
case R.id.actionToggleHighlight: {
if (mChart.isHighlightEnabled())
mChart.setHighlightEnabled(false);
else
mChart.setHighlightEnabled(true);
mChart.invalidate();
break;
}
case R.id.actionToggleFilled: {
ArrayList<LineDataSet> sets = (ArrayList<LineDataSet>) mChart.getDataCurrent()
.getDataSets();
for (LineDataSet set : sets) {
if (set.isDrawFilledEnabled())
set.setDrawFilled(false);
else
set.setDrawFilled(true);
}
mChart.invalidate();
break;
}
case R.id.actionToggleCircles: {
ArrayList<LineDataSet> sets = (ArrayList<LineDataSet>) mChart.getDataCurrent()
.getDataSets();
for (LineDataSet set : sets) {
if (set.isDrawCirclesEnabled())
set.setDrawCircles(false);
else
set.setDrawCircles(true);
}
mChart.invalidate();
break;
}
case R.id.actionToggleCubic: {
ArrayList<LineDataSet> sets = (ArrayList<LineDataSet>) mChart.getDataCurrent()
.getDataSets();
for (LineDataSet set : sets) {
if (set.isDrawCubicEnabled())
set.setDrawCubic(false);
else
set.setDrawCubic(true);
}
mChart.invalidate();
break;
}
case R.id.actionToggleStartzero: {
if (mChart.isStartAtZeroEnabled())
mChart.setStartAtZero(false);
else
mChart.setStartAtZero(true);
mChart.invalidate();
break;
}
case R.id.actionTogglePinch: {
if (mChart.isPinchZoomEnabled())
mChart.setPinchZoom(false);
else
mChart.setPinchZoom(true);
mChart.invalidate();
break;
}
case R.id.animateX: {
mChart.animateX(3000);
break;
}
case R.id.animateY: {
mChart.animateY(3000);
break;
}
case R.id.animateXY: {
mChart.animateXY(3000, 3000);
break;
}
case R.id.actionToggleAdjustXLegend: {
XLabels xLabels = mChart.getXLabels();
if (xLabels.isAdjustXLabelsEnabled())
xLabels.setAdjustXLabels(false);
else
xLabels.setAdjustXLabels(true);
mChart.invalidate();
break;
}
case R.id.actionToggleFilter: {
// the angle of filtering is 35°
Approximator a = new Approximator(ApproximatorType.DOUGLAS_PEUCKER, 35);
if (!mChart.isFilteringEnabled()) {
mChart.enableFiltering(a);
} else {
mChart.disableFiltering();
}
mChart.invalidate();
break;
}
case R.id.actionSave: {
if (mChart.saveToPath("title" + System.currentTimeMillis(), "")) {
Toast.makeText(getApplicationContext(), "Saving SUCCESSFUL!",
Toast.LENGTH_SHORT).show();
} else
Toast.makeText(getApplicationContext(), "Saving FAILED!", Toast.LENGTH_SHORT)
.show();
// mChart.saveToGallery("title"+System.currentTimeMillis())
break;
}
}
return true;
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
tvX.setText("" + (mSeekBarX.getProgress() + 1));
tvY.setText("" + (mSeekBarY.getProgress()));
setData(mSeekBarX.getProgress() + 1, mSeekBarY.getProgress());
// redraw
mChart.invalidate();
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
private void setData(int count, float range) {
ArrayList<String> xVals = new ArrayList<String>();
for (int i = 0; i < count; i++) {
xVals.add((1990 +i) + "");
}
ArrayList<Entry> vals1 = new ArrayList<Entry>();
for (int i = 0; i < count; i++) {
float mult = (range + 1);
float val = (float) (Math.random() * mult) + 20;// + (float)
// ((mult *
// 0.1) / 10);
vals1.add(new Entry(val, i));
}
// create a dataset and give it a type
LineDataSet set1 = new LineDataSet(vals1, "DataSet 1");
set1.setDrawCubic(true);
set1.setCubicIntensity(0.2f);
set1.setDrawFilled(true);
set1.setDrawCircles(false);
set1.setLineWidth(2f);
set1.setCircleSize(5f);
set1.setHighLightColor(Color.rgb(244, 117, 117));
set1.setColor(Color.rgb(104, 241, 175));
ArrayList<LineDataSet> dataSets = new ArrayList<LineDataSet>();
dataSets.add(set1);
// create a data object with the datasets
LineData data = new LineData(xVals, dataSets);
// set data
mChart.setData(data);
}
}

View file

@ -1,204 +0,0 @@
package com.xxmassdeveloper.mpchartexample;
import android.graphics.Typeface;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import com.github.mikephil.charting.charts.Chart;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.data.DataSet;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.interfaces.OnChartValueSelectedListener;
import com.github.mikephil.charting.interfaces.OnDrawListener;
import com.github.mikephil.charting.utils.XLabels;
import com.github.mikephil.charting.utils.YLabels;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
/**
* This Activity demonstrates drawing into the Chart with the finger. Both line,
* bar and scatter charts can be used for drawing.
*
* @author Philipp Jahoda
*/
public class DrawChartActivity extends DemoBase implements OnChartValueSelectedListener,
OnDrawListener {
private LineChart mChart;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_draw_chart);
mChart = (LineChart) findViewById(R.id.chart1);
// listener for selecting and drawing
mChart.setOnChartValueSelectedListener(this);
mChart.setOnDrawListener(this);
// enable drawing with the finger
// mChart.setDrawingEnabled(true);
// enable dragging and scaling
mChart.setDragScaleEnabled(true);
mChart.setDrawYValues(false);
// mChart.setLineWidth(5f);
// mChart.setCircleSize(5f);
mChart.setHighlightEnabled(true);
// if disabled, drawn datasets with the finger will not be automatically
// finished
// mChart.setAutoFinish(true);
mChart.setDrawGridBackground(false);
mChart.setDrawLegend(false);
// add dummy-data to the chart
initWithDummyData();
Typeface tf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
XLabels xl = mChart.getXLabels();
xl.setTypeface(tf);
xl.setAvoidFirstLastClipping(true);
YLabels yl = mChart.getYLabels();
yl.setTypeface(tf);
mChart.setValueTypeface(tf);
mChart.setYRange(-40f, 40f, true);
// call this to reset the changed y-range
// mChart.resetYRange(true);
}
private void initWithDummyData() {
ArrayList<String> xVals = new ArrayList<String>();
for (int i = 0; i < 24; i++) {
xVals.add((i) + ":00");
}
ArrayList<Entry> yVals = new ArrayList<Entry>();
// create a dataset and give it a type (0)
LineDataSet set1 = new LineDataSet(yVals, "DataSet");
set1.setLineWidth(3f);
set1.setCircleSize(5f);
ArrayList<LineDataSet> dataSets = new ArrayList<LineDataSet>();
dataSets.add(set1); // add the datasets
// create a data object with the datasets
LineData data = new LineData(xVals, dataSets);
mChart.setData(data);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.draw, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.actionToggleValues: {
if (mChart.isDrawYValuesEnabled())
mChart.setDrawYValues(false);
else
mChart.setDrawYValues(true);
mChart.invalidate();
break;
}
case R.id.actionToggleHighlight: {
if (mChart.isHighlightEnabled())
mChart.setHighlightEnabled(false);
else
mChart.setHighlightEnabled(true);
mChart.invalidate();
break;
}
case R.id.actionToggleStartzero: {
if (mChart.isStartAtZeroEnabled())
mChart.setStartAtZero(false);
else
mChart.setStartAtZero(true);
mChart.invalidate();
break;
}
case R.id.actionToggleAdjustXLegend: {
XLabels xLabels = mChart.getXLabels();
if (xLabels.isAdjustXLabelsEnabled())
xLabels.setAdjustXLabels(false);
else
xLabels.setAdjustXLabels(true);
mChart.invalidate();
break;
}
case R.id.actionTogglePinch: {
if (mChart.isPinchZoomEnabled())
mChart.setPinchZoom(false);
else
mChart.setPinchZoom(true);
mChart.invalidate();
break;
}
case R.id.actionSave: {
// mChart.saveToGallery("title"+System.currentTimeMillis());
mChart.saveToPath("title" + System.currentTimeMillis(), "");
break;
}
}
return true;
}
@Override
public void onValueSelected(Entry e, int dataSetIndex) {
Log.i("VAL SELECTED",
"Value: " + e.getVal() + ", xIndex: " + e.getXIndex()
+ ", DataSet index: " + dataSetIndex);
}
@Override
public void onNothingSelected() {
}
/** callback for each new entry drawn with the finger */
@Override
public void onEntryAdded(Entry entry) {
Log.i(Chart.LOG_TAG, entry.toString());
}
/** callback when a DataSet has been drawn (when lifting the finger) */
@Override
public void onDrawFinished(DataSet dataSet) {
Log.i(Chart.LOG_TAG, "DataSet drawn. " + dataSet.toSimpleString());
// prepare the legend again
mChart.prepareLegend();
mChart.calculateLegendOffsets();
}
@Override
public void onEntryMoved(Entry entry) {
Log.i(Chart.LOG_TAG, "Point moved " + entry.toString());
}
}

View file

@ -1,210 +0,0 @@
package com.xxmassdeveloper.mpchartexample;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.Toast;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.interfaces.OnChartValueSelectedListener;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
public class DynamicalAddingActivity extends DemoBase implements OnChartValueSelectedListener {
private LineChart mChart;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_linechart_noseekbar);
mChart = (LineChart) findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);
mChart.setDrawYValues(false);
mChart.setDrawGridBackground(false);
mChart.setDescription("");
addEmptyData();
mChart.invalidate();
}
int[] mColors = ColorTemplate.VORDIPLOM_COLORS;
private void addEntry() {
LineData data = mChart.getDataOriginal();
if(data != null) {
LineDataSet set = data.getDataSetByIndex(0);
// set.addEntry(...);
if (set == null) {
set = createSet();
data.addDataSet(set);
}
data.addEntry(new Entry((float) (Math.random() * 50) + 50f, set.getEntryCount()), 0);
// let the chart know it's data has changed
mChart.notifyDataSetChanged();
// redraw the chart
mChart.invalidate();
}
}
private void removeLastEntry() {
LineData data = mChart.getDataOriginal();
if(data != null) {
LineDataSet set = data.getDataSetByIndex(0);
if (set != null) {
Entry e = set.getEntryForXIndex(set.getEntryCount() - 1);
data.removeEntry(e, 0);
// or remove by index
// mData.removeEntry(xIndex, dataSetIndex);
mChart.notifyDataSetChanged();
mChart.invalidate();
}
}
}
private void addDataSet() {
LineData data = mChart.getDataOriginal();
if(data != null) {
int count = (data.getDataSetCount() + 1);
// create 10 y-vals
ArrayList<Entry> yVals = new ArrayList<Entry>();
for (int i = 0; i < data.getXValCount(); i++)
yVals.add(new Entry((float) (Math.random() * 50f) + 50f * count, i));
LineDataSet set = new LineDataSet(yVals, "DataSet " + count);
set.setLineWidth(2.5f);
set.setCircleSize(4.5f);
int color = mColors[count % mColors.length];
set.setColor(color);
set.setCircleColor(color);
set.setHighLightColor(color);
data.addDataSet(set);
mChart.notifyDataSetChanged();
mChart.invalidate();
}
}
private void removeDataSet() {
LineData data = mChart.getDataOriginal();
if(data != null) {
data.removeDataSet(data.getDataSetByIndex(data.getDataSetCount() - 1));
mChart.notifyDataSetChanged();
mChart.invalidate();
}
}
private void addEmptyData() {
// create 30 x-vals
String[] xVals = new String[30];
for (int i = 0; i < 30; i++)
xVals[i] = "" + i;
// create a chartdata object that contains only the x-axis labels (no entries or datasets)
LineData data = new LineData(xVals);
mChart.setData(data);
mChart.invalidate();
}
@Override
public void onValueSelected(Entry e, int dataSetIndex) {
Toast.makeText(this, e.toString(), Toast.LENGTH_SHORT).show();
}
@Override
public void onNothingSelected() {
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.dynamical, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.actionAddEntry:
addEntry();
Toast.makeText(this, "Entry added!", Toast.LENGTH_SHORT).show();
break;
case R.id.actionRemoveEntry:
removeLastEntry();
Toast.makeText(this, "Entry removed!", Toast.LENGTH_SHORT).show();
break;
case R.id.actionAddDataSet:
addDataSet();
Toast.makeText(this, "DataSet added!", Toast.LENGTH_SHORT).show();
break;
case R.id.actionRemoveDataSet:
removeDataSet();
Toast.makeText(this, "DataSet removed!", Toast.LENGTH_SHORT).show();
break;
case R.id.actionAddEmptyLineData:
addEmptyData();
Toast.makeText(this, "Empty data added!", Toast.LENGTH_SHORT).show();
break;
case R.id.actionClear:
mChart.clear();
Toast.makeText(this, "Chart cleared!", Toast.LENGTH_SHORT).show();
break;
}
return true;
}
private LineDataSet createSet() {
LineDataSet set = new LineDataSet(null, "DataSet 1");
set.setLineWidth(2.5f);
set.setCircleSize(4.5f);
set.setColor(Color.rgb(240, 99, 99));
set.setCircleColor(Color.rgb(240, 99, 99));
set.setHighLightColor(Color.rgb(190, 190, 190));
return set;
}
}

View file

@ -1,317 +0,0 @@
package com.xxmassdeveloper.mpchartexample;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import android.widget.Toast;
import com.github.mikephil.charting.charts.BarLineChartBase.BorderPosition;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.data.filter.Approximator;
import com.github.mikephil.charting.data.filter.Approximator.ApproximatorType;
import com.github.mikephil.charting.interfaces.OnChartValueSelectedListener;
import com.github.mikephil.charting.utils.Legend;
import com.github.mikephil.charting.utils.Legend.LegendForm;
import com.github.mikephil.charting.utils.XLabels;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
public class InvertedLineChartActivity extends DemoBase implements OnSeekBarChangeListener,
OnChartValueSelectedListener {
private LineChart mChart;
private SeekBar mSeekBarX, mSeekBarY;
private TextView tvX, tvY;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_linechart);
tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarX.setProgress(45);
mSeekBarY.setProgress(100);
mSeekBarY.setOnSeekBarChangeListener(this);
mSeekBarX.setOnSeekBarChangeListener(this);
mChart = (LineChart) findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);
// if enabled, the chart will always start at zero on the y-axis
mChart.setStartAtZero(true);
// enable the drawing of values into the chart
mChart.setDrawYValues(true);
mChart.setDrawBorder(true);
mChart.setBorderPositions(new BorderPosition[] {
BorderPosition.BOTTOM
});
// no description text
mChart.setDescription("");
// invert the y-axis
mChart.setInvertYAxisEnabled(true);
// enable value highlighting
mChart.setHighlightEnabled(true);
// enable touch gestures
mChart.setTouchEnabled(true);
// enable scaling and dragging
mChart.setDragScaleEnabled(true);
// if disabled, scaling can be done on x- and y-axis separately
mChart.setPinchZoom(true);
// set an alternative background color
// mChart.setBackgroundColor(Color.GRAY);
// create a custom MarkerView (extend MarkerView) and specify the layout
// to use for it
MyMarkerView mv = new MyMarkerView(this, R.layout.custom_marker_view);
// define an offset to change the original position of the marker
// (optional)
mv.setOffsets(-mv.getMeasuredWidth() / 2, -mv.getMeasuredHeight());
// set the marker to the chart
mChart.setMarkerView(mv);
// enable/disable highlight indicators (the lines that indicate the
// highlighted Entry)
mChart.setHighlightIndicatorEnabled(false);
XLabels xl = mChart.getXLabels();
xl.setAvoidFirstLastClipping(true);
// add data
setData(25, 50);
// // restrain the maximum scale-out factor
// mChart.setScaleMinima(3f, 3f);
//
// // center the view to a specific position inside the chart
// mChart.centerViewPort(10, 50);
// get the legend (only possible after setting data)
Legend l = mChart.getLegend();
// modify the legend ...
// l.setPosition(LegendPosition.LEFT_OF_CHART);
l.setForm(LegendForm.LINE);
// dont forget to refresh the drawing
mChart.invalidate();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.line, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.actionToggleValues: {
if (mChart.isDrawYValuesEnabled())
mChart.setDrawYValues(false);
else
mChart.setDrawYValues(true);
mChart.invalidate();
break;
}
case R.id.actionToggleHighlight: {
if (mChart.isHighlightEnabled())
mChart.setHighlightEnabled(false);
else
mChart.setHighlightEnabled(true);
mChart.invalidate();
break;
}
case R.id.actionToggleFilled: {
ArrayList<LineDataSet> sets = (ArrayList<LineDataSet>) mChart.getDataCurrent()
.getDataSets();
for (LineDataSet set : sets) {
if (set.isDrawFilledEnabled())
set.setDrawFilled(false);
else
set.setDrawFilled(true);
}
mChart.invalidate();
break;
}
case R.id.actionToggleCircles: {
ArrayList<LineDataSet> sets = (ArrayList<LineDataSet>) mChart.getDataCurrent()
.getDataSets();
for (LineDataSet set : sets) {
if (set.isDrawCirclesEnabled())
set.setDrawCircles(false);
else
set.setDrawCircles(true);
}
mChart.invalidate();
break;
}
case R.id.actionToggleStartzero: {
if (mChart.isStartAtZeroEnabled())
mChart.setStartAtZero(false);
else
mChart.setStartAtZero(true);
mChart.invalidate();
break;
}
case R.id.animateX: {
mChart.animateX(3000);
break;
}
case R.id.animateY: {
mChart.animateY(3000);
break;
}
case R.id.animateXY: {
mChart.animateXY(3000, 3000);
break;
}
case R.id.actionTogglePinch: {
if (mChart.isPinchZoomEnabled())
mChart.setPinchZoom(false);
else
mChart.setPinchZoom(true);
mChart.invalidate();
break;
}
case R.id.actionToggleAdjustXLegend: {
XLabels xLabels = mChart.getXLabels();
if (xLabels.isAdjustXLabelsEnabled())
xLabels.setAdjustXLabels(false);
else
xLabels.setAdjustXLabels(true);
mChart.invalidate();
break;
}
case R.id.actionToggleFilter: {
// the angle of filtering is 35°
Approximator a = new Approximator(ApproximatorType.DOUGLAS_PEUCKER, 35);
if (!mChart.isFilteringEnabled()) {
mChart.enableFiltering(a);
} else {
mChart.disableFiltering();
}
mChart.invalidate();
break;
}
case R.id.actionSave: {
if (mChart.saveToPath("title" + System.currentTimeMillis(), "")) {
Toast.makeText(getApplicationContext(), "Saving SUCCESSFUL!",
Toast.LENGTH_SHORT).show();
} else
Toast.makeText(getApplicationContext(), "Saving FAILED!", Toast.LENGTH_SHORT)
.show();
// mChart.saveToGallery("title"+System.currentTimeMillis())
break;
}
}
return true;
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
tvX.setText("" + (mSeekBarX.getProgress() + 1));
tvY.setText("" + (mSeekBarY.getProgress()));
setData(mSeekBarX.getProgress() + 1, mSeekBarY.getProgress());
// redraw
mChart.invalidate();
}
@Override
public void onValueSelected(Entry e, int dataSetIndex) {
Log.i("VAL SELECTED",
"Value: " + e.getVal() + ", xIndex: " + e.getXIndex()
+ ", DataSet index: " + dataSetIndex);
}
@Override
public void onNothingSelected() {
// TODO Auto-generated method stub
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
private void setData(int count, float range) {
ArrayList<String> xVals = new ArrayList<String>();
for (int i = 0; i < count; i++) {
xVals.add((i % 30) + "/" + (i % 12) + "/14");
}
ArrayList<Entry> yVals = new ArrayList<Entry>();
for (int i = 0; i < count; i++) {
float mult = (range + 1);
float val = (float) (Math.random() * mult) + 3;// + (float)
// ((mult *
// 0.1) / 10);
yVals.add(new Entry(val, i));
}
// create a dataset and give it a type
LineDataSet set1 = new LineDataSet(yVals, "DataSet 1");
set1.setLineWidth(1.5f);
set1.setCircleSize(4f);
// create a data object with the datasets
LineData data = new LineData(xVals, set1);
// set data
mChart.setData(data);
}
}

View file

@ -1,370 +0,0 @@
package com.xxmassdeveloper.mpchartexample;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import android.widget.Toast;
import com.github.mikephil.charting.charts.BarLineChartBase.BorderPosition;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.data.filter.Approximator;
import com.github.mikephil.charting.data.filter.Approximator.ApproximatorType;
import com.github.mikephil.charting.interfaces.OnChartValueSelectedListener;
import com.github.mikephil.charting.utils.Legend;
import com.github.mikephil.charting.utils.Legend.LegendForm;
import com.github.mikephil.charting.utils.LimitLine;
import com.github.mikephil.charting.utils.XLabels;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
public class LineChartActivity extends DemoBase implements OnSeekBarChangeListener,
OnChartValueSelectedListener {
private LineChart mChart;
private SeekBar mSeekBarX, mSeekBarY;
private TextView tvX, tvY;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_linechart);
tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarX.setProgress(45);
mSeekBarY.setProgress(100);
mSeekBarY.setOnSeekBarChangeListener(this);
mSeekBarX.setOnSeekBarChangeListener(this);
mChart = (LineChart) findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);
// if enabled, the chart will always start at zero on the y-axis
mChart.setStartAtZero(false);
// disable the drawing of values into the chart
mChart.setDrawYValues(false);
mChart.setDrawBorder(true);
mChart.setBorderPositions(new BorderPosition[] {
BorderPosition.BOTTOM
});
// no description text
mChart.setDescription("");
mChart.setNoDataTextDescription("You need to provide data for the chart.");
// // enable / disable grid lines
// mChart.setDrawVerticalGrid(false);
// mChart.setDrawHorizontalGrid(false);
//
// // enable / disable grid background
// mChart.setDrawGridBackground(false);
//
// mChart.setDrawXLegend(false);
// mChart.setDrawYLegend(false);
// enable value highlighting
mChart.setHighlightEnabled(true);
// enable touch gestures
mChart.setTouchEnabled(true);
// enable scaling and dragging
mChart.setDragScaleEnabled(true);
// if disabled, scaling can be done on x- and y-axis separately
mChart.setPinchZoom(true);
// set an alternative background color
// mChart.setBackgroundColor(Color.GRAY);
// create a custom MarkerView (extend MarkerView) and specify the layout
// to use for it
MyMarkerView mv = new MyMarkerView(this, R.layout.custom_marker_view);
// define an offset to change the original position of the marker
// (optional)
mv.setOffsets(-mv.getMeasuredWidth() / 2, -mv.getMeasuredHeight());
// set the marker to the chart
mChart.setMarkerView(mv);
// enable/disable highlight indicators (the lines that indicate the
// highlighted Entry)
mChart.setHighlightIndicatorEnabled(false);
// add data
setData(45, 100);
mChart.animateX(2500);
// // restrain the maximum scale-out factor
// mChart.setScaleMinima(3f, 3f);
//
// // center the view to a specific position inside the chart
// mChart.centerViewPort(10, 50);
// get the legend (only possible after setting data)
Legend l = mChart.getLegend();
// modify the legend ...
// l.setPosition(LegendPosition.LEFT_OF_CHART);
l.setForm(LegendForm.LINE);
// // dont forget to refresh the drawing
// mChart.invalidate();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.line, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.actionToggleValues: {
if (mChart.isDrawYValuesEnabled())
mChart.setDrawYValues(false);
else
mChart.setDrawYValues(true);
mChart.invalidate();
break;
}
case R.id.actionToggleHighlight: {
if (mChart.isHighlightEnabled())
mChart.setHighlightEnabled(false);
else
mChart.setHighlightEnabled(true);
mChart.invalidate();
break;
}
case R.id.actionToggleFilled: {
ArrayList<LineDataSet> sets = (ArrayList<LineDataSet>) mChart.getDataCurrent()
.getDataSets();
for (LineDataSet set : sets) {
if (set.isDrawFilledEnabled())
set.setDrawFilled(false);
else
set.setDrawFilled(true);
}
mChart.invalidate();
break;
}
case R.id.actionToggleCircles: {
ArrayList<LineDataSet> sets = (ArrayList<LineDataSet>) mChart.getDataCurrent()
.getDataSets();
for (LineDataSet set : sets) {
if (set.isDrawCirclesEnabled())
set.setDrawCircles(false);
else
set.setDrawCircles(true);
}
mChart.invalidate();
break;
}
case R.id.actionToggleCubic: {
ArrayList<LineDataSet> sets = (ArrayList<LineDataSet>) mChart.getDataCurrent()
.getDataSets();
for (LineDataSet set : sets) {
if (set.isDrawCubicEnabled())
set.setDrawCubic(false);
else
set.setDrawCubic(true);
}
mChart.invalidate();
break;
}
case R.id.actionToggleStartzero: {
if (mChart.isStartAtZeroEnabled())
mChart.setStartAtZero(false);
else
mChart.setStartAtZero(true);
mChart.invalidate();
break;
}
case R.id.actionTogglePinch: {
if (mChart.isPinchZoomEnabled())
mChart.setPinchZoom(false);
else
mChart.setPinchZoom(true);
mChart.invalidate();
break;
}
case R.id.animateX: {
mChart.animateX(3000);
break;
}
case R.id.animateY: {
mChart.animateY(3000);
break;
}
case R.id.animateXY: {
mChart.animateXY(3000, 3000);
break;
}
case R.id.actionToggleAdjustXLegend: {
XLabels xLabels = mChart.getXLabels();
if (xLabels.isAdjustXLabelsEnabled())
xLabels.setAdjustXLabels(false);
else
xLabels.setAdjustXLabels(true);
mChart.invalidate();
break;
}
case R.id.actionToggleFilter: {
// the angle of filtering is 35°
Approximator a = new Approximator(ApproximatorType.DOUGLAS_PEUCKER, 35);
if (!mChart.isFilteringEnabled()) {
mChart.enableFiltering(a);
} else {
mChart.disableFiltering();
}
mChart.invalidate();
//
// for(int i = 0; i < 10; i++) {
// mChart.addEntry(new Entry((float) (Math.random() * 100), i+2), 0);
// mChart.invalidate();
// }
//
// Toast.makeText(getApplicationContext(), "valcount: " + mChart.getDataOriginal().getYValCount() + ", valsum: " + mChart.getDataOriginal().getYValueSum(), Toast.LENGTH_SHORT).show();
//
break;
}
case R.id.actionSave: {
if (mChart.saveToPath("title" + System.currentTimeMillis(), "")) {
Toast.makeText(getApplicationContext(), "Saving SUCCESSFUL!",
Toast.LENGTH_SHORT).show();
} else
Toast.makeText(getApplicationContext(), "Saving FAILED!", Toast.LENGTH_SHORT)
.show();
// mChart.saveToGallery("title"+System.currentTimeMillis())
break;
}
}
return true;
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
tvX.setText("" + (mSeekBarX.getProgress() + 1));
tvY.setText("" + (mSeekBarY.getProgress()));
setData(mSeekBarX.getProgress() + 1, mSeekBarY.getProgress());
// redraw
mChart.invalidate();
}
@Override
public void onValueSelected(Entry e, int dataSetIndex) {
Log.i("VAL SELECTED",
"Value: " + e.getVal() + ", xIndex: " + e.getXIndex()
+ ", DataSet index: " + dataSetIndex);
}
@Override
public void onNothingSelected() {
// TODO Auto-generated method stub
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
private void setData(int count, float range) {
ArrayList<String> xVals = new ArrayList<String>();
for (int i = 0; i < count; i++) {
xVals.add((i) + "");
}
ArrayList<Entry> yVals = new ArrayList<Entry>();
for (int i = 0; i < count; i++) {
float mult = (range + 1);
float val = (float) (Math.random() * mult) + 3;// + (float)
// ((mult *
// 0.1) / 10);
yVals.add(new Entry(val, i));
}
// create a dataset and give it a type
LineDataSet set1 = new LineDataSet(yVals, "DataSet 1");
// set1.setFillAlpha(110);
// set1.setFillColor(Color.RED);
// set the line to be drawn like this "- - - - - -"
set1.enableDashedLine(10f, 5f, 0f);
set1.setColor(Color.BLACK);
set1.setCircleColor(Color.BLACK);
set1.setLineWidth(1f);
set1.setCircleSize(4f);
set1.setFillAlpha(65);
set1.setFillColor(Color.BLACK);
// set1.setShader(new LinearGradient(0, 0, 0, mChart.getHeight(), Color.BLACK, Color.WHITE, Shader.TileMode.MIRROR));
ArrayList<LineDataSet> dataSets = new ArrayList<LineDataSet>();
dataSets.add(set1); // add the datasets
// create a data object with the datasets
LineData data = new LineData(xVals, dataSets);
LimitLine ll1 = new LimitLine(130f);
ll1.setLineWidth(4f);
ll1.enableDashedLine(10f, 10f, 0f);
LimitLine ll2 = new LimitLine(-30f);
ll2.setLineWidth(4f);
ll2.enableDashedLine(10f, 10f, 0f);
data.addLimitLine(ll1);
data.addLimitLine(ll2);
// set data
mChart.setData(data);
}
}

View file

@ -1,149 +0,0 @@
package com.xxmassdeveloper.mpchartexample;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.WindowManager;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.utils.Legend;
import com.github.mikephil.charting.utils.Legend.LegendForm;
import com.github.mikephil.charting.utils.XLabels;
import com.github.mikephil.charting.utils.YLabels;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
public class LineChartActivityColored extends DemoBase {
private LineChart[] mCharts = new LineChart[4];
private Typeface mTf;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_colored_lines);
mCharts[0] = (LineChart) findViewById(R.id.chart1);
mCharts[1] = (LineChart) findViewById(R.id.chart2);
mCharts[2] = (LineChart) findViewById(R.id.chart3);
mCharts[3] = (LineChart) findViewById(R.id.chart4);
mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Bold.ttf");
LineData data = getData(36, 100);
for (int i = 0; i < mCharts.length; i++)
// add some transparency to the color with "& 0x90FFFFFF"
setupChart(mCharts[i], data, mColors[i % mColors.length]);
}
private int[] mColors = new int[] {
Color.rgb(137, 230, 81),
Color.rgb(240, 240, 30),
Color.rgb(89, 199, 250),
Color.rgb(250, 104, 104)
};
private void setupChart(LineChart chart, LineData data, int color) {
// if enabled, the chart will always start at zero on the y-axis
chart.setStartAtZero(true);
// disable the drawing of values into the chart
chart.setDrawYValues(false);
chart.setDrawBorder(false);
// no description text
chart.setDescription("");
chart.setNoDataTextDescription("You need to provide data for the chart.");
// enable / disable grid lines
chart.setDrawVerticalGrid(false);
// mChart.setDrawHorizontalGrid(false);
//
// enable / disable grid background
chart.setDrawGridBackground(false);
chart.setGridColor(Color.WHITE & 0x70FFFFFF);
chart.setGridWidth(1.25f);
// enable touch gestures
chart.setTouchEnabled(true);
// enable scaling and dragging
chart.setDragScaleEnabled(true);
// if disabled, scaling can be done on x- and y-axis separately
chart.setPinchZoom(false);
chart.setBackgroundColor(color);
chart.setValueTypeface(mTf);
// add data
chart.setData(data);
// get the legend (only possible after setting data)
Legend l = chart.getLegend();
// modify the legend ...
// l.setPosition(LegendPosition.LEFT_OF_CHART);
l.setForm(LegendForm.CIRCLE);
l.setFormSize(6f);
l.setTextColor(Color.WHITE);
l.setTypeface(mTf);
YLabels y = chart.getYLabels();
y.setTextColor(Color.WHITE);
y.setTypeface(mTf);
y.setLabelCount(4);
XLabels x = chart.getXLabels();
x.setTextColor(Color.WHITE);
x.setTypeface(mTf);
// animate calls invalidate()...
chart.animateX(2500);
}
private LineData getData(int count, float range) {
ArrayList<String> xVals = new ArrayList<String>();
for (int i = 0; i < count; i++) {
xVals.add(mMonths[i % 12]);
}
ArrayList<Entry> yVals = new ArrayList<Entry>();
for (int i = 0; i < count; i++) {
float val = (float) (Math.random() * range) + 3;
yVals.add(new Entry(val, i));
}
// create a dataset and give it a type
LineDataSet set1 = new LineDataSet(yVals, "DataSet 1");
// set1.setFillAlpha(110);
// set1.setFillColor(Color.RED);
set1.setLineWidth(1.75f);
set1.setCircleSize(3f);
set1.setColor(Color.WHITE);
set1.setCircleColor(Color.WHITE);
set1.setHighLightColor(Color.WHITE);
ArrayList<LineDataSet> dataSets = new ArrayList<LineDataSet>();
dataSets.add(set1); // add the datasets
// create a data object with the datasets
LineData data = new LineData(xVals, dataSets);
return data;
}
}

View file

@ -1,162 +0,0 @@
package com.xxmassdeveloper.mpchartexample;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.github.mikephil.charting.charts.BarChart;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.github.mikephil.charting.utils.XLabels;
import com.github.mikephil.charting.utils.XLabels.XLabelPosition;
import com.github.mikephil.charting.utils.YLabels;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
import java.util.List;
/**
* Demonstrates the use of charts inside a ListView. IMPORTANT: provide a
* specific height attribute for the chart inside your listview-item
*
* @author Philipp Jahoda
*/
public class ListViewBarChartActivity extends DemoBase {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_listview_chart);
ListView lv = (ListView) findViewById(R.id.listView1);
ArrayList<BarData> list = new ArrayList<BarData>();
// 20 items
for (int i = 0; i < 20; i++) {
list.add(generateData(i + 1));
}
ChartDataAdapter cda = new ChartDataAdapter(getApplicationContext(), list);
lv.setAdapter(cda);
}
private class ChartDataAdapter extends ArrayAdapter<BarData> {
private Typeface mTf;
public ChartDataAdapter(Context context, List<BarData> objects) {
super(context, 0, objects);
mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
BarData c = getItem(position);
ViewHolder holder = null;
if (convertView == null) {
holder = new ViewHolder();
convertView = LayoutInflater.from(getContext()).inflate(
R.layout.list_item_barchart, null);
holder.chart = (BarChart) convertView.findViewById(R.id.chart);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
// apply styling
holder.chart.setValueTypeface(mTf);
holder.chart.setDescription("");
holder.chart.setDrawVerticalGrid(false);
holder.chart.setDrawGridBackground(false);
holder.chart.setValueTextColor(Color.WHITE);
XLabels xl = holder.chart.getXLabels();
xl.setCenterXLabelText(true);
xl.setPosition(XLabelPosition.BOTTOM);
xl.setTypeface(mTf);
YLabels yl = holder.chart.getYLabels();
yl.setTypeface(mTf);
yl.setLabelCount(5);
// set data
holder.chart.setData(c);
// do not forget to refresh the chart
// holder.chart.invalidate();
holder.chart.animateY(700);
return convertView;
}
private class ViewHolder {
BarChart chart;
}
}
/**
* generates a random ChartData object with just one DataSet
*
* @return
*/
private BarData generateData(int cnt) {
ArrayList<BarEntry> entries = new ArrayList<BarEntry>();
for (int i = 0; i < 12; i++) {
entries.add(new BarEntry((int) (Math.random() * 70) + 30, i));
}
BarDataSet d = new BarDataSet(entries, "New DataSet " + cnt);
d.setBarSpacePercent(20f);
d.setColors(ColorTemplate.VORDIPLOM_COLORS, getApplicationContext());
d.setBarShadowColor(Color.rgb(203, 203, 203));
ArrayList<BarDataSet> sets = new ArrayList<BarDataSet>();
sets.add(d);
BarData cd = new BarData(getMonths(), sets);
return cd;
}
private ArrayList<String> getMonths() {
ArrayList<String> m = new ArrayList<String>();
m.add("Jan");
m.add("Feb");
m.add("Mar");
m.add("Apr");
m.add("May");
m.add("Jun");
m.add("Jul");
m.add("Aug");
m.add("Sep");
m.add("Okt");
m.add("Nov");
m.add("Dec");
return m;
}
}

View file

@ -1,260 +0,0 @@
package com.xxmassdeveloper.mpchartexample;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.data.filter.Approximator;
import com.github.mikephil.charting.data.filter.Approximator.ApproximatorType;
import com.github.mikephil.charting.interfaces.OnChartValueSelectedListener;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.github.mikephil.charting.utils.Legend;
import com.github.mikephil.charting.utils.Legend.LegendPosition;
import com.github.mikephil.charting.utils.XLabels;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
public class MultiLineChartActivity extends DemoBase implements OnSeekBarChangeListener,
OnChartValueSelectedListener {
private LineChart mChart;
private SeekBar mSeekBarX, mSeekBarY;
private TextView tvX, tvY;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_linechart);
tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarX.setOnSeekBarChangeListener(this);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarY.setOnSeekBarChangeListener(this);
mChart = (LineChart) findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);
// mChart.setStartAtZero(true);
// disable the drawing of values into the chart
mChart.setDrawYValues(false);
// enable value highlighting
mChart.setHighlightEnabled(true);
// enable touch gestures
mChart.setTouchEnabled(true);
// enable scaling and dragging
mChart.setDragScaleEnabled(true);
// if disabled, scaling can be done on x- and y-axis separately
mChart.setPinchZoom(false);
mSeekBarX.setProgress(20);
mSeekBarY.setProgress(100);
Legend l = mChart.getLegend();
l.setPosition(LegendPosition.RIGHT_OF_CHART);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.line, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.actionToggleValues: {
if (mChart.isDrawYValuesEnabled())
mChart.setDrawYValues(false);
else
mChart.setDrawYValues(true);
mChart.invalidate();
break;
}
case R.id.actionTogglePinch: {
if (mChart.isPinchZoomEnabled())
mChart.setPinchZoom(false);
else
mChart.setPinchZoom(true);
mChart.invalidate();
break;
}
case R.id.actionToggleHighlight: {
if (mChart.isHighlightEnabled())
mChart.setHighlightEnabled(false);
else
mChart.setHighlightEnabled(true);
mChart.invalidate();
break;
}
case R.id.actionToggleFilled: {
ArrayList<LineDataSet> sets = (ArrayList<LineDataSet>) mChart.getDataCurrent()
.getDataSets();
for (LineDataSet set : sets) {
if (set.isDrawFilledEnabled())
set.setDrawFilled(false);
else
set.setDrawFilled(true);
}
mChart.invalidate();
break;
}
case R.id.actionToggleCircles: {
ArrayList<LineDataSet> sets = (ArrayList<LineDataSet>) mChart.getDataCurrent()
.getDataSets();
for (LineDataSet set : sets) {
if (set.isDrawCirclesEnabled())
set.setDrawCircles(false);
else
set.setDrawCircles(true);
}
mChart.invalidate();
break;
}
case R.id.actionToggleFilter: {
// the angle of filtering is 35°
Approximator a = new Approximator(ApproximatorType.DOUGLAS_PEUCKER, 35);
if (!mChart.isFilteringEnabled()) {
mChart.enableFiltering(a);
} else {
mChart.disableFiltering();
}
mChart.invalidate();
break;
}
case R.id.actionToggleStartzero: {
if (mChart.isStartAtZeroEnabled())
mChart.setStartAtZero(false);
else
mChart.setStartAtZero(true);
mChart.invalidate();
break;
}
case R.id.actionToggleAdjustXLegend: {
XLabels xLabels = mChart.getXLabels();
if (xLabels.isAdjustXLabelsEnabled())
xLabels.setAdjustXLabels(false);
else
xLabels.setAdjustXLabels(true);
mChart.invalidate();
break;
}
case R.id.actionSave: {
// mChart.saveToGallery("title"+System.currentTimeMillis());
mChart.saveToPath("title" + System.currentTimeMillis(), "");
break;
}
case R.id.animateX: {
mChart.animateX(3000);
break;
}
case R.id.animateY: {
mChart.animateY(3000);
break;
}
case R.id.animateXY: {
mChart.animateXY(3000, 3000);
break;
}
}
return true;
}
private int[] mColors = new int[] {
ColorTemplate.VORDIPLOM_COLORS[0],
ColorTemplate.VORDIPLOM_COLORS[1],
ColorTemplate.VORDIPLOM_COLORS[2]
};
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
tvX.setText("" + (mSeekBarX.getProgress() + 1));
tvY.setText("" + (mSeekBarY.getProgress()));
ArrayList<String> xVals = new ArrayList<String>();
for (int i = 0; i < mSeekBarX.getProgress(); i++) {
xVals.add((i) + "");
}
ArrayList<LineDataSet> dataSets = new ArrayList<LineDataSet>();
for (int z = 0; z < 3; z++) {
ArrayList<Entry> values = new ArrayList<Entry>();
for (int i = 0; i < mSeekBarX.getProgress(); i++) {
double val = (Math.random() * mSeekBarY.getProgress()) + 3;
values.add(new Entry((float) val, i));
}
LineDataSet d = new LineDataSet(values, "DataSet " + (z + 1));
d.setLineWidth(2.5f);
d.setCircleSize(4f);
int color = mColors[z % mColors.length];
d.setColor(color);
d.setCircleColor(color);
dataSets.add(d);
}
// make the first DataSet dashed
dataSets.get(0).enableDashedLine(10, 10, 0);
LineData data = new LineData(xVals, dataSets);
mChart.setData(data);
mChart.invalidate();
}
@Override
public void onValueSelected(Entry e, int dataSetIndex) {
Log.i("VAL SELECTED",
"Value: " + e.getVal() + ", xIndex: " + e.getXIndex()
+ ", DataSet index: " + dataSetIndex);
}
@Override
public void onNothingSelected() {
// TODO Auto-generated method stub
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
}

View file

@ -1,37 +0,0 @@
package com.xxmassdeveloper.mpchartexample;
import android.content.Context;
import android.widget.TextView;
import com.github.mikephil.charting.data.CandleEntry;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.utils.MarkerView;
import com.github.mikephil.charting.utils.Utils;
public class MyMarkerView extends MarkerView {
private TextView tvContent;
public MyMarkerView(Context context, int layoutResource) {
super(context, layoutResource);
tvContent = (TextView) findViewById(R.id.tvContent);
}
// callbacks everytime the MarkerView is redrawn, can be used to update the
// content
@Override
public void refreshContent(Entry e, int dataSetIndex) {
if(e instanceof CandleEntry) {
CandleEntry ce = (CandleEntry) e;
tvContent.setText("" + Utils.formatNumber(ce.getHigh(), 0, true));
} else {
tvContent.setText("" + Utils.formatNumber(e.getVal(), 0, true));
}
}
}

View file

@ -1,18 +0,0 @@
package com.xxmassdeveloper.mpchartexample;
import com.github.mikephil.charting.utils.ValueFormatter;
import java.text.DecimalFormat;
public class MyValueFormatter implements ValueFormatter {
DecimalFormat mFormatter = new DecimalFormat("###,###,###");
@Override
public String getFormattedValue(float value) {
// do here whatever you want, avoid excessive calculations and memory
// allocations
return mFormatter.format(value);
}
}

View file

@ -1,240 +0,0 @@
package com.xxmassdeveloper.mpchartexample;
import android.graphics.Typeface;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import com.github.mikephil.charting.charts.PieChart;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.PieData;
import com.github.mikephil.charting.data.PieDataSet;
import com.github.mikephil.charting.interfaces.OnChartValueSelectedListener;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.github.mikephil.charting.utils.Legend;
import com.github.mikephil.charting.utils.Legend.LegendPosition;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
public class PieChartActivity extends DemoBase implements OnSeekBarChangeListener,
OnChartValueSelectedListener {
private PieChart mChart;
private SeekBar mSeekBarX, mSeekBarY;
private TextView tvX, tvY;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_piechart);
tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarX.setOnSeekBarChangeListener(this);
mSeekBarY.setOnSeekBarChangeListener(this);
mChart = (PieChart) findViewById(R.id.chart1);
Typeface tf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
mChart.setValueTypeface(tf);
mChart.setCenterTextTypeface(Typeface.createFromAsset(getAssets(), "OpenSans-Light.ttf"));
mChart.setHoleRadius(60f);
mChart.setDescription("");
mChart.setDrawYValues(true);
mChart.setDrawCenterText(true);
mChart.setDrawHoleEnabled(true);
mChart.setRotationAngle(0);
// draws the corresponding description value into the slice
mChart.setDrawXValues(true);
// enable rotation of the chart by touch
mChart.setRotationEnabled(true);
// display percentage values
mChart.setUsePercentValues(true);
// mChart.setUnit("");
// mChart.setDrawUnitsInChart(true);
// add a selection listener
mChart.setOnChartValueSelectedListener(this);
// mChart.setTouchEnabled(false);
setData(3, 100);
mChart.animateXY(1500, 1500);
// mChart.spin(2000, 0, 360);
Legend l = mChart.getLegend();
l.setPosition(LegendPosition.RIGHT_OF_CHART);
l.setXEntrySpace(7f);
l.setYEntrySpace(5f);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.pie, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.actionToggleValues: {
if (mChart.isDrawYValuesEnabled())
mChart.setDrawYValues(false);
else
mChart.setDrawYValues(true);
mChart.invalidate();
break;
}
case R.id.actionTogglePercent: {
if (mChart.isUsePercentValuesEnabled())
mChart.setUsePercentValues(false);
else
mChart.setUsePercentValues(true);
mChart.invalidate();
break;
}
case R.id.actionToggleHole: {
if (mChart.isDrawHoleEnabled())
mChart.setDrawHoleEnabled(false);
else
mChart.setDrawHoleEnabled(true);
mChart.invalidate();
break;
}
case R.id.actionDrawCenter: {
if (mChart.isDrawCenterTextEnabled())
mChart.setDrawCenterText(false);
else
mChart.setDrawCenterText(true);
mChart.invalidate();
break;
}
case R.id.actionToggleXVals: {
if (mChart.isDrawXValuesEnabled())
mChart.setDrawXValues(false);
else
mChart.setDrawXValues(true);
mChart.invalidate();
break;
}
case R.id.actionSave: {
// mChart.saveToGallery("title"+System.currentTimeMillis());
mChart.saveToPath("title" + System.currentTimeMillis(), "");
break;
}
case R.id.animateX: {
mChart.animateX(1800);
break;
}
case R.id.animateY: {
mChart.animateY(1800);
break;
}
case R.id.animateXY: {
mChart.animateXY(1800, 1800);
break;
}
}
return true;
}
private String[] mParties = new String[] {
"Party A", "Party B", "Party C", "Party D", "Party E"
};
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
tvX.setText("" + (mSeekBarX.getProgress() + 1));
tvY.setText("" + (mSeekBarY.getProgress()));
setData(mSeekBarX.getProgress(), mSeekBarY.getProgress());
}
private void setData(int count, float range) {
float mult = range;
ArrayList<Entry> yVals1 = new ArrayList<Entry>();
// ArrayList<Entry> yVals2 = new ArrayList<Entry>();
// IMPORTANT: In a PieChart, no values (Entry) should have the same
// xIndex (even if from different DataSets), since no values can be
// drawn above each other.
for (int i = 0; i < count + 1; i++) {
yVals1.add(new Entry((float) (Math.random() * mult) + mult / 5, i));
}
// for (int i = mSeekBarX.getProgress() / 2; i <
// mSeekBarX.getProgress(); i++) {
// yVals2.add(new Entry((float) (Math.random() * mult) + mult / 5, i));
// }
ArrayList<String> xVals = new ArrayList<String>();
for (int i = 0; i < count + 1; i++)
xVals.add(mParties[i % mParties.length]);
PieDataSet set1 = new PieDataSet(yVals1, "Election Results");
set1.setSliceSpace(3f);
set1.setColors(ColorTemplate.VORDIPLOM_COLORS);
PieData data = new PieData(xVals, set1);
mChart.setData(data);
// undo all highlights
mChart.highlightValues(null);
// set a text for the chart center
mChart.setCenterText("Total Value\n" + (int) mChart.getYValueSum() + "\n(all slices)");
mChart.invalidate();
}
@Override
public void onValueSelected(Entry e, int dataSetIndex) {
Log.i("VAL SELECTED",
"Value: " + e.getVal() + ", xIndex: " + e.getXIndex()
+ ", DataSet index: " + dataSetIndex);
}
@Override
public void onNothingSelected() {
Log.i("PieChart", "nothing selected");
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
}

View file

@ -1,216 +0,0 @@
package com.xxmassdeveloper.mpchartexample;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.Toast;
import com.github.mikephil.charting.charts.RadarChart;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.RadarData;
import com.github.mikephil.charting.data.RadarDataSet;
import com.github.mikephil.charting.utils.Legend;
import com.github.mikephil.charting.utils.Legend.LegendPosition;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.github.mikephil.charting.utils.XLabels;
import com.github.mikephil.charting.utils.YLabels;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
public class RadarChartActivitry extends DemoBase {
private RadarChart mChart;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_radarchart);
mChart = (RadarChart) findViewById(R.id.chart1);
Typeface tf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
mChart.setValueTypeface(tf);
mChart.setDescription("");
mChart.setUnit(" $");
mChart.setDrawUnitsInChart(true);
mChart.setWebLineWidth(1.5f);
mChart.setWebLineWidthInner(0.75f);
mChart.setWebAlpha(100);
mChart.setDrawYValues(false);
// create a custom MarkerView (extend MarkerView) and specify the layout
// to use for it
MyMarkerView mv = new MyMarkerView(this, R.layout.custom_marker_view);
// define an offset to change the original position of the marker
// (optional)
mv.setOffsets(-mv.getMeasuredWidth() / 2, -mv.getMeasuredHeight());
// set the marker to the chart
mChart.setMarkerView(mv);
setData();
XLabels xl = mChart.getXLabels();
xl.setTypeface(tf);
xl.setTextSize(9f);
YLabels yl = mChart.getYLabels();
yl.setTypeface(tf);
yl.setLabelCount(5);
yl.setTextSize(9f);
yl.setDrawUnitsInYLabel(true);
// mChart.animateXY(1500, 1500);
Legend l = mChart.getLegend();
l.setPosition(LegendPosition.RIGHT_OF_CHART);
l.setTypeface(tf);
l.setXEntrySpace(7f);
l.setYEntrySpace(5f);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.radar, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.actionToggleValues: {
if (mChart.isDrawYValuesEnabled())
mChart.setDrawYValues(false);
else
mChart.setDrawYValues(true);
mChart.invalidate();
break;
}
case R.id.actionToggleHighlight: {
if (mChart.isHighlightEnabled())
mChart.setHighlightEnabled(false);
else
mChart.setHighlightEnabled(true);
mChart.invalidate();
break;
}
case R.id.actionToggleRotate: {
if (mChart.isRotationEnabled())
mChart.setRotationEnabled(false);
else
mChart.setRotationEnabled(true);
mChart.invalidate();
break;
}
case R.id.actionToggleFilled: {
ArrayList<RadarDataSet> sets = (ArrayList<RadarDataSet>) mChart.getDataCurrent()
.getDataSets();
for (RadarDataSet set : sets) {
if (set.isDrawFilledEnabled())
set.setDrawFilled(false);
else
set.setDrawFilled(true);
}
mChart.invalidate();
break;
}
case R.id.actionSave: {
if (mChart.saveToPath("title" + System.currentTimeMillis(), "")) {
Toast.makeText(getApplicationContext(), "Saving SUCCESSFUL!",
Toast.LENGTH_SHORT).show();
} else
Toast.makeText(getApplicationContext(), "Saving FAILED!", Toast.LENGTH_SHORT)
.show();
break;
}
case R.id.actionToggleXLabels: {
if (mChart.isDrawXLabelsEnabled())
mChart.setDrawXLabels(false);
else
mChart.setDrawXLabels(true);
mChart.invalidate();
break;
}
case R.id.actionToggleYLabels: {
if (mChart.isDrawYLabelsEnabled())
mChart.setDrawYLabels(false);
else
mChart.setDrawYLabels(true);
mChart.invalidate();
break;
}
case R.id.actionToggleSpin: {
mChart.spin(2000, mChart.getRotationAngle(), mChart.getRotationAngle() + 360);
break;
}
}
return true;
}
private String[] mParties = new String[] {
"Party A", "Party B", "Party C", "Party D", "Party E", "Party F", "Party G", "Party H",
"Party I"
};
public void setData() {
float mult = 150;
int cnt = 9;
ArrayList<Entry> yVals1 = new ArrayList<Entry>();
ArrayList<Entry> yVals2 = new ArrayList<Entry>();
// IMPORTANT: In a PieChart, no values (Entry) should have the same
// xIndex (even if from different DataSets), since no values can be
// drawn above each other.
for (int i = 0; i < cnt; i++) {
yVals1.add(new Entry((float) (Math.random() * mult) + mult / 2, i));
}
for (int i = 0; i < cnt; i++) {
yVals2.add(new Entry((float) (Math.random() * mult) + mult / 2, i));
}
ArrayList<String> xVals = new ArrayList<String>();
for (int i = 0; i < cnt; i++)
xVals.add(mParties[i % mParties.length]);
RadarDataSet set1 = new RadarDataSet(yVals1, "Set 1");
set1.setColor(ColorTemplate.VORDIPLOM_COLORS[0]);
set1.setDrawFilled(true);
set1.setLineWidth(2f);
RadarDataSet set2 = new RadarDataSet(yVals2, "Set 2");
set2.setColor(ColorTemplate.VORDIPLOM_COLORS[4]);
set2.setDrawFilled(true);
set2.setLineWidth(2f);
ArrayList<RadarDataSet> sets = new ArrayList<RadarDataSet>();
sets.add(set1);
sets.add(set2);
RadarData data = new RadarData(xVals, sets);
mChart.setData(data);
// undo all highlights
mChart.highlightValues(null);
mChart.invalidate();
}
}

View file

@ -1,257 +0,0 @@
package com.xxmassdeveloper.mpchartexample;
import android.graphics.Typeface;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import com.github.mikephil.charting.charts.ScatterChart;
import com.github.mikephil.charting.charts.ScatterChart.ScatterShape;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.ScatterData;
import com.github.mikephil.charting.data.ScatterDataSet;
import com.github.mikephil.charting.data.filter.Approximator;
import com.github.mikephil.charting.data.filter.Approximator.ApproximatorType;
import com.github.mikephil.charting.interfaces.OnChartValueSelectedListener;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.github.mikephil.charting.utils.Legend;
import com.github.mikephil.charting.utils.Legend.LegendPosition;
import com.github.mikephil.charting.utils.XLabels;
import com.github.mikephil.charting.utils.YLabels;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
public class ScatterChartActivity extends DemoBase implements OnSeekBarChangeListener,
OnChartValueSelectedListener {
private ScatterChart mChart;
private SeekBar mSeekBarX, mSeekBarY;
private TextView tvX, tvY;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_scatterchart);
tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarX.setOnSeekBarChangeListener(this);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarY.setOnSeekBarChangeListener(this);
mChart = (ScatterChart) findViewById(R.id.chart1);
mChart.setDescription("");
Typeface tf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
mChart.setValueTypeface(tf);
mChart.setOnChartValueSelectedListener(this);
mChart.setDrawGridBackground(false);
mChart.setTouchEnabled(true);
mChart.setHighlightEnabled(true);
mChart.setDrawYValues(false);
mChart.setDragScaleEnabled(true);
mChart.setMaxVisibleValueCount(200);
mChart.setPinchZoom(true);
mSeekBarX.setProgress(45);
mSeekBarY.setProgress(100);
Legend l = mChart.getLegend();
l.setPosition(LegendPosition.RIGHT_OF_CHART);
l.setTypeface(tf);
YLabels yl = mChart.getYLabels();
yl.setTypeface(tf);
XLabels xl = mChart.getXLabels();
xl.setTypeface(tf);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.scatter, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.actionToggleValues: {
if (mChart.isDrawYValuesEnabled())
mChart.setDrawYValues(false);
else
mChart.setDrawYValues(true);
mChart.invalidate();
break;
}
case R.id.actionToggleHighlight: {
if (mChart.isHighlightEnabled())
mChart.setHighlightEnabled(false);
else
mChart.setHighlightEnabled(true);
mChart.invalidate();
break;
}
case R.id.actionTogglePinch: {
if (mChart.isPinchZoomEnabled())
mChart.setPinchZoom(false);
else
mChart.setPinchZoom(true);
mChart.invalidate();
break;
}
case R.id.actionToggleStartzero: {
if (mChart.isStartAtZeroEnabled())
mChart.setStartAtZero(false);
else
mChart.setStartAtZero(true);
mChart.invalidate();
break;
}
case R.id.actionToggleAdjustXLegend: {
XLabels xLabels = mChart.getXLabels();
if (xLabels.isAdjustXLabelsEnabled())
xLabels.setAdjustXLabels(false);
else
xLabels.setAdjustXLabels(true);
mChart.invalidate();
break;
}
case R.id.actionToggleFilter: {
Approximator a = new Approximator(ApproximatorType.DOUGLAS_PEUCKER, 25);
if (!mChart.isFilteringEnabled()) {
mChart.enableFiltering(a);
} else {
mChart.disableFiltering();
}
mChart.invalidate();
break;
}
case R.id.actionSave: {
// mChart.saveToGallery("title"+System.currentTimeMillis());
mChart.saveToPath("title" + System.currentTimeMillis(), "");
break;
}
case R.id.animateX: {
mChart.animateX(3000);
break;
}
case R.id.animateY: {
mChart.animateY(3000);
break;
}
case R.id.animateXY: {
mChart.animateXY(3000, 3000);
break;
}
}
return true;
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
tvX.setText("" + (mSeekBarX.getProgress() + 1));
tvY.setText("" + (mSeekBarY.getProgress()));
ArrayList<String> xVals = new ArrayList<String>();
for (int i = 0; i < mSeekBarX.getProgress(); i++) {
xVals.add((i) + "");
}
ArrayList<Entry> yVals1 = new ArrayList<Entry>();
ArrayList<Entry> yVals2 = new ArrayList<Entry>();
ArrayList<Entry> yVals3 = new ArrayList<Entry>();
for (int i = 0; i < mSeekBarX.getProgress(); i++) {
float val = (float) (Math.random() * mSeekBarY.getProgress()) + 3;
yVals1.add(new Entry(val, i));
}
for (int i = 0; i < mSeekBarX.getProgress(); i++) {
float val = (float) (Math.random() * mSeekBarY.getProgress()) + 3;
yVals2.add(new Entry(val, i));
}
for (int i = 0; i < mSeekBarX.getProgress(); i++) {
float val = (float) (Math.random() * mSeekBarY.getProgress()) + 3;
yVals3.add(new Entry(val, i));
}
// create a dataset and give it a type
ScatterDataSet set1 = new ScatterDataSet(yVals1, "DS 1");
set1.setScatterShape(ScatterShape.SQUARE);
set1.setColor(ColorTemplate.COLORFUL_COLORS[0]);
ScatterDataSet set2 = new ScatterDataSet(yVals2, "DS 2");
set2.setScatterShape(ScatterShape.CIRCLE);
set2.setColor(ColorTemplate.COLORFUL_COLORS[1]);
ScatterDataSet set3 = new ScatterDataSet(yVals3, "DS 3");
set3.setScatterShape(ScatterShape.TRIANGLE);
set3.setColor(ColorTemplate.COLORFUL_COLORS[2]);
set1.setScatterShapeSize(8f);
set2.setScatterShapeSize(8f);
set3.setScatterShapeSize(8f);
ArrayList<ScatterDataSet> dataSets = new ArrayList<ScatterDataSet>();
dataSets.add(set1); // add the datasets
dataSets.add(set2);
dataSets.add(set3);
// create a data object with the datasets
ScatterData data = new ScatterData(xVals, dataSets);
mChart.setData(data);
mChart.invalidate();
}
@Override
public void onValueSelected(Entry e, int dataSetIndex) {
Log.i("VAL SELECTED",
"Value: " + e.getVal() + ", xIndex: " + e.getXIndex()
+ ", DataSet index: " + dataSetIndex);
}
@Override
public void onNothingSelected() {
// TODO Auto-generated method stub
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
}

View file

@ -1,282 +0,0 @@
package com.xxmassdeveloper.mpchartexample;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import android.widget.Toast;
import com.github.mikephil.charting.charts.BarChart;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.filter.Approximator;
import com.github.mikephil.charting.data.filter.Approximator.ApproximatorType;
import com.github.mikephil.charting.interfaces.OnChartValueSelectedListener;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.github.mikephil.charting.utils.Legend;
import com.github.mikephil.charting.utils.Legend.LegendPosition;
import com.github.mikephil.charting.utils.XLabels;
import com.github.mikephil.charting.utils.XLabels.XLabelPosition;
import com.github.mikephil.charting.utils.YLabels;
import com.github.mikephil.charting.utils.YLabels.YLabelPosition;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.text.DecimalFormat;
import java.util.ArrayList;
public class StackedBarActivity extends DemoBase implements OnSeekBarChangeListener,
OnChartValueSelectedListener {
private BarChart mChart;
private SeekBar mSeekBarX, mSeekBarY;
private TextView tvX, tvY;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_barchart);
tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarX.setOnSeekBarChangeListener(this);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarY.setOnSeekBarChangeListener(this);
mChart = (BarChart) findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);
// enable the drawing of values
mChart.setDrawYValues(true);
mChart.setDescription("");
// if more than 60 entries are displayed in the chart, no values will be
// drawn
mChart.setMaxVisibleValueCount(60);
MyValueFormatter customFormatter = new MyValueFormatter();
// set a custom formatter for the values inside the chart
mChart.setValueFormatter(customFormatter);
// if false values are only drawn for the stack sum, else each value is drawn
mChart.setDrawValuesForWholeStack(true);
// disable 3D
mChart.set3DEnabled(false);
// scaling can now only be done on x- and y-axis separately
mChart.setPinchZoom(false);
mChart.setDrawBarShadow(false);
// change the position of the y-labels
YLabels yLabels = mChart.getYLabels();
yLabels.setPosition(YLabelPosition.BOTH_SIDED);
yLabels.setLabelCount(5);
yLabels.setFormatter(customFormatter);
XLabels xLabels = mChart.getXLabels();
xLabels.setPosition(XLabelPosition.TOP);
xLabels.setCenterXLabelText(true);
// mChart.setDrawXLabels(false);
// mChart.setDrawYLabels(false);
// setting data
mSeekBarX.setProgress(12);
mSeekBarY.setProgress(100);
Legend l = mChart.getLegend();
l.setPosition(LegendPosition.BELOW_CHART_RIGHT);
l.setFormSize(8f);
l.setFormToTextSpace(4f);
l.setXEntrySpace(6f);
// mChart.setDrawLegend(false);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.bar, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.actionToggleValues: {
if (mChart.isDrawYValuesEnabled())
mChart.setDrawYValues(false);
else
mChart.setDrawYValues(true);
mChart.invalidate();
break;
}
case R.id.actionToggle3D: {
if (mChart.is3DEnabled())
mChart.set3DEnabled(false);
else
mChart.set3DEnabled(true);
mChart.invalidate();
break;
}
case R.id.actionToggleHighlight: {
if (mChart.isHighlightEnabled())
mChart.setHighlightEnabled(false);
else
mChart.setHighlightEnabled(true);
mChart.invalidate();
break;
}
case R.id.actionTogglePinch: {
if (mChart.isPinchZoomEnabled())
mChart.setPinchZoom(false);
else
mChart.setPinchZoom(true);
mChart.invalidate();
break;
}
case R.id.actionToggleHighlightArrow: {
if (mChart.isDrawHighlightArrowEnabled())
mChart.setDrawHighlightArrow(false);
else
mChart.setDrawHighlightArrow(true);
mChart.invalidate();
break;
}
case R.id.actionToggleStartzero: {
if (mChart.isStartAtZeroEnabled())
mChart.setStartAtZero(false);
else
mChart.setStartAtZero(true);
mChart.invalidate();
break;
}
case R.id.actionToggleAdjustXLegend: {
XLabels xLabels = mChart.getXLabels();
if (xLabels.isAdjustXLabelsEnabled())
xLabels.setAdjustXLabels(false);
else
xLabels.setAdjustXLabels(true);
mChart.invalidate();
break;
}
case R.id.animateX: {
mChart.animateX(3000);
break;
}
case R.id.animateY: {
mChart.animateY(3000);
break;
}
case R.id.animateXY: {
mChart.animateXY(3000, 3000);
break;
}
case R.id.actionToggleFilter: {
Approximator a = new Approximator(ApproximatorType.DOUGLAS_PEUCKER, 25);
if (!mChart.isFilteringEnabled()) {
mChart.enableFiltering(a);
} else {
mChart.disableFiltering();
}
mChart.invalidate();
break;
}
case R.id.actionSave: {
if (mChart.saveToGallery("title" + System.currentTimeMillis(), 50)) {
Toast.makeText(getApplicationContext(), "Saving SUCCESSFUL!",
Toast.LENGTH_SHORT).show();
} else
Toast.makeText(getApplicationContext(), "Saving FAILED!", Toast.LENGTH_SHORT)
.show();
break;
}
}
return true;
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
tvX.setText("" + (mSeekBarX.getProgress() + 1));
tvY.setText("" + (mSeekBarY.getProgress()));
ArrayList<String> xVals = new ArrayList<String>();
for (int i = 0; i < mSeekBarX.getProgress()+1; i++) {
xVals.add(mMonths[i % mMonths.length]);
}
ArrayList<BarEntry> yVals1 = new ArrayList<BarEntry>();
for (int i = 0; i < mSeekBarX.getProgress()+1; i++) {
float mult = (mSeekBarY.getProgress() + 1);
float val1 = (float) (Math.random() * mult) + mult / 3;
float val2 = (float) (Math.random() * mult) + mult / 3;
float val3 = (float) (Math.random() * mult) + mult / 3;
yVals1.add(new BarEntry(new float[] {
val1, val2, val3
}, i));
}
BarDataSet set1 = new BarDataSet(yVals1, "Statistics Vienna 2014");
set1.setColors(ColorTemplate.VORDIPLOM_COLORS);
set1.setStackLabels(new String[] {
"Births", "Divorces", "Marriages"
});
ArrayList<BarDataSet> dataSets = new ArrayList<BarDataSet>();
dataSets.add(set1);
BarData data = new BarData(xVals, dataSets);
mChart.setData(data);
mChart.invalidate();
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
@Override
public void onValueSelected(Entry e, int dataSetIndex) {
Log.i("VAL SELECTED",
"Value: " + e.getVal() + ", xIndex: " + e.getXIndex()
+ ", DataSet index: " + dataSetIndex);
}
@Override
public void onNothingSelected() {
// TODO Auto-generated method stub
}
}

View file

@ -1,65 +0,0 @@
package com.xxmassdeveloper.mpchartexample.fragments;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import com.github.mikephil.charting.charts.BarChart;
import com.github.mikephil.charting.utils.Legend;
import com.github.mikephil.charting.utils.YLabels;
import com.xxmassdeveloper.mpchartexample.MyMarkerView;
import com.xxmassdeveloper.mpchartexample.R;
public class BarChartFrag extends SimpleFragment {
public static Fragment newInstance() {
return new BarChartFrag();
}
private BarChart mChart;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.frag_simple_bar, container, false);
// create a new chart object
mChart = new BarChart(getActivity());
mChart.setDescription("");
MyMarkerView mv = new MyMarkerView(getActivity(), R.layout.custom_marker_view);
mv.setOffsets(-mv.getMeasuredWidth() / 2, -mv.getMeasuredHeight());
mChart.setMarkerView(mv);
mChart.setHighlightIndicatorEnabled(false);
mChart.setDrawBorder(false);
// mChart.setBorderStyles(new BorderStyle[] { BorderStyle.LEFT });
mChart.setDrawGridBackground(false);
mChart.setDrawVerticalGrid(false);
mChart.setDrawXLabels(false);
mChart.setDrawYValues(false);
mChart.setUnit("");
mChart.setDrawBarShadow(false);
Typeface tf = Typeface.createFromAsset(getActivity().getAssets(),"OpenSans-Light.ttf");
mChart.setData(generateBarData(1, 20000, 12));
Legend l = mChart.getLegend();
l.setTypeface(tf);
YLabels labels = mChart.getYLabels();
labels.setTypeface(tf);
// labels.setPosition(YLabelPosition.BOTH_SIDED);
// programatically add the chart
FrameLayout parent = (FrameLayout) v.findViewById(R.id.parentLayout);
parent.addView(mChart);
return v;
}
}

View file

@ -1,56 +0,0 @@
package com.xxmassdeveloper.mpchartexample.fragments;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.utils.Legend;
import com.github.mikephil.charting.utils.YLabels;
import com.xxmassdeveloper.mpchartexample.R;
public class ComplexityFragment extends SimpleFragment {
public static Fragment newInstance() {
return new ComplexityFragment();
}
private LineChart mChart;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.frag_simple_line, container, false);
mChart = (LineChart) v.findViewById(R.id.lineChart1);
mChart.setDescription("");
mChart.setDrawYValues(false);
mChart.setHighlightIndicatorEnabled(false);
mChart.setDrawBorder(false);
mChart.setDrawGridBackground(false);
mChart.setDrawVerticalGrid(false);
mChart.setDrawXLabels(false);
mChart.setDrawYValues(false);
mChart.setStartAtZero(false);
mChart.setData(getComplexity());
mChart.animateX(3000);
// mChart.setScaleMinima(3f, 3f);
// mChart.centerViewPort(300, 0);
Typeface tf = Typeface.createFromAsset(getActivity().getAssets(),"OpenSans-Light.ttf");
Legend l = mChart.getLegend();
l.setTypeface(tf);
YLabels labels = mChart.getYLabels();
labels.setTypeface(tf);
return v;
}
}

View file

@ -1,53 +0,0 @@
package com.xxmassdeveloper.mpchartexample.fragments;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.github.mikephil.charting.charts.PieChart;
import com.github.mikephil.charting.utils.Legend;
import com.github.mikephil.charting.utils.Legend.LegendPosition;
import com.xxmassdeveloper.mpchartexample.R;
public class PieChartFrag extends SimpleFragment {
public static Fragment newInstance() {
return new PieChartFrag();
}
private PieChart mChart;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.frag_simple_pie, container, false);
mChart = (PieChart) v.findViewById(R.id.pieChart1);
mChart.setDescription("");
Typeface tf = Typeface.createFromAsset(getActivity().getAssets(), "OpenSans-Regular.ttf");
mChart.setValueTypeface(tf);
mChart.setCenterTextTypeface(Typeface.createFromAsset(getActivity().getAssets(), "OpenSans-Light.ttf"));
mChart.setUsePercentValues(true);
mChart.setCenterText("Quarterly\nRevenue");
mChart.setCenterTextSize(22f);
// radius of the center hole in percent of maximum radius
mChart.setHoleRadius(45f);
mChart.setTransparentCircleRadius(50f);
// enable / disable drawing of x- and y-values
// mChart.setDrawYValues(false);
// mChart.setDrawXValues(false);
mChart.setData(generatePieData());
Legend l = mChart.getLegend();
l.setPosition(LegendPosition.RIGHT_OF_CHART);
return v;
}
}

View file

@ -1,57 +0,0 @@
package com.xxmassdeveloper.mpchartexample.fragments;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.github.mikephil.charting.charts.ScatterChart;
import com.github.mikephil.charting.utils.Legend;
import com.github.mikephil.charting.utils.YLabels;
import com.xxmassdeveloper.mpchartexample.MyMarkerView;
import com.xxmassdeveloper.mpchartexample.R;
public class ScatterChartFrag extends SimpleFragment {
public static Fragment newInstance() {
return new ScatterChartFrag();
}
private ScatterChart mChart;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.frag_simple_scatter, container, false);
mChart = (ScatterChart) v.findViewById(R.id.scatterChart1);
mChart.setDrawYValues(false);
mChart.setDescription("");
Typeface tf = Typeface.createFromAsset(getActivity().getAssets(),"OpenSans-Light.ttf");
YLabels labels = mChart.getYLabels();
labels.setTypeface(tf);
MyMarkerView mv = new MyMarkerView(getActivity(), R.layout.custom_marker_view);
mv.setOffsets(-mv.getMeasuredWidth() / 2, -mv.getMeasuredHeight());
mChart.setMarkerView(mv);
mChart.setHighlightIndicatorEnabled(false);
mChart.setDrawBorder(false);
// mChart.setBorderStyles(new BorderStyle[] { BorderStyle.LEFT });
mChart.setDrawGridBackground(false);
mChart.setDrawVerticalGrid(false);
mChart.setDrawXLabels(false);
mChart.setUnit(" $");
mChart.setData(generateScatterData(3, 10000, 150));
Legend l = mChart.getLegend();
l.setTypeface(tf);
return v;
}
}

View file

@ -1,186 +0,0 @@
package com.xxmassdeveloper.mpchartexample.fragments;
import android.support.v4.app.Fragment;
import com.github.mikephil.charting.charts.ScatterChart;
import com.github.mikephil.charting.charts.ScatterChart.ScatterShape;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry;
import com.github.mikephil.charting.data.ChartData;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.data.PieData;
import com.github.mikephil.charting.data.PieDataSet;
import com.github.mikephil.charting.data.ScatterData;
import com.github.mikephil.charting.data.ScatterDataSet;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.github.mikephil.charting.utils.FileUtils;
import com.xxmassdeveloper.mpchartexample.R;
import java.util.ArrayList;
public abstract class SimpleFragment extends Fragment {
protected BarData generateBarData(int dataSets, float range, int count) {
ArrayList<BarDataSet> sets = new ArrayList<BarDataSet>();
for(int i = 0; i < dataSets; i++) {
ArrayList<BarEntry> entries = new ArrayList<BarEntry>();
// entries = FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "stacked_bars.txt");
for(int j = 0; j < count; j++) {
entries.add(new BarEntry((float) (Math.random() * range) + range / 4, j));
}
BarDataSet ds = new BarDataSet(entries, getLabel(i));
ds.setColors(ColorTemplate.VORDIPLOM_COLORS);
sets.add(ds);
}
BarData d = new BarData(ChartData.generateXVals(0, count), sets);
return d;
}
protected ScatterData generateScatterData(int dataSets, float range, int count) {
ArrayList<ScatterDataSet> sets = new ArrayList<ScatterDataSet>();
ScatterShape[] shapes = ScatterChart.getAllPossibleShapes();
for(int i = 0; i < dataSets; i++) {
ArrayList<Entry> entries = new ArrayList<Entry>();
for(int j = 0; j < count; j++) {
entries.add(new Entry((float) (Math.random() * range) + range / 4, j));
}
ScatterDataSet ds = new ScatterDataSet(entries, getLabel(i));
ds.setScatterShapeSize(12f);
ds.setScatterShape(shapes[i % shapes.length]);
ds.setColors(ColorTemplate.COLORFUL_COLORS);
ds.setScatterShapeSize(9f);
sets.add(ds);
}
ScatterData d = new ScatterData(ChartData.generateXVals(0, count), sets);
return d;
}
/**
* generates less data (1 DataSet, 4 values)
* @return
*/
protected PieData generatePieData() {
int count = 4;
ArrayList<Entry> entries1 = new ArrayList<Entry>();
ArrayList<String> xVals = new ArrayList<String>();
xVals.add("Quarter 1");
xVals.add("Quarter 2");
xVals.add("Quarter 3");
xVals.add("Quarter 4");
for(int i = 0; i < count; i++) {
xVals.add("entry" + (i+1));
entries1.add(new Entry((float) (Math.random() * 60) + 40, i));
}
PieDataSet ds1 = new PieDataSet(entries1, "Quarterly Revenues 2014");
ds1.setColors(ColorTemplate.VORDIPLOM_COLORS);
ds1.setSliceSpace(2f);
PieData d = new PieData(xVals, ds1);
return d;
}
protected LineData generateLineData() {
// DataSet ds1 = new DataSet(n, "O(n)");
// DataSet ds2 = new DataSet(nlogn, "O(nlogn)");
// DataSet ds3 = new DataSet(nsquare, "O(n\u00B2)");
// DataSet ds4 = new DataSet(nthree, "O(n\u00B3)");
ArrayList<LineDataSet> sets = new ArrayList<LineDataSet>();
LineDataSet ds1 = new LineDataSet(FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "sine.txt"), "Sine function");
LineDataSet ds2 = new LineDataSet(FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "cosine.txt"), "Cosine function");
ds1.setLineWidth(2f);
ds2.setLineWidth(2f);
ds1.setDrawCircles(false);
ds2.setDrawCircles(false);
ds1.setColor(ColorTemplate.VORDIPLOM_COLORS[0]);
ds2.setColor(ColorTemplate.VORDIPLOM_COLORS[1]);
// load DataSets from textfiles in assets folders
sets.add(ds1);
sets.add(ds2);
// sets.add(FileUtils.dataSetFromAssets(getActivity().getAssets(), "n.txt"));
// sets.add(FileUtils.dataSetFromAssets(getActivity().getAssets(), "nlogn.txt"));
// sets.add(FileUtils.dataSetFromAssets(getActivity().getAssets(), "square.txt"));
// sets.add(FileUtils.dataSetFromAssets(getActivity().getAssets(), "three.txt"));
int max = Math.max(sets.get(0).getEntryCount(), sets.get(1).getEntryCount());
LineData d = new LineData(ChartData.generateXVals(0, max), sets);
return d;
}
protected LineData getComplexity() {
ArrayList<LineDataSet> sets = new ArrayList<LineDataSet>();
LineDataSet ds1 = new LineDataSet(FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "n.txt"), "O(n)");
LineDataSet ds2 = new LineDataSet(FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "nlogn.txt"), "O(nlogn)");
LineDataSet ds3 = new LineDataSet(FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "square.txt"), "O(n\u00B2)");
LineDataSet ds4 = new LineDataSet(FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "three.txt"), "O(n\u00B3)");
ds1.setColor(ColorTemplate.VORDIPLOM_COLORS[0]);
ds2.setColor(ColorTemplate.VORDIPLOM_COLORS[1]);
ds3.setColor(ColorTemplate.VORDIPLOM_COLORS[2]);
ds4.setColor(ColorTemplate.VORDIPLOM_COLORS[3]);
ds1.setCircleColor(ColorTemplate.VORDIPLOM_COLORS[0]);
ds2.setCircleColor(ColorTemplate.VORDIPLOM_COLORS[1]);
ds3.setCircleColor(ColorTemplate.VORDIPLOM_COLORS[2]);
ds4.setCircleColor(ColorTemplate.VORDIPLOM_COLORS[3]);
ds1.setLineWidth(2.5f);
ds1.setCircleSize(3f);
ds2.setLineWidth(2.5f);
ds2.setCircleSize(3f);
ds3.setLineWidth(2.5f);
ds3.setCircleSize(3f);
ds4.setLineWidth(2.5f);
ds4.setCircleSize(3f);
// load DataSets from textfiles in assets folders
sets.add(ds1);
sets.add(ds2);
sets.add(ds3);
sets.add(ds4);
LineData d = new LineData(ChartData.generateXVals(0, ds1.getEntryCount()), sets);
return d;
}
private String[] mLabels = new String[] { "Company A", "Company B", "Company C", "Company D", "Company E", "Company F" };
// private String[] mXVals = new String[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec" };
private String getLabel(int i) {
return mLabels[i];
}
}

View file

@ -1,59 +0,0 @@
package com.xxmassdeveloper.mpchartexample.fragments;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.utils.Legend;
import com.github.mikephil.charting.utils.YLabels;
import com.xxmassdeveloper.mpchartexample.R;
public class SineCosineFragment extends SimpleFragment {
public static Fragment newInstance() {
return new SineCosineFragment();
}
private LineChart mChart;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.frag_simple_line, container, false);
mChart = (LineChart) v.findViewById(R.id.lineChart1);
mChart.setDescription("");
mChart.setDrawYValues(false);
// mChart.setCircleSize(5f);
mChart.setHighlightIndicatorEnabled(false);
mChart.setDrawBorder(false);
mChart.setDrawGridBackground(false);
mChart.setDrawVerticalGrid(false);
mChart.setDrawXLabels(false);
mChart.setDrawYValues(false);
mChart.setStartAtZero(false);
mChart.setYRange(-1.2f, 1.2f, false);
mChart.setData(generateLineData());
mChart.animateX(3000);
// mChart.setScaleMinima(3f, 3f);
// mChart.centerViewPort(300, 0);
Typeface tf = Typeface.createFromAsset(getActivity().getAssets(),"OpenSans-Light.ttf");
Legend l = mChart.getLegend();
l.setTypeface(tf);
YLabels labels = mChart.getYLabels();
labels.setTypeface(tf);
return v;
}
}

View file

@ -1,77 +0,0 @@
package com.xxmassdeveloper.mpchartexample.listviewitems;
import android.content.Context;
import android.graphics.Typeface;
import android.view.LayoutInflater;
import android.view.View;
import com.github.mikephil.charting.charts.PieChart;
import com.github.mikephil.charting.data.ChartData;
import com.github.mikephil.charting.data.PieData;
import com.github.mikephil.charting.utils.Legend;
import com.github.mikephil.charting.utils.Legend.LegendPosition;
import com.xxmassdeveloper.mpchartexample.R;
public class PieChartItem extends ChartItem {
private Typeface mTf;
public PieChartItem(ChartData cd, Context c) {
super(cd);
mTf = Typeface.createFromAsset(c.getAssets(), "OpenSans-Regular.ttf");
}
@Override
public int getItemType() {
return TYPE_PIECHART;
}
@Override
public View getView(int position, View convertView, Context c) {
ViewHolder holder = null;
if (convertView == null) {
holder = new ViewHolder();
convertView = LayoutInflater.from(c).inflate(
R.layout.list_item_piechart, null);
holder.chart = (PieChart) convertView.findViewById(R.id.chart);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
// apply styling
holder.chart.setValueTypeface(mTf);
holder.chart.setDescription("");
holder.chart.setHoleRadius(60f);
holder.chart.setTransparentCircleRadius(65f);
holder.chart.setCenterText("MPChart\nAndroid");
holder.chart.setCenterTextTypeface(mTf);
holder.chart.setCenterTextSize(18f);
holder.chart.setDrawXValues(false);
holder.chart.setUsePercentValues(true);
// set data
holder.chart.setData((PieData) mChartData);
Legend l = holder.chart.getLegend();
l.setPosition(LegendPosition.RIGHT_OF_CHART);
// do not forget to refresh the chart
// holder.chart.invalidate();
holder.chart.animateXY(900, 900);
return convertView;
}
private static class ViewHolder {
PieChart chart;
}
}

View file

@ -1,16 +0,0 @@
package com.xxmassdeveloper.mpchartexample.notimportant;
import android.support.v4.app.FragmentActivity;
import com.xxmassdeveloper.mpchartexample.R;
public abstract class DemoBase extends FragmentActivity {
protected String[] mMonths = new String[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec" };
@Override
public void onBackPressed() {
super.onBackPressed();
overridePendingTransition(R.anim.move_left_in_activity, R.anim.move_right_out_activity);
}
}

View file

@ -1,281 +0,0 @@
package com.xxmassdeveloper.mpchartexample.notimportant;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import com.github.mikephil.charting.utils.Utils;
import com.xxmassdeveloper.mpchartexample.AnotherBarActivity;
import com.xxmassdeveloper.mpchartexample.BarChartActivity;
import com.xxmassdeveloper.mpchartexample.BarChartActivityMultiDataset;
import com.xxmassdeveloper.mpchartexample.CandleStickChartActivity;
import com.xxmassdeveloper.mpchartexample.CubicLineChartActivity;
import com.xxmassdeveloper.mpchartexample.DynamicalAddingActivity;
import com.xxmassdeveloper.mpchartexample.InvertedLineChartActivity;
import com.xxmassdeveloper.mpchartexample.LineChartActivity;
import com.xxmassdeveloper.mpchartexample.LineChartActivityColored;
import com.xxmassdeveloper.mpchartexample.ListViewBarChartActivity;
import com.xxmassdeveloper.mpchartexample.ListViewMultiChartActivity;
import com.xxmassdeveloper.mpchartexample.MultiLineChartActivity;
import com.xxmassdeveloper.mpchartexample.PieChartActivity;
import com.xxmassdeveloper.mpchartexample.R;
import com.xxmassdeveloper.mpchartexample.RadarChartActivitry;
import com.xxmassdeveloper.mpchartexample.ScatterChartActivity;
import com.xxmassdeveloper.mpchartexample.StackedBarActivity;
import com.xxmassdeveloper.mpchartexample.fragments.SimpleChartDemo;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends Activity implements OnItemClickListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
// initialize the utilities
Utils.init(getResources());
ArrayList<ContentItem> objects = new ArrayList<ContentItem>();
objects.add(new ContentItem("Line Chart", "A simple demonstration of the linechart."));
objects.add(new ContentItem("Bar Chart", "A simple demonstration of the bar chart."));
objects.add(new ContentItem("Pie Chart", "A simple demonstration of the pie chart."));
objects.add(new ContentItem("Scatter Chart", "A simple demonstration of the scatter chart."));
objects.add(new ContentItem("Stacked Bar Chart",
"A simple demonstration of a bar chart with stacked bars."));
objects.add(new ContentItem("Another Bar Chart",
"Implementation of a BarChart that only shows values at the bottom."));
objects.add(new ContentItem("Multiple Lines Chart",
"A line chart with multiple DataSet objects. One color per DataSet."));
objects.add(new ContentItem("Multiple Bars Chart",
"A bar chart with multiple DataSet objects. One multiple colors per DataSet."));
objects.add(new ContentItem("Draw Chart",
"Demonstration of drawing values into the chart per touch-gesture. With callbacks."));
objects.add(new ContentItem(
"Charts in Fragments, awesome design.",
"Demonstration of charts inside Fragments. In this example the focus was on the design and look and feel of the chart."));
objects.add(new ContentItem(
"BarChart inside ListView",
"Demonstrates the usage of a BarChart inside a ListView item."));
objects.add(new ContentItem(
"Multiple charts inside ListView",
"Demonstrates the usage of different chart types inside a ListView."));
objects.add(new ContentItem(
"Inverted Line Chart",
"Demonstrates the feature of inverting the y-axis."));
objects.add(new ContentItem(
"Candle Stick Chart",
"Demonstrates usage of the CandleStickChart."));
objects.add(new ContentItem(
"Cubic Line Chart",
"Demonstrates cubic lines in a LineChart."));
objects.add(new ContentItem(
"Radar Chart",
"Demonstrates the use of a spider-web like (net) chart."));
objects.add(new ContentItem(
"Colored Line Chart",
"Shows a LineChart with different background and line color."));
objects.add(new ContentItem(
"Dynamical data adding",
"This Activity demonstrates dynamical adding of Entries and DataSets (real time graph)."));
MyAdapter adapter = new MyAdapter(this, objects);
ListView lv = (ListView) findViewById(R.id.listView1);
lv.setAdapter(adapter);
lv.setOnItemClickListener(this);
}
@Override
public void onItemClick(AdapterView<?> av, View v, int pos, long arg3) {
Intent i;
switch (pos) {
case 0:
i = new Intent(this, LineChartActivity.class);
startActivity(i);
break;
case 1:
i = new Intent(this, BarChartActivity.class);
startActivity(i);
break;
case 2:
i = new Intent(this, PieChartActivity.class);
startActivity(i);
break;
case 3:
i = new Intent(this, ScatterChartActivity.class);
startActivity(i);
break;
case 4:
i = new Intent(this, StackedBarActivity.class);
startActivity(i);
break;
case 5:
i = new Intent(this, AnotherBarActivity.class);
startActivity(i);
break;
case 6:
i = new Intent(this, MultiLineChartActivity.class);
startActivity(i);
break;
case 7:
i = new Intent(this, BarChartActivityMultiDataset.class);
startActivity(i);
break;
case 8:
// i = new Intent(this, DrawChartActivity.class);
// startActivity(i);
AlertDialog.Builder b = new AlertDialog.Builder(this);
b.setTitle("Feature not available");
b.setMessage("Due to recent changes to the data model of the library, this feature is temporarily not available.");
b.setPositiveButton("OK", null);
b.create().show();
break;
case 9:
i = new Intent(this, SimpleChartDemo.class);
startActivity(i);
break;
case 10:
i = new Intent(this, ListViewBarChartActivity.class);
startActivity(i);
break;
case 11:
i = new Intent(this, ListViewMultiChartActivity.class);
startActivity(i);
break;
case 12:
i = new Intent(this, InvertedLineChartActivity.class);
startActivity(i);
break;
case 13:
i = new Intent(this, CandleStickChartActivity.class);
startActivity(i);
break;
case 14:
i = new Intent(this, CubicLineChartActivity.class);
startActivity(i);
break;
case 15:
i = new Intent(this, RadarChartActivitry.class);
startActivity(i);
break;
case 16:
i = new Intent(this, LineChartActivityColored.class);
startActivity(i);
break;
case 17:
i = new Intent(this, DynamicalAddingActivity.class);
startActivity(i);
break;
}
overridePendingTransition(R.anim.move_right_in_activity, R.anim.move_left_out_activity);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Intent i = null;
switch (item.getItemId()) {
case R.id.viewGithub:
i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://github.com/PhilJay/MPAndroidChart"));
startActivity(i);
break;
case R.id.report:
i = new Intent(Intent.ACTION_SENDTO, Uri.fromParts(
"mailto", "philjay.librarysup@gmail.com", null));
i.putExtra(Intent.EXTRA_SUBJECT, "MPAndroidChart Issue");
i.putExtra(Intent.EXTRA_TEXT, "Your error report here...");
startActivity(Intent.createChooser(i, "Report Problem"));
break;
case R.id.website:
i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("http://www.xxmassdeveloper.com"));
startActivity(i);
break;
}
return true;
}
private class ContentItem {
String name;
String desc;
public ContentItem(String n, String d) {
name = n;
desc = d;
}
}
private class MyAdapter extends ArrayAdapter<ContentItem> {
public MyAdapter(Context context, List<ContentItem> objects) {
super(context, 0, objects);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ContentItem c = getItem(position);
ViewHolder holder = null;
if (convertView == null) {
holder = new ViewHolder();
convertView = LayoutInflater.from(getContext()).inflate(R.layout.list_item, null);
holder.tvName = (TextView) convertView.findViewById(R.id.tvName);
holder.tvDesc = (TextView) convertView.findViewById(R.id.tvDesc);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.tvName.setText(c.name);
holder.tvDesc.setText(c.desc);
return convertView;
}
private class ViewHolder {
TextView tvName, tvDesc;
}
}
}

View file

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxmassdeveloper.mpchartexample">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:allowBackup="false"
android:hardwareAccelerated="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<activity
android:name="com.xxmassdeveloper.mpchartexample.notimportant.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="LineChartActivity1" />
<activity android:name="LineChartActivity2" />
<activity android:name="LineChartTime" />
<activity android:name="BarChartActivity" />
<activity android:name="HorizontalBarChartActivity" />
<activity android:name="HorizontalBarNegativeChartActivity" />
<activity android:name="PieChartActivity" />
<activity android:name="PiePolylineChartActivity" />
<activity android:name="MultiLineChartActivity" />
<activity android:name="BarChartActivityMultiDataset" />
<activity android:name="DrawChartActivity" />
<activity android:name="ScatterChartActivity" />
<activity android:name="BubbleChartActivity" />
<activity android:name=".fragments.SimpleChartDemo" />
<activity android:name="ListViewBarChartActivity" />
<activity android:name="ListViewMultiChartActivity" />
<activity android:name="StackedBarActivity" />
<activity android:name="AnotherBarActivity" />
<activity android:name="InvertedLineChartActivity" />
<activity android:name="CandleStickChartActivity" />
<activity android:name="CubicLineChartActivity" />
<activity android:name="RadarChartActivity" />
<activity android:name="LineChartActivityColored" />
<activity android:name="DynamicalAddingActivity" />
<activity android:name="RealtimeLineChartActivity" />
<activity android:name="CombinedChartActivity" />
<activity android:name="PerformanceLineChart" />
<activity android:name="BarChartActivitySinus" />
<activity android:name="ScrollViewActivity" />
<activity android:name="StackedBarActivityNegative" />
<activity android:name="BarChartPositiveNegative" />
<activity android:name="FilledLineActivity" />
<activity android:name="HalfPieChartActivity" />
</application>
</manifest>

File diff suppressed because it is too large Load diff

View file

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 4 KiB

View file

@ -0,0 +1,214 @@
package com.xxmassdeveloper.mpchartexample;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import androidx.core.content.ContextCompat;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import com.github.mikephil.charting.charts.BarChart;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.XAxis.XAxisPosition;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry;
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet;
import com.github.mikephil.charting.interfaces.datasets.IDataSet;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
public class AnotherBarActivity extends DemoBase implements OnSeekBarChangeListener {
private BarChart chart;
private SeekBar seekBarX, seekBarY;
private TextView tvX, tvY;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_barchart);
setTitle("AnotherBarActivity");
tvX = findViewById(R.id.tvXMax);
tvY = findViewById(R.id.tvYMax);
seekBarX = findViewById(R.id.seekBar1);
seekBarX.setOnSeekBarChangeListener(this);
seekBarY = findViewById(R.id.seekBar2);
seekBarY.setOnSeekBarChangeListener(this);
chart = findViewById(R.id.chart1);
chart.getDescription().setEnabled(false);
// if more than 60 entries are displayed in the chart, no values will be
// drawn
chart.setMaxVisibleValueCount(60);
// scaling can now only be done on x- and y-axis separately
chart.setPinchZoom(false);
chart.setDrawBarShadow(false);
chart.setDrawGridBackground(false);
XAxis xAxis = chart.getXAxis();
xAxis.setPosition(XAxisPosition.BOTTOM);
xAxis.setDrawGridLines(false);
chart.getAxisLeft().setDrawGridLines(false);
// setting data
seekBarX.setProgress(10);
seekBarY.setProgress(100);
// add a nice and smooth animation
chart.animateY(1500);
chart.getLegend().setEnabled(false);
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
tvX.setText(String.valueOf(seekBarX.getProgress()));
tvY.setText(String.valueOf(seekBarY.getProgress()));
ArrayList<BarEntry> values = new ArrayList<>();
for (int i = 0; i < seekBarX.getProgress(); i++) {
float multi = (seekBarY.getProgress() + 1);
float val = (float) (Math.random() * multi) + multi / 3;
values.add(new BarEntry(i, val));
}
BarDataSet set1;
if (chart.getData() != null &&
chart.getData().getDataSetCount() > 0) {
set1 = (BarDataSet) chart.getData().getDataSetByIndex(0);
set1.setValues(values);
chart.getData().notifyDataChanged();
chart.notifyDataSetChanged();
} else {
set1 = new BarDataSet(values, "Data Set");
set1.setColors(ColorTemplate.VORDIPLOM_COLORS);
set1.setDrawValues(false);
ArrayList<IBarDataSet> dataSets = new ArrayList<>();
dataSets.add(set1);
BarData data = new BarData(dataSets);
chart.setData(data);
chart.setFitBars(true);
}
chart.invalidate();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.bar, menu);
menu.removeItem(R.id.actionToggleIcons);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.viewGithub: {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/AnotherBarActivity.java"));
startActivity(i);
break;
}
case R.id.actionToggleValues: {
for (IDataSet set : chart.getData().getDataSets())
set.setDrawValues(!set.isDrawValuesEnabled());
chart.invalidate();
break;
}
/*
case R.id.actionToggleIcons: { break; }
*/
case R.id.actionToggleHighlight: {
if(chart.getData() != null) {
chart.getData().setHighlightEnabled(!chart.getData().isHighlightEnabled());
chart.invalidate();
}
break;
}
case R.id.actionTogglePinch: {
if (chart.isPinchZoomEnabled())
chart.setPinchZoom(false);
else
chart.setPinchZoom(true);
chart.invalidate();
break;
}
case R.id.actionToggleAutoScaleMinMax: {
chart.setAutoScaleMinMaxEnabled(!chart.isAutoScaleMinMaxEnabled());
chart.notifyDataSetChanged();
break;
}
case R.id.actionToggleBarBorders: {
for (IBarDataSet set : chart.getData().getDataSets())
((BarDataSet)set).setBarBorderWidth(set.getBarBorderWidth() == 1.f ? 0.f : 1.f);
chart.invalidate();
break;
}
case R.id.animateX: {
chart.animateX(2000);
break;
}
case R.id.animateY: {
chart.animateY(2000);
break;
}
case R.id.animateXY: {
chart.animateXY(2000, 2000);
break;
}
case R.id.actionSave: {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
saveToGallery();
} else {
requestStoragePermission(chart);
}
break;
}
}
return true;
}
@Override
protected void saveToGallery() {
saveToGallery(chart, "AnotherBarActivity");
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {}
}

View file

@ -0,0 +1,326 @@
package com.xxmassdeveloper.mpchartexample;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.RectF;
import android.net.Uri;
import android.os.Bundle;
import androidx.core.content.ContextCompat;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import com.github.mikephil.charting.charts.BarChart;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.components.Legend.LegendForm;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.XAxis.XAxisPosition;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.components.YAxis.AxisDependency;
import com.github.mikephil.charting.components.YAxis.YAxisLabelPosition;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.formatter.ValueFormatter;
import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet;
import com.github.mikephil.charting.interfaces.datasets.IDataSet;
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
import com.github.mikephil.charting.utils.Fill;
import com.github.mikephil.charting.utils.MPPointF;
import com.xxmassdeveloper.mpchartexample.custom.DayAxisValueFormatter;
import com.xxmassdeveloper.mpchartexample.custom.MyValueFormatter;
import com.xxmassdeveloper.mpchartexample.custom.XYMarkerView;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
import java.util.List;
public class BarChartActivity extends DemoBase implements OnSeekBarChangeListener,
OnChartValueSelectedListener {
private BarChart chart;
private SeekBar seekBarX, seekBarY;
private TextView tvX, tvY;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_barchart);
setTitle("BarChartActivity");
tvX = findViewById(R.id.tvXMax);
tvY = findViewById(R.id.tvYMax);
seekBarX = findViewById(R.id.seekBar1);
seekBarY = findViewById(R.id.seekBar2);
seekBarY.setOnSeekBarChangeListener(this);
seekBarX.setOnSeekBarChangeListener(this);
chart = findViewById(R.id.chart1);
chart.setOnChartValueSelectedListener(this);
chart.setDrawBarShadow(false);
chart.setDrawValueAboveBar(true);
chart.getDescription().setEnabled(false);
// if more than 60 entries are displayed in the chart, no values will be
// drawn
chart.setMaxVisibleValueCount(60);
// scaling can now only be done on x- and y-axis separately
chart.setPinchZoom(false);
chart.setDrawGridBackground(false);
// chart.setDrawYLabels(false);
ValueFormatter xAxisFormatter = new DayAxisValueFormatter(chart);
XAxis xAxis = chart.getXAxis();
xAxis.setPosition(XAxisPosition.BOTTOM);
xAxis.setTypeface(tfLight);
xAxis.setDrawGridLines(false);
xAxis.setGranularity(1f); // only intervals of 1 day
xAxis.setLabelCount(7);
xAxis.setValueFormatter(xAxisFormatter);
ValueFormatter custom = new MyValueFormatter("$");
YAxis leftAxis = chart.getAxisLeft();
leftAxis.setTypeface(tfLight);
leftAxis.setLabelCount(8, false);
leftAxis.setValueFormatter(custom);
leftAxis.setPosition(YAxisLabelPosition.OUTSIDE_CHART);
leftAxis.setSpaceTop(15f);
leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)
YAxis rightAxis = chart.getAxisRight();
rightAxis.setDrawGridLines(false);
rightAxis.setTypeface(tfLight);
rightAxis.setLabelCount(8, false);
rightAxis.setValueFormatter(custom);
rightAxis.setSpaceTop(15f);
rightAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)
Legend l = chart.getLegend();
l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.LEFT);
l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
l.setDrawInside(false);
l.setForm(LegendForm.SQUARE);
l.setFormSize(9f);
l.setTextSize(11f);
l.setXEntrySpace(4f);
XYMarkerView mv = new XYMarkerView(this, xAxisFormatter);
mv.setChartView(chart); // For bounds control
chart.setMarker(mv); // Set the marker to the chart
// setting data
seekBarY.setProgress(50);
seekBarX.setProgress(12);
// chart.setDrawLegend(false);
}
private void setData(int count, float range) {
float start = 1f;
ArrayList<BarEntry> values = new ArrayList<>();
for (int i = (int) start; i < start + count; i++) {
float val = (float) (Math.random() * (range + 1));
if (Math.random() * 100 < 25) {
values.add(new BarEntry(i, val, getResources().getDrawable(R.drawable.star)));
} else {
values.add(new BarEntry(i, val));
}
}
BarDataSet set1;
if (chart.getData() != null &&
chart.getData().getDataSetCount() > 0) {
set1 = (BarDataSet) chart.getData().getDataSetByIndex(0);
set1.setValues(values);
chart.getData().notifyDataChanged();
chart.notifyDataSetChanged();
} else {
set1 = new BarDataSet(values, "The year 2017");
set1.setDrawIcons(false);
int startColor1 = ContextCompat.getColor(this, android.R.color.holo_orange_light);
int startColor2 = ContextCompat.getColor(this, android.R.color.holo_blue_light);
int startColor3 = ContextCompat.getColor(this, android.R.color.holo_orange_light);
int startColor4 = ContextCompat.getColor(this, android.R.color.holo_green_light);
int startColor5 = ContextCompat.getColor(this, android.R.color.holo_red_light);
int endColor1 = ContextCompat.getColor(this, android.R.color.holo_blue_dark);
int endColor2 = ContextCompat.getColor(this, android.R.color.holo_purple);
int endColor3 = ContextCompat.getColor(this, android.R.color.holo_green_dark);
int endColor4 = ContextCompat.getColor(this, android.R.color.holo_red_dark);
int endColor5 = ContextCompat.getColor(this, android.R.color.holo_orange_dark);
List<Fill> gradientFills = new ArrayList<>();
gradientFills.add(new Fill(startColor1, endColor1));
gradientFills.add(new Fill(startColor2, endColor2));
gradientFills.add(new Fill(startColor3, endColor3));
gradientFills.add(new Fill(startColor4, endColor4));
gradientFills.add(new Fill(startColor5, endColor5));
set1.setFills(gradientFills);
ArrayList<IBarDataSet> dataSets = new ArrayList<>();
dataSets.add(set1);
BarData data = new BarData(dataSets);
data.setValueTextSize(10f);
data.setValueTypeface(tfLight);
data.setBarWidth(0.9f);
chart.setData(data);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.bar, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.viewGithub: {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivity.java"));
startActivity(i);
break;
}
case R.id.actionToggleValues: {
for (IDataSet set : chart.getData().getDataSets())
set.setDrawValues(!set.isDrawValuesEnabled());
chart.invalidate();
break;
}
case R.id.actionToggleIcons: {
for (IDataSet set : chart.getData().getDataSets())
set.setDrawIcons(!set.isDrawIconsEnabled());
chart.invalidate();
break;
}
case R.id.actionToggleHighlight: {
if (chart.getData() != null) {
chart.getData().setHighlightEnabled(!chart.getData().isHighlightEnabled());
chart.invalidate();
}
break;
}
case R.id.actionTogglePinch: {
if (chart.isPinchZoomEnabled())
chart.setPinchZoom(false);
else
chart.setPinchZoom(true);
chart.invalidate();
break;
}
case R.id.actionToggleAutoScaleMinMax: {
chart.setAutoScaleMinMaxEnabled(!chart.isAutoScaleMinMaxEnabled());
chart.notifyDataSetChanged();
break;
}
case R.id.actionToggleBarBorders: {
for (IBarDataSet set : chart.getData().getDataSets())
((BarDataSet) set).setBarBorderWidth(set.getBarBorderWidth() == 1.f ? 0.f : 1.f);
chart.invalidate();
break;
}
case R.id.animateX: {
chart.animateX(2000);
break;
}
case R.id.animateY: {
chart.animateY(2000);
break;
}
case R.id.animateXY: {
chart.animateXY(2000, 2000);
break;
}
case R.id.actionSave: {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
saveToGallery();
} else {
requestStoragePermission(chart);
}
break;
}
}
return true;
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
tvX.setText(String.valueOf(seekBarX.getProgress()));
tvY.setText(String.valueOf(seekBarY.getProgress()));
setData(seekBarX.getProgress(), seekBarY.getProgress());
chart.invalidate();
}
@Override
protected void saveToGallery() {
saveToGallery(chart, "BarChartActivity");
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {}
private final RectF onValueSelectedRectF = new RectF();
@Override
public void onValueSelected(Entry e, Highlight h) {
if (e == null)
return;
RectF bounds = onValueSelectedRectF;
chart.getBarBounds((BarEntry) e, bounds);
MPPointF position = chart.getPosition(e, AxisDependency.LEFT);
Log.i("bounds", bounds.toString());
Log.i("position", position.toString());
Log.i("x-index",
"low: " + chart.getLowestVisibleX() + ", high: "
+ chart.getHighestVisibleX());
MPPointF.recycleInstance(position);
}
@Override
public void onNothingSelected() { }
}

View file

@ -0,0 +1,287 @@
package com.xxmassdeveloper.mpchartexample;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import androidx.core.content.ContextCompat;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import com.github.mikephil.charting.charts.BarChart;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.formatter.LargeValueFormatter;
import com.github.mikephil.charting.formatter.ValueFormatter;
import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet;
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
import com.xxmassdeveloper.mpchartexample.custom.MyMarkerView;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
import java.util.Locale;
public class BarChartActivityMultiDataset extends DemoBase implements OnSeekBarChangeListener,
OnChartValueSelectedListener {
private BarChart chart;
private SeekBar seekBarX, seekBarY;
private TextView tvX, tvY;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_barchart);
setTitle("BarChartActivityMultiDataset");
tvX = findViewById(R.id.tvXMax);
tvX.setTextSize(10);
tvY = findViewById(R.id.tvYMax);
seekBarX = findViewById(R.id.seekBar1);
seekBarX.setMax(50);
seekBarX.setOnSeekBarChangeListener(this);
seekBarY = findViewById(R.id.seekBar2);
seekBarY.setOnSeekBarChangeListener(this);
chart = findViewById(R.id.chart1);
chart.setOnChartValueSelectedListener(this);
chart.getDescription().setEnabled(false);
// chart.setDrawBorders(true);
// scaling can now only be done on x- and y-axis separately
chart.setPinchZoom(false);
chart.setDrawBarShadow(false);
chart.setDrawGridBackground(false);
// create a custom MarkerView (extend MarkerView) and specify the layout
// to use for it
MyMarkerView mv = new MyMarkerView(this, R.layout.custom_marker_view);
mv.setChartView(chart); // For bounds control
chart.setMarker(mv); // Set the marker to the chart
seekBarX.setProgress(10);
seekBarY.setProgress(100);
Legend l = chart.getLegend();
l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT);
l.setOrientation(Legend.LegendOrientation.VERTICAL);
l.setDrawInside(true);
l.setTypeface(tfLight);
l.setYOffset(0f);
l.setXOffset(10f);
l.setYEntrySpace(0f);
l.setTextSize(8f);
XAxis xAxis = chart.getXAxis();
xAxis.setTypeface(tfLight);
xAxis.setGranularity(1f);
xAxis.setCenterAxisLabels(true);
xAxis.setValueFormatter(new ValueFormatter() {
@Override
public String getFormattedValue(float value) {
return String.valueOf((int) value);
}
});
YAxis leftAxis = chart.getAxisLeft();
leftAxis.setTypeface(tfLight);
leftAxis.setValueFormatter(new LargeValueFormatter());
leftAxis.setDrawGridLines(false);
leftAxis.setSpaceTop(35f);
leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)
chart.getAxisRight().setEnabled(false);
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
float groupSpace = 0.08f;
float barSpace = 0.03f; // x4 DataSet
float barWidth = 0.2f; // x4 DataSet
// (0.2 + 0.03) * 4 + 0.08 = 1.00 -> interval per "group"
int groupCount = seekBarX.getProgress() + 1;
int startYear = 1980;
int endYear = startYear + groupCount;
tvX.setText(String.format(Locale.ENGLISH, "%d-%d", startYear, endYear));
tvY.setText(String.valueOf(seekBarY.getProgress()));
ArrayList<BarEntry> values1 = new ArrayList<>();
ArrayList<BarEntry> values2 = new ArrayList<>();
ArrayList<BarEntry> values3 = new ArrayList<>();
ArrayList<BarEntry> values4 = new ArrayList<>();
float randomMultiplier = seekBarY.getProgress() * 100000f;
for (int i = startYear; i < endYear; i++) {
values1.add(new BarEntry(i, (float) (Math.random() * randomMultiplier)));
values2.add(new BarEntry(i, (float) (Math.random() * randomMultiplier)));
values3.add(new BarEntry(i, (float) (Math.random() * randomMultiplier)));
values4.add(new BarEntry(i, (float) (Math.random() * randomMultiplier)));
}
BarDataSet set1, set2, set3, set4;
if (chart.getData() != null && chart.getData().getDataSetCount() > 0) {
set1 = (BarDataSet) chart.getData().getDataSetByIndex(0);
set2 = (BarDataSet) chart.getData().getDataSetByIndex(1);
set3 = (BarDataSet) chart.getData().getDataSetByIndex(2);
set4 = (BarDataSet) chart.getData().getDataSetByIndex(3);
set1.setValues(values1);
set2.setValues(values2);
set3.setValues(values3);
set4.setValues(values4);
chart.getData().notifyDataChanged();
chart.notifyDataSetChanged();
} else {
// create 4 DataSets
set1 = new BarDataSet(values1, "Company A");
set1.setColor(Color.rgb(104, 241, 175));
set2 = new BarDataSet(values2, "Company B");
set2.setColor(Color.rgb(164, 228, 251));
set3 = new BarDataSet(values3, "Company C");
set3.setColor(Color.rgb(242, 247, 158));
set4 = new BarDataSet(values4, "Company D");
set4.setColor(Color.rgb(255, 102, 0));
BarData data = new BarData(set1, set2, set3, set4);
data.setValueFormatter(new LargeValueFormatter());
data.setValueTypeface(tfLight);
chart.setData(data);
}
// specify the width each bar should have
chart.getBarData().setBarWidth(barWidth);
// restrict the x-axis range
chart.getXAxis().setAxisMinimum(startYear);
// barData.getGroupWith(...) is a helper that calculates the width each group needs based on the provided parameters
chart.getXAxis().setAxisMaximum(startYear + chart.getBarData().getGroupWidth(groupSpace, barSpace) * groupCount);
chart.groupBars(startYear, groupSpace, barSpace);
chart.invalidate();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.bar, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.viewGithub: {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivityMultiDataset.java"));
startActivity(i);
break;
}
case R.id.actionToggleValues: {
for (IBarDataSet set : chart.getData().getDataSets())
set.setDrawValues(!set.isDrawValuesEnabled());
chart.invalidate();
break;
}
case R.id.actionTogglePinch: {
if (chart.isPinchZoomEnabled())
chart.setPinchZoom(false);
else
chart.setPinchZoom(true);
chart.invalidate();
break;
}
case R.id.actionToggleAutoScaleMinMax: {
chart.setAutoScaleMinMaxEnabled(!chart.isAutoScaleMinMaxEnabled());
chart.notifyDataSetChanged();
break;
}
case R.id.actionToggleBarBorders: {
for (IBarDataSet set : chart.getData().getDataSets())
((BarDataSet) set).setBarBorderWidth(set.getBarBorderWidth() == 1.f ? 0.f : 1.f);
chart.invalidate();
break;
}
case R.id.actionToggleHighlight: {
if (chart.getData() != null) {
chart.getData().setHighlightEnabled(!chart.getData().isHighlightEnabled());
chart.invalidate();
}
break;
}
case R.id.actionSave: {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
saveToGallery();
} else {
requestStoragePermission(chart);
}
break;
}
case R.id.animateX: {
chart.animateX(2000);
break;
}
case R.id.animateY: {
chart.animateY(2000);
break;
}
case R.id.animateXY: {
chart.animateXY(2000, 2000);
break;
}
}
return true;
}
@Override
protected void saveToGallery() {
saveToGallery(chart, "BarChartActivityMultiDataset");
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {}
@Override
public void onValueSelected(Entry e, Highlight h) {
Log.i("Activity", "Selected: " + e.toString() + ", dataSet: " + h.getDataSetIndex());
}
@Override
public void onNothingSelected() {
Log.i("Activity", "Nothing selected.");
}
}

View file

@ -0,0 +1,239 @@
package com.xxmassdeveloper.mpchartexample;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import androidx.core.content.ContextCompat;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import com.github.mikephil.charting.charts.BarChart;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.components.Legend.LegendForm;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry;
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet;
import com.github.mikephil.charting.utils.FileUtils;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
import java.util.List;
public class BarChartActivitySinus extends DemoBase implements OnSeekBarChangeListener {
private BarChart chart;
private SeekBar seekBarX;
private TextView tvX;
private List<BarEntry> data;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_barchart_sinus);
setTitle("BarChartActivitySinus");
data = FileUtils.loadBarEntriesFromAssets(getAssets(), "othersine.txt");
tvX = findViewById(R.id.tvValueCount);
seekBarX = findViewById(R.id.seekbarValues);
chart = findViewById(R.id.chart1);
chart.setDrawBarShadow(false);
chart.setDrawValueAboveBar(true);
chart.getDescription().setEnabled(false);
// if more than 60 entries are displayed in the chart, no values will be
// drawn
chart.setMaxVisibleValueCount(60);
// scaling can now only be done on x- and y-axis separately
chart.setPinchZoom(false);
// draw shadows for each bar that show the maximum value
// chart.setDrawBarShadow(true);
// chart.setDrawXLabels(false);
chart.setDrawGridBackground(false);
// chart.setDrawYLabels(false);
XAxis xAxis = chart.getXAxis();
xAxis.setEnabled(false);
YAxis leftAxis = chart.getAxisLeft();
leftAxis.setTypeface(tfLight);
leftAxis.setLabelCount(6, false);
leftAxis.setAxisMinimum(-2.5f);
leftAxis.setAxisMaximum(2.5f);
leftAxis.setGranularityEnabled(true);
leftAxis.setGranularity(0.1f);
YAxis rightAxis = chart.getAxisRight();
rightAxis.setDrawGridLines(false);
rightAxis.setTypeface(tfLight);
rightAxis.setLabelCount(6, false);
rightAxis.setAxisMinimum(-2.5f);
rightAxis.setAxisMaximum(2.5f);
rightAxis.setGranularity(0.1f);
seekBarX.setOnSeekBarChangeListener(this);
seekBarX.setProgress(150); // set data
Legend l = chart.getLegend();
l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.LEFT);
l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
l.setDrawInside(false);
l.setForm(LegendForm.SQUARE);
l.setFormSize(9f);
l.setTextSize(11f);
l.setXEntrySpace(4f);
chart.animateXY(1500, 1500);
}
private void setData(int count) {
ArrayList<BarEntry> entries = new ArrayList<>();
for (int i = 0; i < count; i++) {
entries.add(data.get(i));
}
BarDataSet set;
if (chart.getData() != null &&
chart.getData().getDataSetCount() > 0) {
set = (BarDataSet) chart.getData().getDataSetByIndex(0);
set.setValues(entries);
chart.getData().notifyDataChanged();
chart.notifyDataSetChanged();
} else {
set = new BarDataSet(entries, "Sinus Function");
set.setColor(Color.rgb(240, 120, 124));
}
BarData data = new BarData(set);
data.setValueTextSize(10f);
data.setValueTypeface(tfLight);
data.setDrawValues(false);
data.setBarWidth(0.8f);
chart.setData(data);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.bar, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.viewGithub: {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivitySinus.java"));
startActivity(i);
break;
}
case R.id.actionToggleValues: {
for (IBarDataSet set : chart.getData().getDataSets())
set.setDrawValues(!set.isDrawValuesEnabled());
chart.invalidate();
break;
}
case R.id.actionToggleHighlight: {
if (chart.getData() != null) {
chart.getData().setHighlightEnabled(!chart.getData().isHighlightEnabled());
chart.invalidate();
}
break;
}
case R.id.actionTogglePinch: {
if (chart.isPinchZoomEnabled())
chart.setPinchZoom(false);
else
chart.setPinchZoom(true);
chart.invalidate();
break;
}
case R.id.actionToggleAutoScaleMinMax: {
chart.setAutoScaleMinMaxEnabled(!chart.isAutoScaleMinMaxEnabled());
chart.notifyDataSetChanged();
break;
}
case R.id.actionToggleBarBorders: {
for (IBarDataSet set : chart.getData().getDataSets())
((BarDataSet) set).setBarBorderWidth(set.getBarBorderWidth() == 1.f ? 0.f : 1.f);
chart.invalidate();
break;
}
case R.id.animateX: {
chart.animateX(2000);
break;
}
case R.id.animateY: {
chart.animateY(2000);
break;
}
case R.id.animateXY: {
chart.animateXY(2000, 2000);
break;
}
case R.id.actionSave: {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
saveToGallery();
} else {
requestStoragePermission(chart);
}
break;
}
}
return true;
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
tvX.setText(String.valueOf(seekBarX.getProgress()));
setData(seekBarX.getProgress());
chart.invalidate();
}
@Override
protected void saveToGallery() {
saveToGallery(chart, "BarChartActivitySinus");
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {}
}

View file

@ -0,0 +1,195 @@
package com.xxmassdeveloper.mpchartexample;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import com.github.mikephil.charting.charts.BarChart;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.XAxis.XAxisPosition;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry;
import com.github.mikephil.charting.formatter.ValueFormatter;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
public class BarChartPositiveNegative extends DemoBase {
private BarChart chart;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_barchart_noseekbar);
setTitle("BarChartPositiveNegative");
chart = findViewById(R.id.chart1);
chart.setBackgroundColor(Color.WHITE);
chart.setExtraTopOffset(-30f);
chart.setExtraBottomOffset(10f);
chart.setExtraLeftOffset(70f);
chart.setExtraRightOffset(70f);
chart.setDrawBarShadow(false);
chart.setDrawValueAboveBar(true);
chart.getDescription().setEnabled(false);
// scaling can now only be done on x- and y-axis separately
chart.setPinchZoom(false);
chart.setDrawGridBackground(false);
XAxis xAxis = chart.getXAxis();
xAxis.setPosition(XAxisPosition.BOTTOM);
xAxis.setTypeface(tfRegular);
xAxis.setDrawGridLines(false);
xAxis.setDrawAxisLine(false);
xAxis.setTextColor(Color.LTGRAY);
xAxis.setTextSize(13f);
xAxis.setLabelCount(5);
xAxis.setCenterAxisLabels(true);
xAxis.setGranularity(1f);
YAxis left = chart.getAxisLeft();
left.setDrawLabels(false);
left.setSpaceTop(25f);
left.setSpaceBottom(25f);
left.setDrawAxisLine(false);
left.setDrawGridLines(false);
left.setDrawZeroLine(true); // draw a zero line
left.setZeroLineColor(Color.GRAY);
left.setZeroLineWidth(0.7f);
chart.getAxisRight().setEnabled(false);
chart.getLegend().setEnabled(false);
// THIS IS THE ORIGINAL DATA YOU WANT TO PLOT
final List<Data> data = new ArrayList<>();
data.add(new Data(0f, -224.1f, "12-29"));
data.add(new Data(1f, 238.5f, "12-30"));
data.add(new Data(2f, 1280.1f, "12-31"));
data.add(new Data(3f, -442.3f, "01-01"));
data.add(new Data(4f, -2280.1f, "01-02"));
xAxis.setValueFormatter(new ValueFormatter() {
@Override
public String getFormattedValue(float value) {
return data.get(Math.min(Math.max((int) value, 0), data.size()-1)).xAxisValue;
}
});
setData(data);
}
private void setData(List<Data> dataList) {
ArrayList<BarEntry> values = new ArrayList<>();
List<Integer> colors = new ArrayList<>();
int green = Color.rgb(110, 190, 102);
int red = Color.rgb(211, 74, 88);
for (int i = 0; i < dataList.size(); i++) {
Data d = dataList.get(i);
BarEntry entry = new BarEntry(d.xValue, d.yValue);
values.add(entry);
// specific colors
if (d.yValue >= 0)
colors.add(red);
else
colors.add(green);
}
BarDataSet set;
if (chart.getData() != null &&
chart.getData().getDataSetCount() > 0) {
set = (BarDataSet) chart.getData().getDataSetByIndex(0);
set.setValues(values);
chart.getData().notifyDataChanged();
chart.notifyDataSetChanged();
} else {
set = new BarDataSet(values, "Values");
set.setColors(colors);
set.setValueTextColors(colors);
BarData data = new BarData(set);
data.setValueTextSize(13f);
data.setValueTypeface(tfRegular);
data.setValueFormatter(new Formatter());
data.setBarWidth(0.8f);
chart.setData(data);
chart.invalidate();
}
}
/**
* Demo class representing data.
*/
private class Data {
final String xAxisValue;
final float yValue;
final float xValue;
Data(float xValue, float yValue, String xAxisValue) {
this.xAxisValue = xAxisValue;
this.yValue = yValue;
this.xValue = xValue;
}
}
private class Formatter extends ValueFormatter
{
private final DecimalFormat mFormat;
Formatter() {
mFormat = new DecimalFormat("######.0");
}
@Override
public String getFormattedValue(float value) {
return mFormat.format(value);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.only_github, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.viewGithub: {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartPositiveNegative.java"));
startActivity(i);
break;
}
}
return true;
}
@Override
public void saveToGallery() { /* Intentionally left empty */ }
}

View file

@ -0,0 +1,248 @@
package com.xxmassdeveloper.mpchartexample;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import androidx.core.content.ContextCompat;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import com.github.mikephil.charting.charts.BubbleChart;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.data.BubbleData;
import com.github.mikephil.charting.data.BubbleDataSet;
import com.github.mikephil.charting.data.BubbleEntry;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.interfaces.datasets.IBubbleDataSet;
import com.github.mikephil.charting.interfaces.datasets.IDataSet;
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.github.mikephil.charting.utils.MPPointF;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
public class BubbleChartActivity extends DemoBase implements OnSeekBarChangeListener,
OnChartValueSelectedListener {
private BubbleChart chart;
private SeekBar seekBarX, seekBarY;
private TextView tvX, tvY;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_bubblechart);
setTitle("BubbleChartActivity");
tvX = findViewById(R.id.tvXMax);
tvY = findViewById(R.id.tvYMax);
seekBarX = findViewById(R.id.seekBar1);
seekBarX.setOnSeekBarChangeListener(this);
seekBarY = findViewById(R.id.seekBar2);
seekBarY.setOnSeekBarChangeListener(this);
chart = findViewById(R.id.chart1);
chart.getDescription().setEnabled(false);
chart.setOnChartValueSelectedListener(this);
chart.setDrawGridBackground(false);
chart.setTouchEnabled(true);
// enable scaling and dragging
chart.setDragEnabled(true);
chart.setScaleEnabled(true);
chart.setMaxVisibleValueCount(200);
chart.setPinchZoom(true);
seekBarX.setProgress(10);
seekBarY.setProgress(50);
Legend l = chart.getLegend();
l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT);
l.setOrientation(Legend.LegendOrientation.VERTICAL);
l.setDrawInside(false);
l.setTypeface(tfLight);
YAxis yl = chart.getAxisLeft();
yl.setTypeface(tfLight);
yl.setSpaceTop(30f);
yl.setSpaceBottom(30f);
yl.setDrawZeroLine(false);
chart.getAxisRight().setEnabled(false);
XAxis xl = chart.getXAxis();
xl.setPosition(XAxis.XAxisPosition.BOTTOM);
xl.setTypeface(tfLight);
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
int count = seekBarX.getProgress();
int range = seekBarY.getProgress();
tvX.setText(String.valueOf(count));
tvY.setText(String.valueOf(range));
ArrayList<BubbleEntry> values1 = new ArrayList<>();
ArrayList<BubbleEntry> values2 = new ArrayList<>();
ArrayList<BubbleEntry> values3 = new ArrayList<>();
for (int i = 0; i < count; i++) {
values1.add(new BubbleEntry(i, (float) (Math.random() * range), (float) (Math.random() * range), getResources().getDrawable(R.drawable.star)));
values2.add(new BubbleEntry(i, (float) (Math.random() * range), (float) (Math.random() * range), getResources().getDrawable(R.drawable.star)));
values3.add(new BubbleEntry(i, (float) (Math.random() * range), (float) (Math.random() * range)));
}
// create a dataset and give it a type
BubbleDataSet set1 = new BubbleDataSet(values1, "DS 1");
set1.setDrawIcons(false);
set1.setColor(ColorTemplate.COLORFUL_COLORS[0], 130);
set1.setDrawValues(true);
BubbleDataSet set2 = new BubbleDataSet(values2, "DS 2");
set2.setDrawIcons(false);
set2.setIconsOffset(new MPPointF(0, 15));
set2.setColor(ColorTemplate.COLORFUL_COLORS[1], 130);
set2.setDrawValues(true);
BubbleDataSet set3 = new BubbleDataSet(values3, "DS 3");
set3.setColor(ColorTemplate.COLORFUL_COLORS[2], 130);
set3.setDrawValues(true);
ArrayList<IBubbleDataSet> dataSets = new ArrayList<>();
dataSets.add(set1); // add the data sets
dataSets.add(set2);
dataSets.add(set3);
// create a data object with the data sets
BubbleData data = new BubbleData(dataSets);
data.setDrawValues(false);
data.setValueTypeface(tfLight);
data.setValueTextSize(8f);
data.setValueTextColor(Color.WHITE);
data.setHighlightCircleWidth(1.5f);
chart.setData(data);
chart.invalidate();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.bubble, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.viewGithub: {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BubbleChartActivity.java"));
startActivity(i);
break;
}
case R.id.actionToggleValues: {
for (IDataSet set : chart.getData().getDataSets())
set.setDrawValues(!set.isDrawValuesEnabled());
chart.invalidate();
break;
}
case R.id.actionToggleIcons: {
for (IDataSet set : chart.getData().getDataSets())
set.setDrawIcons(!set.isDrawIconsEnabled());
chart.invalidate();
break;
}
case R.id.actionToggleHighlight: {
if(chart.getData() != null) {
chart.getData().setHighlightEnabled(!chart.getData().isHighlightEnabled());
chart.invalidate();
}
break;
}
case R.id.actionTogglePinch: {
if (chart.isPinchZoomEnabled())
chart.setPinchZoom(false);
else
chart.setPinchZoom(true);
chart.invalidate();
break;
}
case R.id.actionToggleAutoScaleMinMax: {
chart.setAutoScaleMinMaxEnabled(!chart.isAutoScaleMinMaxEnabled());
chart.notifyDataSetChanged();
break;
}
case R.id.actionSave: {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
saveToGallery();
} else {
requestStoragePermission(chart);
}
break;
}
case R.id.animateX: {
chart.animateX(2000);
break;
}
case R.id.animateY: {
chart.animateY(2000);
break;
}
case R.id.animateXY: {
chart.animateXY(2000, 2000);
break;
}
}
return true;
}
@Override
protected void saveToGallery() {
saveToGallery(chart, "BubbleChartActivity");
}
@Override
public void onValueSelected(Entry e, Highlight h) {
Log.i("VAL SELECTED",
"Value: " + e.getY() + ", xIndex: " + e.getX()
+ ", DataSet index: " + h.getDataSetIndex());
}
@Override
public void onNothingSelected() {}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {}
}

View file

@ -0,0 +1,238 @@
package com.xxmassdeveloper.mpchartexample;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.graphics.Paint;
import android.net.Uri;
import android.os.Bundle;
import androidx.core.content.ContextCompat;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import com.github.mikephil.charting.charts.CandleStickChart;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.XAxis.XAxisPosition;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.components.YAxis.AxisDependency;
import com.github.mikephil.charting.data.CandleData;
import com.github.mikephil.charting.data.CandleDataSet;
import com.github.mikephil.charting.data.CandleEntry;
import com.github.mikephil.charting.interfaces.datasets.ICandleDataSet;
import com.github.mikephil.charting.interfaces.datasets.IDataSet;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
public class CandleStickChartActivity extends DemoBase implements OnSeekBarChangeListener {
private CandleStickChart chart;
private SeekBar seekBarX, seekBarY;
private TextView tvX, tvY;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_candlechart);
setTitle("CandleStickChartActivity");
tvX = findViewById(R.id.tvXMax);
tvY = findViewById(R.id.tvYMax);
seekBarX = findViewById(R.id.seekBar1);
seekBarX.setOnSeekBarChangeListener(this);
seekBarY = findViewById(R.id.seekBar2);
seekBarY.setOnSeekBarChangeListener(this);
chart = findViewById(R.id.chart1);
chart.setBackgroundColor(Color.WHITE);
chart.getDescription().setEnabled(false);
// if more than 60 entries are displayed in the chart, no values will be
// drawn
chart.setMaxVisibleValueCount(60);
// scaling can now only be done on x- and y-axis separately
chart.setPinchZoom(false);
chart.setDrawGridBackground(false);
XAxis xAxis = chart.getXAxis();
xAxis.setPosition(XAxisPosition.BOTTOM);
xAxis.setDrawGridLines(false);
YAxis leftAxis = chart.getAxisLeft();
// leftAxis.setEnabled(false);
leftAxis.setLabelCount(7, false);
leftAxis.setDrawGridLines(false);
leftAxis.setDrawAxisLine(false);
YAxis rightAxis = chart.getAxisRight();
rightAxis.setEnabled(false);
// rightAxis.setStartAtZero(false);
// setting data
seekBarX.setProgress(40);
seekBarY.setProgress(100);
chart.getLegend().setEnabled(false);
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
progress = (seekBarX.getProgress());
tvX.setText(String.valueOf(progress));
tvY.setText(String.valueOf(seekBarY.getProgress()));
chart.resetTracking();
ArrayList<CandleEntry> values = new ArrayList<>();
for (int i = 0; i < progress; i++) {
float multi = (seekBarY.getProgress() + 1);
float val = (float) (Math.random() * 40) + multi;
float high = (float) (Math.random() * 9) + 8f;
float low = (float) (Math.random() * 9) + 8f;
float open = (float) (Math.random() * 6) + 1f;
float close = (float) (Math.random() * 6) + 1f;
boolean even = i % 2 == 0;
values.add(new CandleEntry(
i, val + high,
val - low,
even ? val + open : val - open,
even ? val - close : val + close,
getResources().getDrawable(R.drawable.star)
));
}
CandleDataSet set1 = new CandleDataSet(values, "Data Set");
set1.setDrawIcons(false);
set1.setAxisDependency(AxisDependency.LEFT);
// set1.setColor(Color.rgb(80, 80, 80));
set1.setShadowColor(Color.DKGRAY);
set1.setShadowWidth(0.7f);
set1.setDecreasingColor(Color.RED);
set1.setDecreasingPaintStyle(Paint.Style.FILL);
set1.setIncreasingColor(Color.rgb(122, 242, 84));
set1.setIncreasingPaintStyle(Paint.Style.STROKE);
set1.setNeutralColor(Color.BLUE);
//set1.setHighlightLineWidth(1f);
CandleData data = new CandleData(set1);
chart.setData(data);
chart.invalidate();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.candle, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.viewGithub: {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CandleStickChartActivity.java"));
startActivity(i);
break;
}
case R.id.actionToggleValues: {
for (IDataSet set : chart.getData().getDataSets())
set.setDrawValues(!set.isDrawValuesEnabled());
chart.invalidate();
break;
}
case R.id.actionToggleIcons: {
for (IDataSet set : chart.getData().getDataSets())
set.setDrawIcons(!set.isDrawIconsEnabled());
chart.invalidate();
break;
}
case R.id.actionToggleHighlight: {
if(chart.getData() != null) {
chart.getData().setHighlightEnabled(!chart.getData().isHighlightEnabled());
chart.invalidate();
}
break;
}
case R.id.actionTogglePinch: {
if (chart.isPinchZoomEnabled())
chart.setPinchZoom(false);
else
chart.setPinchZoom(true);
chart.invalidate();
break;
}
case R.id.actionToggleAutoScaleMinMax: {
chart.setAutoScaleMinMaxEnabled(!chart.isAutoScaleMinMaxEnabled());
chart.notifyDataSetChanged();
break;
}
case R.id.actionToggleMakeShadowSameColorAsCandle: {
for (ICandleDataSet set : chart.getData().getDataSets()) {
((CandleDataSet) set).setShadowColorSameAsCandle(!set.getShadowColorSameAsCandle());
}
chart.invalidate();
break;
}
case R.id.animateX: {
chart.animateX(2000);
break;
}
case R.id.animateY: {
chart.animateY(2000);
break;
}
case R.id.animateXY: {
chart.animateXY(2000, 2000);
break;
}
case R.id.actionSave: {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
saveToGallery();
} else {
requestStoragePermission(chart);
}
break;
}
}
return true;
}
@Override
protected void saveToGallery() {
saveToGallery(chart, "CandleStickChartActivity");
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {}
}

View file

@ -0,0 +1,280 @@
package com.xxmassdeveloper.mpchartexample;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import com.github.mikephil.charting.charts.CombinedChart;
import com.github.mikephil.charting.charts.CombinedChart.DrawOrder;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.XAxis.XAxisPosition;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry;
import com.github.mikephil.charting.data.BubbleData;
import com.github.mikephil.charting.data.BubbleDataSet;
import com.github.mikephil.charting.data.BubbleEntry;
import com.github.mikephil.charting.data.CandleData;
import com.github.mikephil.charting.data.CandleDataSet;
import com.github.mikephil.charting.data.CandleEntry;
import com.github.mikephil.charting.data.CombinedData;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.data.ScatterData;
import com.github.mikephil.charting.data.ScatterDataSet;
import com.github.mikephil.charting.formatter.ValueFormatter;
import com.github.mikephil.charting.interfaces.datasets.IDataSet;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
public class CombinedChartActivity extends DemoBase {
private CombinedChart chart;
private final int count = 12;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_combined);
setTitle("CombinedChartActivity");
chart = findViewById(R.id.chart1);
chart.getDescription().setEnabled(false);
chart.setBackgroundColor(Color.WHITE);
chart.setDrawGridBackground(false);
chart.setDrawBarShadow(false);
chart.setHighlightFullBarEnabled(false);
// draw bars behind lines
chart.setDrawOrder(new DrawOrder[]{
DrawOrder.BAR, DrawOrder.BUBBLE, DrawOrder.CANDLE, DrawOrder.LINE, DrawOrder.SCATTER
});
Legend l = chart.getLegend();
l.setWordWrapEnabled(true);
l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
l.setDrawInside(false);
YAxis rightAxis = chart.getAxisRight();
rightAxis.setDrawGridLines(false);
rightAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)
YAxis leftAxis = chart.getAxisLeft();
leftAxis.setDrawGridLines(false);
leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)
XAxis xAxis = chart.getXAxis();
xAxis.setPosition(XAxisPosition.BOTH_SIDED);
xAxis.setAxisMinimum(0f);
xAxis.setGranularity(1f);
xAxis.setValueFormatter(new ValueFormatter() {
@Override
public String getFormattedValue(float value) {
return months[(int) value % months.length];
}
});
CombinedData data = new CombinedData();
data.setData(generateLineData());
data.setData(generateBarData());
data.setData(generateBubbleData());
data.setData(generateScatterData());
data.setData(generateCandleData());
data.setValueTypeface(tfLight);
xAxis.setAxisMaximum(data.getXMax() + 0.25f);
chart.setData(data);
chart.invalidate();
}
private LineData generateLineData() {
LineData d = new LineData();
ArrayList<Entry> entries = new ArrayList<>();
for (int index = 0; index < count; index++)
entries.add(new Entry(index + 0.5f, getRandom(15, 5)));
LineDataSet set = new LineDataSet(entries, "Line DataSet");
set.setColor(Color.rgb(240, 238, 70));
set.setLineWidth(2.5f);
set.setCircleColor(Color.rgb(240, 238, 70));
set.setCircleRadius(5f);
set.setFillColor(Color.rgb(240, 238, 70));
set.setMode(LineDataSet.Mode.CUBIC_BEZIER);
set.setDrawValues(true);
set.setValueTextSize(10f);
set.setValueTextColor(Color.rgb(240, 238, 70));
set.setAxisDependency(YAxis.AxisDependency.LEFT);
d.addDataSet(set);
return d;
}
private BarData generateBarData() {
ArrayList<BarEntry> entries1 = new ArrayList<>();
ArrayList<BarEntry> entries2 = new ArrayList<>();
for (int index = 0; index < count; index++) {
entries1.add(new BarEntry(0, getRandom(25, 25)));
// stacked
entries2.add(new BarEntry(0, new float[]{getRandom(13, 12), getRandom(13, 12)}));
}
BarDataSet set1 = new BarDataSet(entries1, "Bar 1");
set1.setColor(Color.rgb(60, 220, 78));
set1.setValueTextColor(Color.rgb(60, 220, 78));
set1.setValueTextSize(10f);
set1.setAxisDependency(YAxis.AxisDependency.LEFT);
BarDataSet set2 = new BarDataSet(entries2, "");
set2.setStackLabels(new String[]{"Stack 1", "Stack 2"});
set2.setColors(Color.rgb(61, 165, 255), Color.rgb(23, 197, 255));
set2.setValueTextColor(Color.rgb(61, 165, 255));
set2.setValueTextSize(10f);
set2.setAxisDependency(YAxis.AxisDependency.LEFT);
float groupSpace = 0.06f;
float barSpace = 0.02f; // x2 dataset
float barWidth = 0.45f; // x2 dataset
// (0.45 + 0.02) * 2 + 0.06 = 1.00 -> interval per "group"
BarData d = new BarData(set1, set2);
d.setBarWidth(barWidth);
// make this BarData object grouped
d.groupBars(0, groupSpace, barSpace); // start at x = 0
return d;
}
private ScatterData generateScatterData() {
ScatterData d = new ScatterData();
ArrayList<Entry> entries = new ArrayList<>();
for (float index = 0; index < count; index += 0.5f)
entries.add(new Entry(index + 0.25f, getRandom(10, 55)));
ScatterDataSet set = new ScatterDataSet(entries, "Scatter DataSet");
set.setColors(ColorTemplate.MATERIAL_COLORS);
set.setScatterShapeSize(7.5f);
set.setDrawValues(false);
set.setValueTextSize(10f);
d.addDataSet(set);
return d;
}
private CandleData generateCandleData() {
CandleData d = new CandleData();
ArrayList<CandleEntry> entries = new ArrayList<>();
for (int index = 0; index < count; index += 2)
entries.add(new CandleEntry(index + 1f, 90, 70, 85, 75f));
CandleDataSet set = new CandleDataSet(entries, "Candle DataSet");
set.setDecreasingColor(Color.rgb(142, 150, 175));
set.setShadowColor(Color.DKGRAY);
set.setBarSpace(0.3f);
set.setValueTextSize(10f);
set.setDrawValues(false);
d.addDataSet(set);
return d;
}
private BubbleData generateBubbleData() {
BubbleData bd = new BubbleData();
ArrayList<BubbleEntry> entries = new ArrayList<>();
for (int index = 0; index < count; index++) {
float y = getRandom(10, 105);
float size = getRandom(100, 105);
entries.add(new BubbleEntry(index + 0.5f, y, size));
}
BubbleDataSet set = new BubbleDataSet(entries, "Bubble DataSet");
set.setColors(ColorTemplate.VORDIPLOM_COLORS);
set.setValueTextSize(10f);
set.setValueTextColor(Color.WHITE);
set.setHighlightCircleWidth(1.5f);
set.setDrawValues(true);
bd.addDataSet(set);
return bd;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.combined, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.viewGithub: {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CombinedChartActivity.java"));
startActivity(i);
break;
}
case R.id.actionToggleLineValues: {
for (IDataSet set : chart.getData().getDataSets()) {
if (set instanceof LineDataSet)
set.setDrawValues(!set.isDrawValuesEnabled());
}
chart.invalidate();
break;
}
case R.id.actionToggleBarValues: {
for (IDataSet set : chart.getData().getDataSets()) {
if (set instanceof BarDataSet)
set.setDrawValues(!set.isDrawValuesEnabled());
}
chart.invalidate();
break;
}
case R.id.actionRemoveDataSet: {
int rnd = (int) getRandom(chart.getData().getDataSetCount(), 0);
chart.getData().removeDataSet(chart.getData().getDataSetByIndex(rnd));
chart.getData().notifyDataChanged();
chart.notifyDataSetChanged();
chart.invalidate();
break;
}
}
return true;
}
@Override
public void saveToGallery() { /* Intentionally left empty */ }
}

View file

@ -0,0 +1,320 @@
package com.xxmassdeveloper.mpchartexample;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import androidx.core.content.ContextCompat;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.formatter.IFillFormatter;
import com.github.mikephil.charting.interfaces.dataprovider.LineDataProvider;
import com.github.mikephil.charting.interfaces.datasets.IDataSet;
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
import java.util.List;
public class CubicLineChartActivity extends DemoBase implements OnSeekBarChangeListener {
private LineChart chart;
private SeekBar seekBarX, seekBarY;
private TextView tvX, tvY;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_linechart);
setTitle("CubicLineChartActivity");
tvX = findViewById(R.id.tvXMax);
tvY = findViewById(R.id.tvYMax);
seekBarX = findViewById(R.id.seekBar1);
seekBarY = findViewById(R.id.seekBar2);
chart = findViewById(R.id.chart1);
chart.setViewPortOffsets(0, 0, 0, 0);
chart.setBackgroundColor(Color.rgb(104, 241, 175));
// no description text
chart.getDescription().setEnabled(false);
// enable touch gestures
chart.setTouchEnabled(true);
// enable scaling and dragging
chart.setDragEnabled(true);
chart.setScaleEnabled(true);
// if disabled, scaling can be done on x- and y-axis separately
chart.setPinchZoom(false);
chart.setDrawGridBackground(false);
chart.setMaxHighlightDistance(300);
XAxis x = chart.getXAxis();
x.setEnabled(false);
YAxis y = chart.getAxisLeft();
y.setTypeface(tfLight);
y.setLabelCount(6, false);
y.setTextColor(Color.WHITE);
y.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
y.setDrawGridLines(false);
y.setAxisLineColor(Color.WHITE);
chart.getAxisRight().setEnabled(false);
// add data
seekBarY.setOnSeekBarChangeListener(this);
seekBarX.setOnSeekBarChangeListener(this);
// lower max, as cubic runs significantly slower than linear
seekBarX.setMax(700);
seekBarX.setProgress(45);
seekBarY.setProgress(100);
chart.getLegend().setEnabled(false);
chart.animateXY(2000, 2000);
// don't forget to refresh the drawing
chart.invalidate();
}
private void setData(int count, float range) {
ArrayList<Entry> values = new ArrayList<>();
for (int i = 0; i < count; i++) {
float val = (float) (Math.random() * (range + 1)) + 20;
values.add(new Entry(i, val));
}
LineDataSet set1;
if (chart.getData() != null &&
chart.getData().getDataSetCount() > 0) {
set1 = (LineDataSet) chart.getData().getDataSetByIndex(0);
set1.setValues(values);
chart.getData().notifyDataChanged();
chart.notifyDataSetChanged();
} else {
// create a dataset and give it a type
set1 = new LineDataSet(values, "DataSet 1");
set1.setMode(LineDataSet.Mode.CUBIC_BEZIER);
set1.setCubicIntensity(0.2f);
set1.setDrawFilled(true);
set1.setDrawCircles(false);
set1.setLineWidth(1.8f);
set1.setCircleRadius(4f);
set1.setCircleColor(Color.WHITE);
set1.setHighLightColor(Color.rgb(244, 117, 117));
set1.setColor(Color.WHITE);
set1.setFillColor(Color.WHITE);
set1.setFillAlpha(100);
set1.setDrawHorizontalHighlightIndicator(false);
set1.setFillFormatter(new IFillFormatter() {
@Override
public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) {
return chart.getAxisLeft().getAxisMinimum();
}
});
// create a data object with the data sets
LineData data = new LineData(set1);
data.setValueTypeface(tfLight);
data.setValueTextSize(9f);
data.setDrawValues(false);
// set data
chart.setData(data);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.line, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.viewGithub: {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CubicLineChartActivity.java"));
startActivity(i);
break;
}
case R.id.actionToggleValues: {
for (IDataSet set : chart.getData().getDataSets())
set.setDrawValues(!set.isDrawValuesEnabled());
chart.invalidate();
break;
}
case R.id.actionToggleHighlight: {
if(chart.getData() != null) {
chart.getData().setHighlightEnabled(!chart.getData().isHighlightEnabled());
chart.invalidate();
}
break;
}
case R.id.actionToggleFilled: {
List<ILineDataSet> sets = chart.getData()
.getDataSets();
for (ILineDataSet iSet : sets) {
LineDataSet set = (LineDataSet) iSet;
if (set.isDrawFilledEnabled())
set.setDrawFilled(false);
else
set.setDrawFilled(true);
}
chart.invalidate();
break;
}
case R.id.actionToggleCircles: {
List<ILineDataSet> sets = chart.getData()
.getDataSets();
for (ILineDataSet iSet : sets) {
LineDataSet set = (LineDataSet) iSet;
if (set.isDrawCirclesEnabled())
set.setDrawCircles(false);
else
set.setDrawCircles(true);
}
chart.invalidate();
break;
}
case R.id.actionToggleCubic: {
List<ILineDataSet> sets = chart.getData()
.getDataSets();
for (ILineDataSet iSet : sets) {
LineDataSet set = (LineDataSet) iSet;
set.setMode(set.getMode() == LineDataSet.Mode.CUBIC_BEZIER
? LineDataSet.Mode.LINEAR
: LineDataSet.Mode.CUBIC_BEZIER);
}
chart.invalidate();
break;
}
case R.id.actionToggleStepped: {
List<ILineDataSet> sets = chart.getData()
.getDataSets();
for (ILineDataSet iSet : sets) {
LineDataSet set = (LineDataSet) iSet;
set.setMode(set.getMode() == LineDataSet.Mode.STEPPED
? LineDataSet.Mode.LINEAR
: LineDataSet.Mode.STEPPED);
}
chart.invalidate();
break;
}
case R.id.actionToggleHorizontalCubic: {
List<ILineDataSet> sets = chart.getData()
.getDataSets();
for (ILineDataSet iSet : sets) {
LineDataSet set = (LineDataSet) iSet;
set.setMode(set.getMode() == LineDataSet.Mode.HORIZONTAL_BEZIER
? LineDataSet.Mode.LINEAR
: LineDataSet.Mode.HORIZONTAL_BEZIER);
}
chart.invalidate();
break;
}
case R.id.actionTogglePinch: {
if (chart.isPinchZoomEnabled())
chart.setPinchZoom(false);
else
chart.setPinchZoom(true);
chart.invalidate();
break;
}
case R.id.actionToggleAutoScaleMinMax: {
chart.setAutoScaleMinMaxEnabled(!chart.isAutoScaleMinMaxEnabled());
chart.notifyDataSetChanged();
break;
}
case R.id.animateX: {
chart.animateX(2000);
break;
}
case R.id.animateY: {
chart.animateY(2000);
break;
}
case R.id.animateXY: {
chart.animateXY(2000, 2000);
break;
}
case R.id.actionSave: {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
saveToGallery();
} else {
requestStoragePermission(chart);
}
break;
}
}
return true;
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
tvX.setText(String.valueOf(seekBarX.getProgress()));
tvY.setText(String.valueOf(seekBarY.getProgress()));
setData(seekBarX.getProgress(), seekBarY.getProgress());
// redraw
chart.invalidate();
}
@Override
protected void saveToGallery() {
saveToGallery(chart, "CubicLineChartActivity");
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {}
}

View file

@ -0,0 +1,184 @@
// TODO: Finish and add to main activity list
package com.xxmassdeveloper.mpchartexample;
import android.Manifest;
import android.content.pm.PackageManager;
import android.os.Bundle;
import androidx.core.content.ContextCompat;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import com.github.mikephil.charting.charts.Chart;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.data.DataSet;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
import com.github.mikephil.charting.listener.OnDrawListener;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
import java.util.List;
/**
* This Activity demonstrates drawing into the Chart with the finger. Both line,
* bar and scatter charts can be used for drawing.
*
* @author Philipp Jahoda
*/
public class DrawChartActivity extends DemoBase implements OnChartValueSelectedListener,
OnDrawListener {
private LineChart chart;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_draw_chart);
setTitle("DrawChartActivity");
chart = findViewById(R.id.chart1);
// listener for selecting and drawing
chart.setOnChartValueSelectedListener(this);
chart.setOnDrawListener(this);
// if disabled, drawn data sets with the finger will not be automatically
// finished
// chart.setAutoFinish(true);
chart.setDrawGridBackground(false);
// add dummy-data to the chart
initWithDummyData();
XAxis xl = chart.getXAxis();
xl.setTypeface(tfRegular);
xl.setAvoidFirstLastClipping(true);
YAxis yl = chart.getAxisLeft();
yl.setTypeface(tfRegular);
chart.getLegend().setEnabled(false);
// chart.setYRange(-40f, 40f, true);
// call this to reset the changed y-range
// chart.resetYRange(true);
}
private void initWithDummyData() {
ArrayList<Entry> values = new ArrayList<>();
// create a dataset and give it a type (0)
LineDataSet set1 = new LineDataSet(values, "DataSet");
set1.setLineWidth(3f);
set1.setCircleRadius(5f);
// create a data object with the data sets
LineData data = new LineData(set1);
chart.setData(data);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.draw, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.actionToggleValues: {
List<ILineDataSet> sets = chart.getData()
.getDataSets();
for (ILineDataSet iSet : sets) {
LineDataSet set = (LineDataSet) iSet;
set.setDrawValues(!set.isDrawValuesEnabled());
}
chart.invalidate();
break;
}
case R.id.actionToggleHighlight: {
if(chart.getData() != null) {
chart.getData().setHighlightEnabled(!chart.getData().isHighlightEnabled());
chart.invalidate();
}
break;
}
case R.id.actionTogglePinch: {
if (chart.isPinchZoomEnabled())
chart.setPinchZoom(false);
else
chart.setPinchZoom(true);
chart.invalidate();
break;
}
case R.id.actionToggleAutoScaleMinMax: {
chart.setAutoScaleMinMaxEnabled(!chart.isAutoScaleMinMaxEnabled());
chart.notifyDataSetChanged();
break;
}
case R.id.actionSave: {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
saveToGallery();
} else {
requestStoragePermission(chart);
}
break;
}
}
return true;
}
@Override
protected void saveToGallery() {
saveToGallery(chart, "DrawChartActivity");
}
@Override
public void onValueSelected(Entry e, Highlight h) {
Log.i("VAL SELECTED",
"Value: " + e.getY() + ", xIndex: " + e.getX()
+ ", DataSet index: " + h.getDataSetIndex());
}
@Override
public void onNothingSelected() {
}
/** callback for each new entry drawn with the finger */
@Override
public void onEntryAdded(Entry entry) {
Log.i(Chart.LOG_TAG, entry.toString());
}
/** callback when a DataSet has been drawn (when lifting the finger) */
@Override
public void onDrawFinished(DataSet<?> dataSet) {
Log.i(Chart.LOG_TAG, "DataSet drawn. " + dataSet.toSimpleString());
// prepare the legend again
chart.getLegendRenderer().computeLegend(chart.getData());
}
@Override
public void onEntryMoved(Entry entry) {
Log.i(Chart.LOG_TAG, "Point moved " + entry.toString());
}
}

View file

@ -0,0 +1,242 @@
package com.xxmassdeveloper.mpchartexample;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import androidx.core.content.ContextCompat;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.Toast;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.components.YAxis.AxisDependency;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
public class DynamicalAddingActivity extends DemoBase implements OnChartValueSelectedListener {
private LineChart chart;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_linechart_noseekbar);
setTitle("DynamicalAddingActivity");
chart = findViewById(R.id.chart1);
chart.setOnChartValueSelectedListener(this);
chart.setDrawGridBackground(false);
chart.getDescription().setEnabled(false);
chart.setNoDataText("No chart data available. Use the menu to add entries and data sets!");
// chart.getXAxis().setDrawLabels(false);
// chart.getXAxis().setDrawGridLines(false);
chart.invalidate();
}
private final int[] colors = ColorTemplate.VORDIPLOM_COLORS;
private void addEntry() {
LineData data = chart.getData();
if (data == null) {
data = new LineData();
chart.setData(data);
}
ILineDataSet set = data.getDataSetByIndex(0);
// set.addEntry(...); // can be called as well
if (set == null) {
set = createSet();
data.addDataSet(set);
}
// choose a random dataSet
int randomDataSetIndex = (int) (Math.random() * data.getDataSetCount());
ILineDataSet randomSet = data.getDataSetByIndex(randomDataSetIndex);
float value = (float) (Math.random() * 50) + 50f * (randomDataSetIndex + 1);
data.addEntry(new Entry(randomSet.getEntryCount(), value), randomDataSetIndex);
data.notifyDataChanged();
// let the chart know it's data has changed
chart.notifyDataSetChanged();
chart.setVisibleXRangeMaximum(6);
//chart.setVisibleYRangeMaximum(15, AxisDependency.LEFT);
//
// // this automatically refreshes the chart (calls invalidate())
chart.moveViewTo(data.getEntryCount() - 7, 50f, AxisDependency.LEFT);
}
private void removeLastEntry() {
LineData data = chart.getData();
if (data != null) {
ILineDataSet set = data.getDataSetByIndex(0);
if (set != null) {
Entry e = set.getEntryForXValue(set.getEntryCount() - 1, Float.NaN);
data.removeEntry(e, 0);
// or remove by index
// mData.removeEntryByXValue(xIndex, dataSetIndex);
data.notifyDataChanged();
chart.notifyDataSetChanged();
chart.invalidate();
}
}
}
private void addDataSet() {
LineData data = chart.getData();
if (data == null) {
chart.setData(new LineData());
} else {
int count = (data.getDataSetCount() + 1);
int amount = data.getDataSetByIndex(0).getEntryCount();
ArrayList<Entry> values = new ArrayList<>();
for (int i = 0; i < amount; i++) {
values.add(new Entry(i, (float) (Math.random() * 50f) + 50f * count));
}
LineDataSet set = new LineDataSet(values, "DataSet " + count);
set.setLineWidth(2.5f);
set.setCircleRadius(4.5f);
int color = colors[count % colors.length];
set.setColor(color);
set.setCircleColor(color);
set.setHighLightColor(color);
set.setValueTextSize(10f);
set.setValueTextColor(color);
data.addDataSet(set);
data.notifyDataChanged();
chart.notifyDataSetChanged();
chart.invalidate();
}
}
private void removeDataSet() {
LineData data = chart.getData();
if (data != null) {
data.removeDataSet(data.getDataSetByIndex(data.getDataSetCount() - 1));
chart.notifyDataSetChanged();
chart.invalidate();
}
}
private LineDataSet createSet() {
LineDataSet set = new LineDataSet(null, "DataSet 1");
set.setLineWidth(2.5f);
set.setCircleRadius(4.5f);
set.setColor(Color.rgb(240, 99, 99));
set.setCircleColor(Color.rgb(240, 99, 99));
set.setHighLightColor(Color.rgb(190, 190, 190));
set.setAxisDependency(AxisDependency.LEFT);
set.setValueTextSize(10f);
return set;
}
@Override
public void onValueSelected(Entry e, Highlight h) {
Toast.makeText(this, e.toString(), Toast.LENGTH_SHORT).show();
}
@Override
public void onNothingSelected() {}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.dynamical, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.viewGithub: {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/DynamicalAddingActivity.java"));
startActivity(i);
break;
}
case R.id.actionAddEntry: {
addEntry();
Toast.makeText(this, "Entry added!", Toast.LENGTH_SHORT).show();
break;
}
case R.id.actionRemoveEntry: {
removeLastEntry();
Toast.makeText(this, "Entry removed!", Toast.LENGTH_SHORT).show();
break;
}
case R.id.actionAddDataSet: {
addDataSet();
Toast.makeText(this, "DataSet added!", Toast.LENGTH_SHORT).show();
break;
}
case R.id.actionRemoveDataSet: {
removeDataSet();
Toast.makeText(this, "DataSet removed!", Toast.LENGTH_SHORT).show();
break;
}
case R.id.actionClear: {
chart.clear();
Toast.makeText(this, "Chart cleared!", Toast.LENGTH_SHORT).show();
break;
}
case R.id.actionSave: {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
saveToGallery();
} else {
requestStoragePermission(chart);
}
break;
}
}
return true;
}
@Override
protected void saveToGallery() {
saveToGallery(chart, "DynamicalAddingActivity");
}
}

View file

@ -0,0 +1,189 @@
package com.xxmassdeveloper.mpchartexample;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.formatter.IFillFormatter;
import com.github.mikephil.charting.interfaces.dataprovider.LineDataProvider;
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
/**
* This works by inverting the background and desired "fill" color. First, we draw the fill color
* that we want between the lines as the actual background of the chart. Then, we fill the area
* above the highest line and the area under the lowest line with the desired background color.
*
* This method makes it look like we filled the area between the lines, but really we are filling
* the area OUTSIDE the lines!
*/
@SuppressWarnings("SameParameterValue")
public class FilledLineActivity extends DemoBase {
private LineChart chart;
private final int fillColor = Color.argb(150, 51, 181, 229);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_linechart_noseekbar);
setTitle("FilledLineActivity");
chart = findViewById(R.id.chart1);
chart.setBackgroundColor(Color.WHITE);
chart.setGridBackgroundColor(fillColor);
chart.setDrawGridBackground(true);
chart.setDrawBorders(true);
// no description text
chart.getDescription().setEnabled(false);
// if disabled, scaling can be done on x- and y-axis separately
chart.setPinchZoom(false);
Legend l = chart.getLegend();
l.setEnabled(false);
XAxis xAxis = chart.getXAxis();
xAxis.setEnabled(false);
YAxis leftAxis = chart.getAxisLeft();
leftAxis.setAxisMaximum(900f);
leftAxis.setAxisMinimum(-250f);
leftAxis.setDrawAxisLine(false);
leftAxis.setDrawZeroLine(false);
leftAxis.setDrawGridLines(false);
chart.getAxisRight().setEnabled(false);
// add data
setData(100, 60);
chart.invalidate();
}
private void setData(int count, float range) {
ArrayList<Entry> values1 = new ArrayList<>();
for (int i = 0; i < count; i++) {
float val = (float) (Math.random() * range) + 50;
values1.add(new Entry(i, val));
}
ArrayList<Entry> values2 = new ArrayList<>();
for (int i = 0; i < count; i++) {
float val = (float) (Math.random() * range) + 450;
values2.add(new Entry(i, val));
}
LineDataSet set1, set2;
if (chart.getData() != null &&
chart.getData().getDataSetCount() > 0) {
set1 = (LineDataSet) chart.getData().getDataSetByIndex(0);
set2 = (LineDataSet) chart.getData().getDataSetByIndex(1);
set1.setValues(values1);
set2.setValues(values2);
chart.getData().notifyDataChanged();
chart.notifyDataSetChanged();
} else {
// create a dataset and give it a type
set1 = new LineDataSet(values1, "DataSet 1");
set1.setAxisDependency(YAxis.AxisDependency.LEFT);
set1.setColor(Color.rgb(255, 241, 46));
set1.setDrawCircles(false);
set1.setLineWidth(2f);
set1.setCircleRadius(3f);
set1.setFillAlpha(255);
set1.setDrawFilled(true);
set1.setFillColor(Color.WHITE);
set1.setHighLightColor(Color.rgb(244, 117, 117));
set1.setDrawCircleHole(false);
set1.setFillFormatter(new IFillFormatter() {
@Override
public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) {
// change the return value here to better understand the effect
// return 0;
return chart.getAxisLeft().getAxisMinimum();
}
});
// create a dataset and give it a type
set2 = new LineDataSet(values2, "DataSet 2");
set2.setAxisDependency(YAxis.AxisDependency.LEFT);
set2.setColor(Color.rgb(255, 241, 46));
set2.setDrawCircles(false);
set2.setLineWidth(2f);
set2.setCircleRadius(3f);
set2.setFillAlpha(255);
set2.setDrawFilled(true);
set2.setFillColor(Color.WHITE);
set2.setDrawCircleHole(false);
set2.setHighLightColor(Color.rgb(244, 117, 117));
set2.setFillFormatter(new IFillFormatter() {
@Override
public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) {
// change the return value here to better understand the effect
// return 600;
return chart.getAxisLeft().getAxisMaximum();
}
});
ArrayList<ILineDataSet> dataSets = new ArrayList<>();
dataSets.add(set1); // add the data sets
dataSets.add(set2);
// create a data object with the data sets
LineData data = new LineData(dataSets);
data.setDrawValues(false);
// set data
chart.setData(data);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.only_github, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.viewGithub: {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/FilledLineActivity.java"));
startActivity(i);
break;
}
}
return true;
}
@Override
public void saveToGallery() { /* Intentionally left empty */ }
}

View file

@ -0,0 +1,168 @@
package com.xxmassdeveloper.mpchartexample;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import android.text.style.RelativeSizeSpan;
import android.text.style.StyleSpan;
import android.util.DisplayMetrics;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.RelativeLayout;
import com.github.mikephil.charting.animation.Easing;
import com.github.mikephil.charting.charts.PieChart;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.data.PieData;
import com.github.mikephil.charting.data.PieDataSet;
import com.github.mikephil.charting.data.PieEntry;
import com.github.mikephil.charting.formatter.PercentFormatter;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
@SuppressWarnings("SameParameterValue")
public class HalfPieChartActivity extends DemoBase {
private PieChart chart;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_piechart_half);
setTitle("HalfPieChartActivity");
chart = findViewById(R.id.chart1);
chart.setBackgroundColor(Color.WHITE);
moveOffScreen();
chart.setUsePercentValues(true);
chart.getDescription().setEnabled(false);
chart.setCenterTextTypeface(tfLight);
chart.setCenterText(generateCenterSpannableText());
chart.setDrawHoleEnabled(true);
chart.setHoleColor(Color.WHITE);
chart.setTransparentCircleColor(Color.WHITE);
chart.setTransparentCircleAlpha(110);
chart.setHoleRadius(58f);
chart.setTransparentCircleRadius(61f);
chart.setDrawCenterText(true);
chart.setRotationEnabled(false);
chart.setHighlightPerTapEnabled(true);
chart.setMaxAngle(180f); // HALF CHART
chart.setRotationAngle(180f);
chart.setCenterTextOffset(0, -20);
setData(4, 100);
chart.animateY(1400, Easing.EaseInOutQuad);
Legend l = chart.getLegend();
l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
l.setDrawInside(false);
l.setXEntrySpace(7f);
l.setYEntrySpace(0f);
l.setYOffset(0f);
// entry label styling
chart.setEntryLabelColor(Color.WHITE);
chart.setEntryLabelTypeface(tfRegular);
chart.setEntryLabelTextSize(12f);
}
private void setData(int count, float range) {
ArrayList<PieEntry> values = new ArrayList<>();
for (int i = 0; i < count; i++) {
values.add(new PieEntry((float) ((Math.random() * range) + range / 5), parties[i % parties.length]));
}
PieDataSet dataSet = new PieDataSet(values, "Election Results");
dataSet.setSliceSpace(3f);
dataSet.setSelectionShift(5f);
dataSet.setColors(ColorTemplate.MATERIAL_COLORS);
//dataSet.setSelectionShift(0f);
PieData data = new PieData(dataSet);
data.setValueFormatter(new PercentFormatter());
data.setValueTextSize(11f);
data.setValueTextColor(Color.WHITE);
data.setValueTypeface(tfLight);
chart.setData(data);
chart.invalidate();
}
private SpannableString generateCenterSpannableText() {
SpannableString s = new SpannableString("MPAndroidChart\ndeveloped by Philipp Jahoda");
s.setSpan(new RelativeSizeSpan(1.7f), 0, 14, 0);
s.setSpan(new StyleSpan(Typeface.NORMAL), 14, s.length() - 15, 0);
s.setSpan(new ForegroundColorSpan(Color.GRAY), 14, s.length() - 15, 0);
s.setSpan(new RelativeSizeSpan(.8f), 14, s.length() - 15, 0);
s.setSpan(new StyleSpan(Typeface.ITALIC), s.length() - 14, s.length(), 0);
s.setSpan(new ForegroundColorSpan(ColorTemplate.getHoloBlue()), s.length() - 14, s.length(), 0);
return s;
}
private void moveOffScreen() {
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int height = displayMetrics.heightPixels;
int offset = (int)(height * 0.65); /* percent to move */
RelativeLayout.LayoutParams rlParams =
(RelativeLayout.LayoutParams) chart.getLayoutParams();
rlParams.setMargins(0, 0, 0, -offset);
chart.setLayoutParams(rlParams);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.only_github, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.viewGithub: {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/HalfPieChartActivity.java"));
startActivity(i);
break;
}
}
return true;
}
@Override
public void saveToGallery() { /* Intentionally left empty */ }
}

View file

@ -0,0 +1,291 @@
package com.xxmassdeveloper.mpchartexample;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.RectF;
import android.net.Uri;
import android.os.Bundle;
import androidx.core.content.ContextCompat;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import com.github.mikephil.charting.charts.HorizontalBarChart;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.XAxis.XAxisPosition;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet;
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
import com.github.mikephil.charting.utils.MPPointF;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
import java.util.List;
public class HorizontalBarChartActivity extends DemoBase implements OnSeekBarChangeListener,
OnChartValueSelectedListener {
private HorizontalBarChart chart;
private SeekBar seekBarX, seekBarY;
private TextView tvX, tvY;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_horizontalbarchart);
setTitle("HorizontalBarChartActivity");
tvX = findViewById(R.id.tvXMax);
tvY = findViewById(R.id.tvYMax);
seekBarX = findViewById(R.id.seekBar1);
seekBarY = findViewById(R.id.seekBar2);
seekBarY.setOnSeekBarChangeListener(this);
seekBarX.setOnSeekBarChangeListener(this);
chart = findViewById(R.id.chart1);
chart.setOnChartValueSelectedListener(this);
// chart.setHighlightEnabled(false);
chart.setDrawBarShadow(false);
chart.setDrawValueAboveBar(true);
chart.getDescription().setEnabled(false);
// if more than 60 entries are displayed in the chart, no values will be
// drawn
chart.setMaxVisibleValueCount(60);
// scaling can now only be done on x- and y-axis separately
chart.setPinchZoom(false);
// draw shadows for each bar that show the maximum value
// chart.setDrawBarShadow(true);
chart.setDrawGridBackground(false);
XAxis xl = chart.getXAxis();
xl.setPosition(XAxisPosition.BOTTOM);
xl.setTypeface(tfLight);
xl.setDrawAxisLine(true);
xl.setDrawGridLines(false);
xl.setGranularity(10f);
YAxis yl = chart.getAxisLeft();
yl.setTypeface(tfLight);
yl.setDrawAxisLine(true);
yl.setDrawGridLines(true);
yl.setAxisMinimum(0f); // this replaces setStartAtZero(true)
// yl.setInverted(true);
YAxis yr = chart.getAxisRight();
yr.setTypeface(tfLight);
yr.setDrawAxisLine(true);
yr.setDrawGridLines(false);
yr.setAxisMinimum(0f); // this replaces setStartAtZero(true)
// yr.setInverted(true);
chart.setFitBars(true);
chart.animateY(2500);
// setting data
seekBarY.setProgress(50);
seekBarX.setProgress(12);
Legend l = chart.getLegend();
l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.LEFT);
l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
l.setDrawInside(false);
l.setFormSize(8f);
l.setXEntrySpace(4f);
}
private void setData(int count, float range) {
float barWidth = 9f;
float spaceForBar = 10f;
ArrayList<BarEntry> values = new ArrayList<>();
for (int i = 0; i < count; i++) {
float val = (float) (Math.random() * range);
values.add(new BarEntry(i * spaceForBar, val,
getResources().getDrawable(R.drawable.star)));
}
BarDataSet set1;
if (chart.getData() != null &&
chart.getData().getDataSetCount() > 0) {
set1 = (BarDataSet) chart.getData().getDataSetByIndex(0);
set1.setValues(values);
chart.getData().notifyDataChanged();
chart.notifyDataSetChanged();
} else {
set1 = new BarDataSet(values, "DataSet 1");
set1.setDrawIcons(false);
ArrayList<IBarDataSet> dataSets = new ArrayList<>();
dataSets.add(set1);
BarData data = new BarData(dataSets);
data.setValueTextSize(10f);
data.setValueTypeface(tfLight);
data.setBarWidth(barWidth);
chart.setData(data);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.bar, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.viewGithub: {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/HorizontalBarChartActivity.java"));
startActivity(i);
break;
}
case R.id.actionToggleValues: {
List<IBarDataSet> sets = chart.getData()
.getDataSets();
for (IBarDataSet iSet : sets) {
iSet.setDrawValues(!iSet.isDrawValuesEnabled());
}
chart.invalidate();
break;
}
case R.id.actionToggleIcons: {
List<IBarDataSet> sets = chart.getData()
.getDataSets();
for (IBarDataSet iSet : sets) {
iSet.setDrawIcons(!iSet.isDrawIconsEnabled());
}
chart.invalidate();
break;
}
case R.id.actionToggleHighlight: {
if(chart.getData() != null) {
chart.getData().setHighlightEnabled(!chart.getData().isHighlightEnabled());
chart.invalidate();
}
break;
}
case R.id.actionTogglePinch: {
if (chart.isPinchZoomEnabled())
chart.setPinchZoom(false);
else
chart.setPinchZoom(true);
chart.invalidate();
break;
}
case R.id.actionToggleAutoScaleMinMax: {
chart.setAutoScaleMinMaxEnabled(!chart.isAutoScaleMinMaxEnabled());
chart.notifyDataSetChanged();
break;
}
case R.id.actionToggleBarBorders: {
for (IBarDataSet set : chart.getData().getDataSets())
((BarDataSet)set).setBarBorderWidth(set.getBarBorderWidth() == 1.f ? 0.f : 1.f);
chart.invalidate();
break;
}
case R.id.animateX: {
chart.animateX(2000);
break;
}
case R.id.animateY: {
chart.animateY(2000);
break;
}
case R.id.animateXY: {
chart.animateXY(2000, 2000);
break;
}
case R.id.actionSave: {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
saveToGallery();
} else {
requestStoragePermission(chart);
}
break;
}
}
return true;
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
tvX.setText(String.valueOf(seekBarX.getProgress()));
tvY.setText(String.valueOf(seekBarY.getProgress()));
setData(seekBarX.getProgress(), seekBarY.getProgress());
chart.setFitBars(true);
chart.invalidate();
}
@Override
protected void saveToGallery() {
saveToGallery(chart, "HorizontalBarChartActivity");
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {}
private final RectF mOnValueSelectedRectF = new RectF();
@Override
public void onValueSelected(Entry e, Highlight h) {
if (e == null)
return;
RectF bounds = mOnValueSelectedRectF;
chart.getBarBounds((BarEntry) e, bounds);
MPPointF position = chart.getPosition(e, chart.getData().getDataSetByIndex(h.getDataSetIndex())
.getAxisDependency());
Log.i("bounds", bounds.toString());
Log.i("position", position.toString());
MPPointF.recycleInstance(position);
}
@Override
public void onNothingSelected() {}
}

View file

@ -0,0 +1,292 @@
package com.xxmassdeveloper.mpchartexample;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.RectF;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import android.widget.Toast;
import androidx.core.content.ContextCompat;
import com.github.mikephil.charting.charts.HorizontalBarChart;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.XAxis.XAxisPosition;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet;
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
import com.github.mikephil.charting.utils.MPPointF;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
import java.util.List;
public class HorizontalBarNegativeChartActivity extends DemoBase implements OnSeekBarChangeListener,
OnChartValueSelectedListener {
private HorizontalBarChart chart;
private SeekBar seekBarX, seekBarY;
private TextView tvX, tvY;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_horizontalbarchart);
setTitle("HorizontalBarChartActivity");
tvX = findViewById(R.id.tvXMax);
tvY = findViewById(R.id.tvYMax);
seekBarX = findViewById(R.id.seekBar1);
seekBarY = findViewById(R.id.seekBar2);
seekBarY.setOnSeekBarChangeListener(this);
seekBarX.setOnSeekBarChangeListener(this);
chart = findViewById(R.id.chart1);
chart.setOnChartValueSelectedListener(this);
// chart.setHighlightEnabled(false);
chart.setDrawBarShadow(false);
chart.setDrawValueAboveBar(true);
chart.getDescription().setEnabled(false);
// if more than 60 entries are displayed in the chart, no values will be
// drawn
chart.setMaxVisibleValueCount(60);
// scaling can now only be done on x- and y-axis separately
chart.setPinchZoom(false);
// draw shadows for each bar that show the maximum value
// chart.setDrawBarShadow(true);
chart.setDrawGridBackground(false);
XAxis xl = chart.getXAxis();
xl.setPosition(XAxisPosition.BOTTOM);
xl.setTypeface(tfLight);
xl.setDrawAxisLine(true);
xl.setDrawGridLines(false);
xl.setGranularity(10f);
YAxis yl = chart.getAxisLeft();
yl.setTypeface(tfLight);
yl.setDrawAxisLine(true);
yl.setDrawGridLines(true);
// yl.setInverted(true);
YAxis yr = chart.getAxisRight();
yr.setTypeface(tfLight);
yr.setDrawAxisLine(true);
yr.setDrawGridLines(false);
// yr.setInverted(true);
chart.setFitBars(true);
chart.animateY(2500);
// setting data
seekBarY.setProgress(50);
seekBarX.setProgress(12);
Legend l = chart.getLegend();
l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.LEFT);
l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
l.setDrawInside(false);
l.setFormSize(8f);
l.setXEntrySpace(4f);
}
private void setData(int count, float range) {
float barWidth = 9f;
float spaceForBar = 10f;
ArrayList<BarEntry> values = new ArrayList<>();
for (int i = 0; i < count; i++) {
float val = (float) (Math.random() * range - range / 2);
values.add(new BarEntry(i * spaceForBar, val,
getResources().getDrawable(R.drawable.star)));
}
BarDataSet set1;
if (chart.getData() != null &&
chart.getData().getDataSetCount() > 0) {
set1 = (BarDataSet) chart.getData().getDataSetByIndex(0);
set1.setValues(values);
chart.getData().notifyDataChanged();
chart.notifyDataSetChanged();
} else {
set1 = new BarDataSet(values, "DataSet 1");
set1.setDrawIcons(false);
ArrayList<IBarDataSet> dataSets = new ArrayList<>();
dataSets.add(set1);
BarData data = new BarData(dataSets);
data.setValueTextSize(10f);
data.setValueTypeface(tfLight);
data.setBarWidth(barWidth);
chart.setData(data);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.bar, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.viewGithub: {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/HorizontalBarChartActivity.java"));
startActivity(i);
break;
}
case R.id.actionToggleValues: {
List<IBarDataSet> sets = chart.getData()
.getDataSets();
for (IBarDataSet iSet : sets) {
iSet.setDrawValues(!iSet.isDrawValuesEnabled());
}
chart.invalidate();
break;
}
case R.id.actionToggleIcons: {
List<IBarDataSet> sets = chart.getData()
.getDataSets();
for (IBarDataSet iSet : sets) {
iSet.setDrawIcons(!iSet.isDrawIconsEnabled());
}
chart.invalidate();
break;
}
case R.id.actionToggleHighlight: {
if(chart.getData() != null) {
chart.getData().setHighlightEnabled(!chart.getData().isHighlightEnabled());
chart.invalidate();
}
break;
}
case R.id.actionTogglePinch: {
if (chart.isPinchZoomEnabled())
chart.setPinchZoom(false);
else
chart.setPinchZoom(true);
chart.invalidate();
break;
}
case R.id.actionToggleAutoScaleMinMax: {
chart.setAutoScaleMinMaxEnabled(!chart.isAutoScaleMinMaxEnabled());
chart.notifyDataSetChanged();
break;
}
case R.id.actionToggleBarBorders: {
for (IBarDataSet set : chart.getData().getDataSets())
((BarDataSet)set).setBarBorderWidth(set.getBarBorderWidth() == 1.f ? 0.f : 1.f);
chart.invalidate();
break;
}
case R.id.animateX: {
chart.animateX(2000);
break;
}
case R.id.animateY: {
chart.animateY(2000);
break;
}
case R.id.animateXY: {
chart.animateXY(2000, 2000);
break;
}
case R.id.actionSave: {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
saveToGallery();
} else {
requestStoragePermission(chart);
}
break;
}
}
return true;
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
tvX.setText(String.valueOf(seekBarX.getProgress()));
tvY.setText(String.valueOf(seekBarY.getProgress()));
setData(seekBarX.getProgress(), seekBarY.getProgress());
chart.setFitBars(true);
chart.invalidate();
}
@Override
protected void saveToGallery() {
saveToGallery(chart, "HorizontalBarChartActivity");
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {}
private final RectF mOnValueSelectedRectF = new RectF();
@Override
public void onValueSelected(Entry e, Highlight h) {
if (e == null)
return;
RectF bounds = mOnValueSelectedRectF;
chart.getBarBounds((BarEntry) e, bounds);
MPPointF position = chart.getPosition(e, chart.getData().getDataSetByIndex(h.getDataSetIndex())
.getAxisDependency());
Log.i("bounds", bounds.toString());
Log.i("position", position.toString());
MPPointF.recycleInstance(position);
}
@Override
public void onNothingSelected() {}
}

View file

@ -0,0 +1,283 @@
package com.xxmassdeveloper.mpchartexample;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import androidx.core.content.ContextCompat;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.components.Legend.LegendForm;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
import com.github.mikephil.charting.utils.EntryXComparator;
import com.xxmassdeveloper.mpchartexample.custom.MyMarkerView;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class InvertedLineChartActivity extends DemoBase implements OnSeekBarChangeListener,
OnChartValueSelectedListener {
private LineChart chart;
private SeekBar seekBarX, seekBarY;
private TextView tvX, tvY;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_linechart);
setTitle("InvertedLineChartActivity");
tvX = findViewById(R.id.tvXMax);
tvY = findViewById(R.id.tvYMax);
seekBarX = findViewById(R.id.seekBar1);
seekBarY = findViewById(R.id.seekBar2);
seekBarY.setOnSeekBarChangeListener(this);
seekBarX.setOnSeekBarChangeListener(this);
chart = findViewById(R.id.chart1);
chart.setOnChartValueSelectedListener(this);
chart.setDrawGridBackground(false);
// no description text
chart.getDescription().setEnabled(false);
// enable touch gestures
chart.setTouchEnabled(true);
// enable scaling and dragging
chart.setDragEnabled(true);
chart.setScaleEnabled(true);
// if disabled, scaling can be done on x- and y-axis separately
chart.setPinchZoom(true);
// set an alternative background color
// chart.setBackgroundColor(Color.GRAY);
// create a custom MarkerView (extend MarkerView) and specify the layout
// to use for it
MyMarkerView mv = new MyMarkerView(this, R.layout.custom_marker_view);
mv.setChartView(chart); // For bounds control
chart.setMarker(mv); // Set the marker to the chart
XAxis xl = chart.getXAxis();
xl.setAvoidFirstLastClipping(true);
xl.setAxisMinimum(0f);
YAxis leftAxis = chart.getAxisLeft();
leftAxis.setInverted(true);
leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)
YAxis rightAxis = chart.getAxisRight();
rightAxis.setEnabled(false);
// add data
seekBarX.setProgress(25);
seekBarY.setProgress(50);
// // restrain the maximum scale-out factor
// chart.setScaleMinima(3f, 3f);
//
// // center the view to a specific position inside the chart
// chart.centerViewPort(10, 50);
// get the legend (only possible after setting data)
Legend l = chart.getLegend();
// modify the legend ...
l.setForm(LegendForm.LINE);
// don't forget to refresh the drawing
chart.invalidate();
}
private void setData(int count, float range) {
ArrayList<Entry> entries = new ArrayList<>();
for (int i = 0; i < count; i++) {
float xVal = (float) (Math.random() * range);
float yVal = (float) (Math.random() * range);
entries.add(new Entry(xVal, yVal));
}
// sort by x-value
Collections.sort(entries, new EntryXComparator());
// create a dataset and give it a type
LineDataSet set1 = new LineDataSet(entries, "DataSet 1");
set1.setLineWidth(1.5f);
set1.setCircleRadius(4f);
// create a data object with the data sets
LineData data = new LineData(set1);
// set data
chart.setData(data);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.line, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.viewGithub: {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/InvertedLineChartActivity.java"));
startActivity(i);
break;
}
case R.id.actionToggleValues: {
List<ILineDataSet> sets = chart.getData()
.getDataSets();
for (ILineDataSet iSet : sets) {
LineDataSet set = (LineDataSet) iSet;
set.setDrawValues(!set.isDrawValuesEnabled());
}
chart.invalidate();
break;
}
case R.id.actionToggleHighlight: {
if(chart.getData() != null) {
chart.getData().setHighlightEnabled(!chart.getData().isHighlightEnabled());
chart.invalidate();
}
break;
}
case R.id.actionToggleFilled: {
List<ILineDataSet> sets = chart.getData()
.getDataSets();
for (ILineDataSet iSet : sets) {
LineDataSet set = (LineDataSet) iSet;
if (set.isDrawFilledEnabled())
set.setDrawFilled(false);
else
set.setDrawFilled(true);
}
chart.invalidate();
break;
}
case R.id.actionToggleCircles: {
List<ILineDataSet> sets = chart.getData()
.getDataSets();
for (ILineDataSet iSet : sets) {
LineDataSet set = (LineDataSet) iSet;
if (set.isDrawCirclesEnabled())
set.setDrawCircles(false);
else
set.setDrawCircles(true);
}
chart.invalidate();
break;
}
case R.id.animateX: {
chart.animateX(2000);
break;
}
case R.id.animateY: {
chart.animateY(2000);
break;
}
case R.id.animateXY: {
chart.animateXY(2000, 2000);
break;
}
case R.id.actionTogglePinch: {
if (chart.isPinchZoomEnabled())
chart.setPinchZoom(false);
else
chart.setPinchZoom(true);
chart.invalidate();
break;
}
case R.id.actionToggleAutoScaleMinMax: {
chart.setAutoScaleMinMaxEnabled(!chart.isAutoScaleMinMaxEnabled());
chart.notifyDataSetChanged();
break;
}
case R.id.actionSave: {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
saveToGallery();
} else {
requestStoragePermission(chart);
}
break;
}
}
return true;
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
tvX.setText(String.valueOf(seekBarX.getProgress()));
tvY.setText(String.valueOf(seekBarY.getProgress()));
setData(seekBarX.getProgress(), seekBarY.getProgress());
// redraw
chart.invalidate();
}
@Override
protected void saveToGallery() {
saveToGallery(chart, "InvertedLineChartActivity");
}
@Override
public void onValueSelected(Entry e, Highlight h) {
Log.i("VAL SELECTED",
"Value: " + e.getY() + ", xIndex: " + e.getX()
+ ", DataSet index: " + h.getDataSetIndex());
}
@Override
public void onNothingSelected() {}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {}
}

Some files were not shown because too many files have changed in this diff Show more