{"action":"closed","issue":{"url":"https://api.github.com/repos/lecho/hellocharts-android/issues/137","labels_url":"https://api.github.com/repos/lecho/hellocharts-android/issues/137/labels{/name}","comments_url":"https://api.github.com/repos/lecho/hellocharts-android/issues/137/comments","events_url":"https://api.github.com/repos/lecho/hellocharts-android/issues/137/events","html_url":"https://github.com/lecho/hellocharts-android/issues/137","id":78851624,"number":137,"title":"Is way to fill area by gradient color?","user":{"login":"susemi99","id":1233318,"avatar_url":"https://avatars.githubusercontent.com/u/1233318?v=3","gravatar_id":"","url":"https://api.github.com/users/susemi99","html_url":"https://github.com/susemi99","followers_url":"https://api.github.com/users/susemi99/followers","following_url":"https://api.github.com/users/susemi99/following{/other_user}","gists_url":"https://api.github.com/users/susemi99/gists{/gist_id}","starred_url":"https://api.github.com/users/susemi99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/susemi99/subscriptions","organizations_url":"https://api.github.com/users/susemi99/orgs","repos_url":"https://api.github.com/users/susemi99/repos","events_url":"https://api.github.com/users/susemi99/events{/privacy}","received_events_url":"https://api.github.com/users/susemi99/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/lecho/hellocharts-android/labels/wontfix","name":"wontfix","color":"ffffff"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-21T06:18:56Z","updated_at":"2015-06-01T19:56:38Z","closed_at":"2015-06-01T19:56:38Z","body":"I want line graph with fill area by gradient color like this\r\n![gradient](https://cloud.githubusercontent.com/assets/1233318/7742492/e512287a-ffca-11e4-8813-d316bc69630b.png)\r\n\r\n\r\n\r\nedited code\r\n<pre>\r\n// Line.java\r\nprivate int fillColor = ChartUtils.DEFAULT_COLOR;\r\n.\r\n.\r\n.\r\npublic int getFillColor() {\r\n  return fillColor;\r\n}\r\n\r\npublic Line setFillColor(int color){\r\n  this.fillColor = color;\r\n  return this;\r\n}\r\n</pre>\r\n\r\n<pre>\r\n// LineChartRenderer.java\r\nprivate void drawArea(Canvas canvas, Line line) {\r\n  linePaint.setStyle(Paint.Style.FILL);\r\n  linePaint.setColor(line.getFillColor()); // added\r\n  linePaint.setAlpha(line.getAreaTransparency());\r\n  canvas.drawPath(path, linePaint);\r\n  linePaint.setStyle(Paint.Style.STROKE);\r\n}\r\n</pre>\r\n\r\n<pre>\r\n// sample/drawable/gradient.xml\r\n&lt;shape xmlns:android=\"http://schemas.android.com/apk/res/android\">\r\n    &lt;gradient\r\n        android:angle=\"90\"\r\n        android:endColor=\"#ff0000\"\r\n        android:startColor=\"#00ffff00\"/>\r\n&lt;/shape>\r\n</pre>\r\n\r\n<pre>\r\n// sample/LineChartActivity.java\r\nprivate void generateData() {\r\n.\r\n.\r\n  line.setFillColor(getResources().getColor(R.drawable.gradient));\r\n.\r\n.\r\n}\r\n</pre>\r\n\r\n<pre>\r\n// error result\r\nandroid.content.res.Resources$NotFoundException: File res/drawable/gradation.xml from color state list resource ID #0x7f020037\r\n  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2372)\r\n  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2434)\r\n  at android.app.ActivityThread.access$800(ActivityThread.java:162)\r\n  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349)\r\n  at android.os.Handler.dispatchMessage(Handler.java:102)\r\n  at android.os.Looper.loop(Looper.java:135)\r\n  at android.app.ActivityThread.main(ActivityThread.java:5424)\r\n  at java.lang.reflect.Method.invoke(Native Method)\r\n  at java.lang.reflect.Method.invoke(Method.java:372)\r\n  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:913)\r\n  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:706)\r\nCaused by: android.content.res.Resources$NotFoundException: File res/drawable/gradation.xml from color state list resource ID #0x7f020037\r\n  at android.content.res.Resources.loadColorStateList(Resources.java:2644)\r\n  at android.content.res.Resources.getColor(Resources.java:968)\r\n  at lecho.lib.hellocharts.samples.LineChartActivity$PlaceholderFragment.generateData(LineChartActivity.java:231)\r\n  at lecho.lib.hellocharts.samples.LineChartActivity$PlaceholderFragment.onCreateView(LineChartActivity.java:79)\r\nCaused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #2: invalid drawable tag shape\r\n  at android.content.res.ColorStateList.createFromXmlInner(ColorStateList.java:148)\r\n  at android.content.res.ColorStateList.createFromXml(ColorStateList.java:131)\r\n  at android.content.res.Resources.loadColorStateList(Resources.java:2640)\r\n  at android.content.res.Resources.getColor(Resources.java:968)\r\n  at lecho.lib.hellocharts.samples.LineChartActivity$PlaceholderFragment.generateData(LineChartActivity.java:231)\r\n  at lecho.lib.hellocharts.samples.LineChartActivity$PlaceholderFragment.onCreateView(LineChartActivity.java:79)\r\n</pre>"}}