mahozad / android-pie-chart Goto Github PK
View Code? Open in Web Editor NEWHighly customizable Android library for drawing Pie and Donut charts.
Home Page: https://mahozad.ir/android-pie-chart
License: Apache License 2.0
Highly customizable Android library for drawing Pie and Donut charts.
Home Page: https://mahozad.ir/android-pie-chart
License: Apache License 2.0
Add every property of the chart to the test app screen as buttons, sliders, etc. so that the chart can be modified to get immediate feedback and to design a desired shape, color, ... for the chart and also to test all combinations of properties of the chart manually if required.
Also, create a java class and test the library in it to see if it works with java as well.
Add a new wedge-shaped gap type to the existing rectangular gap type.
It should support gap placements like the rectangular gap.
Also add the necessary property(ies) for the user to choose their desired gap type.
Use a library to add screenshot tests as acceptance tests to ensure the final appearance of the chart is appropriate.
The two libraries defined below do not support running screenshot tests on Windows 10.
Use them when/if they support Windows 10 (though it might be late to this because most of the library features will have been implemented by that time and writing tests afterwards may not be so useful).
Refer to this issue for shot and this section for screenshot-tests-for-android to see if they have started to support Windows 10 or not.
See this (note how it saves the images and compares them. Also note that it reads screenshots from the assets directory).
Possible libraries:
Another solution:
Can we use "Emulator Snapshots for test failures" available in newer versions of Android Studio?
Include issue number (if any) and commit hashes that a feature, bug, etc. refers to in the end of that changelog entry, like this:
See #26.
Add some default color sets to use as slice colors.
Each color set must be available in two variants: single color for the slice or gradient for the slice.
Can we somehow use themes and styles for this?
We can have some default styles in our library that users can use.
<resource>
<style name="ColorfulStyle">
<item name="gap">4dp</item>
...
</style>
</resource>
<ir.mahoza.android.piechart
style="@style/ColorfulStyle"
... />
Possible options could be:
See the following good examples:
TensorFlow brand guidelines and brand assets
logo for the library itself
logo and icons for the showcase (test) app
Update the IntelliJ project icon and add it to VCS
Update the social preview image on repository GitHub settings
Can place the logo and branding assets in a directory in repository named extras or artwork or branding or visual style or brand guideline
Currently the slice accepts a fraction number between 0 and 1. The sum of the all slice fractions should be <= 1 (it could be less than one; in that case the remaining fraction of the chart is shown empty. See this issue).
Add a new mode to interpret slice values as quantity so the fraction of each slice is calculated by the chart itself.
Also see #32.
Add images of the chart, add wiki, add how-tos and so on.
Add a table specifying the available chart properties and their default values.
Add a section about how to do certain things with the chart:
Use
LabelType::NONE
Use
LegendType::NONE
It is possible to upload videos on GitHub. Create a showcase video of the library and embed it in the README.
Add a Persian version of the documentation (or readme)?
In addition to a direct method for updating a property (like chart.setColor(color: Int)), provide a resource version of the method that takes a resource and resolves the value automatically (like chart.setColor(R.color.myColor)) for each property.
This is something practiced in Android Material components. See this for an example.
Also, add separate properties to modify a dimension in sp or dp.
For example, legendSize
, legendSizeSp
.
Add a property to chart to sort the slices based on their value in asc or desc order.
Should also be able to disable the sorting.
https://github.com/github/renaming
Add property to make slices react when touched or clicked.
Can also implement a new label type called something like touchable label type which shows the label of each slice when touched.
The javadoc.jar artifact has no javadoc in it. For example, this javadoc for version 0.4.0 of the library.
See this post and this post and this page and also dokka homepage for setting up kdoc in Android.
If the docs cannot be generated offline, add this block of code to the build script:
val dokka by tasks.getting(org.jetbrains.dokka.gradle.DokkaTask::class)
dokka.configure<org.jetbrains.dokka.gradle.DokkaTask> {
dokkaSourceSets {
named("main") {
noAndroidSdkLink.set(false)
}
}
}
See this and this and Kotlin/dokka#1706 for more information about the noAndroidSdkLink
property.
When/If slice values do not sum to 1, show a background for the empty remaining fraction.
A light gray may be a good default color for this background.
Implement legends for the chart.
At the very least these legends should be supported:
The labels will be like normal inside labels (totally horizontal), except that they are placed in the hole of the chart.
Add a property to Slice class to be able to scale a slice to a value less than default (1).
Lower scale means the radius of the slice will be smaller.
Configure CI/CD for the library either with GitHub or with Travis CI (other tutorial 1, other tutorial 2).
ciManagement
in publishing block of the build scriptLike in legends and so on.
Add ability to specify a label/icon in the center of the chart.
The chart hole is not modified and may overlap with the center label/icon (because the user may want that behavior).
It is up to the user to make sure the hole is big enough to accommodate the center label/icon, if he wants no overlap.
Relates to #7.
Add a property to chart so if user enables it, if the slice value in in FRACTION mode and sum of all slice values is < 1, then the chart automatically adds the last slice.
Also, add a property to specify the properties of the last slice (like its label, color, etc).
This makes the tests a lot easier and faster to run.
We can use Robolectric (at the time of writing this, it does not support JUnit 5).
If you want to run Robolectric tests with Junit 4 (using @RunWith
and @org.junit.Test
etc), remember to include testImplementation("org.junit.vintage:junit-vintage-engine:5.7.2")
dependency in the build script.
Remeber to delete the excludeEngines("junit-vintage")
from the following block of code in piechart build script so we can run JUnit 4 tests as well with the vintage engine (why was it excluded in the first place?):
useJUnitPlatform {
excludeEngines("junit-vintage")
}
See this and this for an example.
Add kdoc documentation for all public methods, properties, classes, etc.
Leverage the Kdoc sample identifier to provide a code sample for each property (see this article).
Also see Donim project.
In addition to WRAP and CLIP modes.
Could scroll or tap a button to see rest of the legends.
A property for the chart that removes all the labels from the chart without having to set the label to an empty string for each slice.
Add ability to apply a color gradient to texts (for example, chart labels).
See this post.
The labels can be placed on any sides of the chart.
The releases on GitHub packages have no description (except version 0.1.0).
In addition to #4, generate documentations, examples, etc. on a website using GitHub Pages.
The initial version of the website has been created in the website branch of the repository.
Rename the github-pages branch to website (remember to update the repository pages settings as well if the branch name was changed).
Remember to regularly rebase the site git branch onto the main branch to keep it updated
Add a link to the library javadoc in site: https://www.javadoc.io/doc/ir.mahozad.android/pie-chart/latest/index.html
Add website link and icon in https://mahozad.ir
Add project changelog to the site (could automate it with workflows?)
Customize the scrollbar indicator of the website
Add dark/light switch toggle (can use my own component): see this YouTube video and this post
Specify size for the images and use placeholders like this for images. See this YouTube video
To show colored code in the site, create a gist in GitHub for that snippet of code and use its embed link in the site (customizing the gist).
We can also use online syntax highlighters such as this or this.
Testing the website performance: https://developers.google.com/speed/pagespeed/insights/
Add a header to site and add the following CSS property to it which results in something like header of this site (See this Stack Overflow post):
header {
backdrop-filter: blur(4px);
}
Remember that dokka can produce a jekyll format as well.
Static site generators:
Websites and templates to inspire from:
https://google.github.io/accompanist/insets/
https://developer.chrome.com/tags/devtools-engineering/
https://www.kernel.org/
https://probot.github.io/docs/
https://docs.botui.org/
https://cssgradient.io/
https://fossheim.io/writing/posts/css-text-gradient/
https://doks.netlify.app/docs/prologue/commands/
https://geekdocs.de/
https://themes.gohugo.io/themes/hugo-changelog-theme/
https://github.com/pmarsceill/just-the-docs
https://github.com/collections/github-pages-examples
https://sighingnow.github.io/jekyll-gitbook
https://supunkavinda.github.io/jekyll-theme-leaf/
https://pmarsceill.github.io/just-the-docs/docs/configuration/
http://alexander.heimbu.ch/millidocs/
https://orderedlist.com/minimal/
https://docs.docker.com/
https://www.vectary.com/
https://github.com/wikimedia/wikimedia.github.io
https://kit.svelte.dev/
candidate page background color: #faf7f4 (adopted from this site)
Add ability to specify a secondary (second line) label (along with the main label) for each slice.
Should also be able to specify the margin between the two labels.
The two labels will be horizontally centered with respect to each other.
Also related to #32.
Possible places:
Add some default animations to choose from.
For implementing animations, instead of reflowing all the subcomponents, we can simply use canvas::transform on the container or other similar functionalities of the canvas.
Instead of embeding the animation code into every component, we can create an animator class for each type of component and compose it with that component so it can manipulate that component properties. This way we obey single responsibility principle; component does not have to care about implementing the animations; it just cares about drawing itself.
This can be done with Decorator pattern, meaning the animator class has the same type as the component it animates.
https://youtu.be/N_x7SV3I3P0
https://youtu.be/ZTJkLtQXEfY
https://youtu.be/Ldz42dbUsQ0
https://proandroiddev.com/android-bring-life-to-your-custom-view-8604ab3967b3
https://medium.com/androiddevelopers/custom-canvas-animations-in-jetpack-compose-e7767e349339
https://www.raywenderlich.com/2785491-android-animation-tutorial-with-kotlin
When a proper logo is created for the project, contact https://mvnrepository.com/ and request the icon of the project on the site be updated.
For more information about project icon in mvnrepository see this post and this post.
Add a property to chart to show slices in logarithmic scale.
Also, add a property for the user to be able to specify the base of the logarithm.
After switching the test application and then resuming it, the first slice turn into pale green.
Add ability to specify a subtle shadow for the whole chart.
This could be enabled by adding a property to the chart or maybe by implementing another flavor of the chart like a debug flavor.
See page 282 of the book *Grokking Simplicity *
We can use the Decorator pattern to implement this feature, meaning creating a debug version of a component that composes with that component and has the same type as that component and adds some additional feature to that component (here the debug feature).
For example, to implement a logger version of a component, we can subclass from that component and implement the same methods with logging. See Clean code, Episode 9, 36:00 for an example.
Can we add another Gradle module that implements the library for Jetpack Compose?
The compose version can be used in the compose for desktop which in turn can be shipped to Web, Windows, Linux, MacOs (Compose for Web currently does not allow you to directly reuse existing widgets (unlike the Android and Desktop targets for Jetpack Compose, which allow direct code sharing for most widgets out of the box)).
For an example, see sample number 6 in this page.
See the following Stack Overflow post: How to migrate my custom view to Jetpack Compose?.
Implementation:
Videos:
Can we convert the library to Kotlin multiplatform so it can be used on other platforms like Web and IOS?
Make advanced properties available for the user to customize like anti-aliasing, dether, etc.
The labels will be placed only on the sides of the chart.
Provide beautiful colors, gradients, slice sizes, label type, margin, etc. to make the chart preview more elegant.
Add ability to specify a custom color or background for the center of the chart with a desired radius.
In unit tests that compare floating point numbers, update the assertions to compare with 0.01 precision instead of current 1.
This is because current comparisons may give false negative results, that is, pass when they should have failed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.