├── .editorconfig ├── .github └── workflows │ └── android.yml ├── .gitignore ├── Makefile ├── README.md ├── _config.yml ├── art ├── demo_screenshot.png ├── phone.png └── watch.png ├── build.gradle ├── default-detekt-config.yml ├── detekt.gradle ├── docs ├── README.md └── _config.yml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── jacoco.gradle ├── ktlint.gradle ├── mobile ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── db │ │ └── williamchartdemo │ │ ├── DemoFragment.kt │ │ └── MainActivity.kt │ └── res │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ ├── ic_barchart.xml │ ├── ic_launcher_background.xml │ ├── ic_linechart.xml │ ├── layout_background.xml │ └── rounded_card_background.xml │ ├── font │ ├── istok_web_bold.xml │ ├── open_sans_bold.ttf │ ├── opensans_regular.ttf │ └── supermercado_one.xml │ ├── layout │ ├── activity_main.xml │ └── demo_fragment.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ ├── ic_launcher_foreground.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ ├── ic_launcher_foreground.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ ├── ic_launcher_foreground.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ ├── ic_launcher_foreground.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ ├── ic_launcher_foreground.png │ └── ic_launcher_round.png │ └── values │ ├── colors.xml │ ├── font_certs.xml │ ├── ic_launcher_background.xml │ ├── preloaded_fonts.xml │ ├── strings.xml │ └── styles.xml ├── pointstooltip ├── .gitignore ├── build.gradle ├── publish.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── db │ │ └── williamchart │ │ └── pointtooltip │ │ └── PointTooltip.kt │ └── res │ ├── drawable │ └── circle_point.xml │ └── layout │ └── point_tooltip_layout.xml ├── settings.gradle ├── slidertooltip ├── .gitignore ├── build.gradle ├── publish.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── db │ │ └── williamchart │ │ └── slidertooltip │ │ └── SliderTooltip.kt │ └── res │ └── layout │ └── tooltip_layout.xml └── williamchart ├── .gitignore ├── build.gradle ├── proguard-rules.pro ├── publish.gradle └── src ├── main ├── AndroidManifest.xml ├── java │ └── com │ │ └── db │ │ └── williamchart │ │ ├── ChartContract.kt │ │ ├── ExperimentalFeature.kt │ │ ├── Grid.kt │ │ ├── Labels.kt │ │ ├── Painter.kt │ │ ├── Tooltip.kt │ │ ├── animation │ │ ├── ChartAnimation.kt │ │ ├── DefaultAnimation.kt │ │ ├── DefaultDonutAnimation.kt │ │ ├── DefaultHorizontalAnimation.kt │ │ ├── DonutNoAnimation.kt │ │ └── NoAnimation.kt │ │ ├── data │ │ ├── AxisType.kt │ │ ├── DataPoint.kt │ │ ├── DonutDataPoint.kt │ │ ├── Frame.kt │ │ ├── Label.kt │ │ ├── Paddings.kt │ │ ├── Scale.kt │ │ └── configuration │ │ │ ├── BarChartConfiguration.kt │ │ │ ├── ChartConfiguration.kt │ │ │ ├── DonutChartConfiguration.kt │ │ │ └── LineChartConfiguration.kt │ │ ├── extensions │ │ ├── CanvasExt.kt │ │ ├── DrawableExt.kt │ │ ├── FloatExt.kt │ │ ├── FrameLayoutExt.kt │ │ ├── IntExt.kt │ │ ├── IterableExt.kt │ │ ├── ListExt.kt │ │ └── ViewExt.kt │ │ ├── plugin │ │ ├── AxisGrid.kt │ │ └── AxisLabels.kt │ │ ├── renderer │ │ ├── BarChartRenderer.kt │ │ ├── DonutChartRenderer.kt │ │ ├── HorizontalBarChartRenderer.kt │ │ ├── LineChartRenderer.kt │ │ ├── RendererConstants.kt │ │ └── executor │ │ │ ├── DebugWithLabelsFrame.kt │ │ │ ├── DefineDataPointsClickableFrames.kt │ │ │ ├── DefineHorizontalBarsClickableFrames.kt │ │ │ ├── DefineVerticalBarsClickableFrames.kt │ │ │ ├── DefineVerticalTouchableFrames.kt │ │ │ ├── GetHorizontalBarBackgroundFrames.kt │ │ │ ├── GetHorizontalBarFrames.kt │ │ │ ├── GetVerticalBarBackgroundFrames.kt │ │ │ ├── GetVerticalBarFrames.kt │ │ │ ├── MeasureBarChartPaddings.kt │ │ │ ├── MeasureHorizontalBarChartPaddings.kt │ │ │ └── MeasureLineChartPaddings.kt │ │ └── view │ │ ├── AxisChartView.kt │ │ ├── BarChartView.kt │ │ ├── DonutChartView.kt │ │ ├── HorizontalBarChartView.kt │ │ └── LineChartView.kt └── res │ └── values │ ├── attrs.xml │ └── strings.xml └── test ├── java └── com │ └── db │ └── williamchart │ └── renderer │ ├── DonutChartRendererTest.kt │ ├── LineChartRendererTest.kt │ └── executor │ ├── DefineDataPointsClickableFramesTest.kt │ ├── MeasureBarChartPaddingsTest.kt │ ├── MeasureHorizontalBarChartPaddingsTest.kt │ └── MeasureLineChartPaddingsTest.kt └── resources └── mockito-extensions └── org.mockito.plugins.MockMaker /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.{kt,kts}] 2 | disabled_rules=import-ordering -------------------------------------------------------------------------------- /.github/workflows/android.yml: -------------------------------------------------------------------------------- 1 | name: Android CI 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - dev 7 | 8 | jobs: 9 | build: 10 | 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v1 15 | - name: set up JDK 1.8 16 | uses: actions/setup-java@v1 17 | with: 18 | java-version: 1.8 19 | - name: Build with Gradle 20 | run: ./gradlew build 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows thumbnail db 2 | Thumbs.db 3 | 4 | # OSX files 5 | .DS_Store 6 | 7 | # built application files 8 | *.apk 9 | *.ap_ 10 | 11 | # files for the dex VM 12 | *.dex 13 | 14 | # Java class files 15 | *.class 16 | 17 | # generated files 18 | bin/ 19 | gen/ 20 | build/ 21 | 22 | # Local configuration file (sdk path, etc) 23 | local.properties 24 | 25 | # Eclipse project files 26 | .classpath 27 | .project 28 | 29 | # Android Studio 30 | .idea 31 | .gradle 32 | /*/local.properties 33 | /*/out 34 | /*/*/build 35 | build 36 | /*/*/production 37 | *.iml 38 | *.iws 39 | *.ipr 40 | *~ 41 | *.swp 42 | 43 | /kick -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | release-bintray: # Make sure to update the release version before releasing 2 | ./gradlew clean build bintrayUpload 3 | 4 | release-play: # Make sure to update the release version before releasing 5 | ./gradlew publishReleaseApk 6 | 7 | check: 8 | ./gradlew lint 9 | ./gradlew detekt 10 | 11 | test: 12 | ./gradlew test 13 | 14 | stop: 15 | ./gradlew --stop 16 | 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # williamchart ![phone][2]![watch][3] 2 | 3 | [![Kotlin Version](https://img.shields.io/badge/kotlin-1.4.10-blue.svg)](https://kotlinlang.org) 4 | [![API](https://img.shields.io/badge/API-16%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=16) 5 | [![CodeFactor](https://www.codefactor.io/repository/github/diogobernardino/williamchart/badge)](https://www.codefactor.io/repository/github/diogobernardino/williamchart) 6 | 7 | Williamchart is an Android Library to rapidly implement attractive and insightful charts in android applications. 8 | 9 | Note: WilliamChart v3 has been completely re-written from scratch in Kotlin and does not guarantee any API/features compatibility with previous versions. Android development has been evolving quickly, and much has changed since I first started developing williamchart (e.g patterns, testing, tools), so I decided it was time to rewrite it with all these new tools in mind. I intend to keep it as light and modular as possible. 10 | 11 | ![screenshot][4] 12 | 13 | ### Gradle 14 | 15 | ``` groovy 16 | // Charts 17 | implementation 'com.diogobernardino:williamchart:3.10.1' 18 | 19 | // Tooltips 20 | implementation 'com.diogobernardino.williamchart:tooltip-slider:3.10.1' 21 | implementation 'com.diogobernardino.williamchart:tooltip-points:3.10.1' 22 | ``` 23 | 24 | If you find this library useful and decide to use it in your projects please drop me a line [@dfbernardino][1], I will be happy to know about it. 25 | 26 | ### Usage 27 | 28 | #### All charts 29 | 30 | ```xml 31 | 37 | ``` 38 | 39 | #### Line Chart 40 | 41 | ```xml 42 | 49 | ``` 50 | 51 | #### Bar Chart 52 | 53 | ```xml 54 | 61 | ``` 62 | 63 | #### Donut Chart 64 | 65 | ```xml 66 | 73 | ``` 74 | 75 | 76 | License 77 | ------- 78 | 79 | Copyright 2019 Diogo Bernardino 80 | 81 | Licensed under the Apache License, Version 2.0 (the "License"); 82 | you may not use this file except in compliance with the License. 83 | You may obtain a copy of the License at 84 | 85 | http://www.apache.org/licenses/LICENSE-2.0 86 | 87 | Unless required by applicable law or agreed to in writing, software 88 | distributed under the License is distributed on an "AS IS" BASIS, 89 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 90 | See the License for the specific language governing permissions and 91 | limitations under the License. 92 | 93 | [1]: https://twitter.com/dfbernardino 94 | [2]: ./art/phone.png 95 | [3]: ./art/watch.png 96 | [4]: ./art/demo_screenshot.png -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-minimal -------------------------------------------------------------------------------- /art/demo_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diogobernardino/williamchart/f0defc0ad2d509aaf32fcbb40fe353470cca35c8/art/demo_screenshot.png -------------------------------------------------------------------------------- /art/phone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diogobernardino/williamchart/f0defc0ad2d509aaf32fcbb40fe353470cca35c8/art/phone.png -------------------------------------------------------------------------------- /art/watch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diogobernardino/williamchart/f0defc0ad2d509aaf32fcbb40fe353470cca35c8/art/watch.png -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | 3 | ext { 4 | williamchartVersion = "3.10.1" 5 | targetSdkVersion = 30 6 | minSdkVersion = 16 7 | kotlinVersion = "1.4.10" 8 | } 9 | 10 | repositories { 11 | google() 12 | jcenter() 13 | } 14 | 15 | dependencies { 16 | classpath 'com.android.tools.build:gradle:4.1.1' 17 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10" 18 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' 19 | classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' 20 | } 21 | } 22 | 23 | plugins { 24 | id "io.gitlab.arturbosch.detekt" version "1.0.0" 25 | id "com.vanniktech.android.junit.jacoco" version "0.15.0" 26 | } 27 | 28 | allprojects { 29 | repositories { 30 | google() 31 | jcenter() 32 | } 33 | apply from: "$rootDir/ktlint.gradle" 34 | apply from: "$rootDir/detekt.gradle" 35 | apply from: "$rootDir/jacoco.gradle" 36 | } 37 | 38 | task clean(type: Delete) { 39 | delete rootProject.buildDir 40 | } 41 | -------------------------------------------------------------------------------- /default-detekt-config.yml: -------------------------------------------------------------------------------- 1 | build: 2 | maxIssues: 10 3 | weights: 4 | # complexity: 2 5 | # LongParameterList: 1 6 | # style: 1 7 | # comments: 1 8 | 9 | processors: 10 | active: true 11 | exclude: 12 | # - 'DetektProgressListener' 13 | # - 'FunctionCountProcessor' 14 | # - 'PropertyCountProcessor' 15 | # - 'ClassCountProcessor' 16 | # - 'PackageCountProcessor' 17 | # - 'KtFileCountProcessor' 18 | 19 | console-reports: 20 | active: true 21 | exclude: 22 | # - 'ProjectStatisticsReport' 23 | # - 'ComplexityReport' 24 | # - 'NotificationReport' 25 | # - 'FindingsReport' 26 | # - 'BuildFailureReport' 27 | 28 | comments: 29 | active: true 30 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" 31 | CommentOverPrivateFunction: 32 | active: false 33 | CommentOverPrivateProperty: 34 | active: false 35 | EndOfSentenceFormat: 36 | active: false 37 | endOfSentenceFormat: ([.?!][ \t\n\r\f<])|([.?!:]$) 38 | UndocumentedPublicClass: 39 | active: false 40 | searchInNestedClass: true 41 | searchInInnerClass: true 42 | searchInInnerObject: true 43 | searchInInnerInterface: true 44 | UndocumentedPublicFunction: 45 | active: false 46 | 47 | complexity: 48 | active: true 49 | ComplexCondition: 50 | active: true 51 | threshold: 4 52 | ComplexInterface: 53 | active: false 54 | threshold: 10 55 | includeStaticDeclarations: false 56 | ComplexMethod: 57 | active: true 58 | threshold: 10 59 | ignoreSingleWhenExpression: false 60 | ignoreSimpleWhenEntries: false 61 | LabeledExpression: 62 | active: false 63 | ignoredLabels: "" 64 | LargeClass: 65 | active: true 66 | threshold: 600 67 | LongMethod: 68 | active: true 69 | threshold: 60 70 | LongParameterList: 71 | active: true 72 | threshold: 6 73 | ignoreDefaultParameters: false 74 | MethodOverloading: 75 | active: false 76 | threshold: 6 77 | NestedBlockDepth: 78 | active: true 79 | threshold: 4 80 | StringLiteralDuplication: 81 | active: false 82 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" 83 | threshold: 3 84 | ignoreAnnotation: true 85 | excludeStringsWithLessThan5Characters: true 86 | ignoreStringsRegex: '$^' 87 | TooManyFunctions: 88 | active: true 89 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" 90 | thresholdInFiles: 11 91 | thresholdInClasses: 11 92 | thresholdInInterfaces: 11 93 | thresholdInObjects: 11 94 | thresholdInEnums: 11 95 | ignoreDeprecated: false 96 | ignorePrivate: false 97 | ignoreOverridden: false 98 | 99 | empty-blocks: 100 | active: true 101 | EmptyCatchBlock: 102 | active: true 103 | allowedExceptionNameRegex: "^(_|(ignore|expected).*)" 104 | EmptyClassBlock: 105 | active: true 106 | EmptyDefaultConstructor: 107 | active: true 108 | EmptyDoWhileBlock: 109 | active: true 110 | EmptyElseBlock: 111 | active: true 112 | EmptyFinallyBlock: 113 | active: true 114 | EmptyForBlock: 115 | active: true 116 | EmptyFunctionBlock: 117 | active: false 118 | ignoreOverriddenFunctions: false 119 | EmptyIfBlock: 120 | active: true 121 | EmptyInitBlock: 122 | active: true 123 | EmptyKtFile: 124 | active: true 125 | EmptySecondaryConstructor: 126 | active: true 127 | EmptyWhenBlock: 128 | active: true 129 | EmptyWhileBlock: 130 | active: true 131 | 132 | exceptions: 133 | active: true 134 | ExceptionRaisedInUnexpectedLocation: 135 | active: false 136 | methodNames: 'toString,hashCode,equals,finalize' 137 | InstanceOfCheckForException: 138 | active: false 139 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" 140 | NotImplementedDeclaration: 141 | active: false 142 | PrintStackTrace: 143 | active: false 144 | RethrowCaughtException: 145 | active: false 146 | ReturnFromFinally: 147 | active: false 148 | SwallowedException: 149 | active: false 150 | ignoredExceptionTypes: 'InterruptedException,NumberFormatException,ParseException,MalformedURLException' 151 | allowedExceptionNameRegex: "^(_|(ignore|expected).*)" 152 | ThrowingExceptionFromFinally: 153 | active: false 154 | ThrowingExceptionInMain: 155 | active: false 156 | ThrowingExceptionsWithoutMessageOrCause: 157 | active: false 158 | exceptions: 'IllegalArgumentException,IllegalStateException,IOException' 159 | ThrowingNewInstanceOfSameException: 160 | active: false 161 | TooGenericExceptionCaught: 162 | active: true 163 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" 164 | exceptionNames: 165 | - ArrayIndexOutOfBoundsException 166 | - Error 167 | - Exception 168 | - IllegalMonitorStateException 169 | - NullPointerException 170 | - IndexOutOfBoundsException 171 | - RuntimeException 172 | - Throwable 173 | allowedExceptionNameRegex: "^(_|(ignore|expected).*)" 174 | TooGenericExceptionThrown: 175 | active: true 176 | exceptionNames: 177 | - Error 178 | - Exception 179 | - Throwable 180 | - RuntimeException 181 | 182 | formatting: 183 | active: true 184 | android: false 185 | autoCorrect: true 186 | AnnotationOnSeparateLine: 187 | active: false 188 | autoCorrect: true 189 | ChainWrapping: 190 | active: true 191 | autoCorrect: true 192 | CommentSpacing: 193 | active: true 194 | autoCorrect: true 195 | Filename: 196 | active: true 197 | FinalNewline: 198 | active: true 199 | autoCorrect: true 200 | ImportOrdering: 201 | active: false 202 | autoCorrect: true 203 | Indentation: 204 | active: false 205 | autoCorrect: true 206 | indentSize: 4 207 | continuationIndentSize: 4 208 | MaximumLineLength: 209 | active: true 210 | maxLineLength: 120 211 | ModifierOrdering: 212 | active: true 213 | autoCorrect: true 214 | MultiLineIfElse: 215 | active: true 216 | autoCorrect: true 217 | NoBlankLineBeforeRbrace: 218 | active: true 219 | autoCorrect: true 220 | NoConsecutiveBlankLines: 221 | active: true 222 | autoCorrect: true 223 | NoEmptyClassBody: 224 | active: true 225 | autoCorrect: true 226 | NoLineBreakAfterElse: 227 | active: true 228 | autoCorrect: true 229 | NoLineBreakBeforeAssignment: 230 | active: true 231 | autoCorrect: true 232 | NoMultipleSpaces: 233 | active: true 234 | autoCorrect: true 235 | NoSemicolons: 236 | active: true 237 | autoCorrect: true 238 | NoTrailingSpaces: 239 | active: true 240 | autoCorrect: true 241 | NoUnitReturn: 242 | active: true 243 | autoCorrect: true 244 | NoUnusedImports: 245 | active: true 246 | autoCorrect: true 247 | NoWildcardImports: 248 | active: true 249 | PackageName: 250 | active: true 251 | autoCorrect: true 252 | ParameterListWrapping: 253 | active: true 254 | autoCorrect: true 255 | indentSize: 4 256 | SpacingAroundColon: 257 | active: true 258 | autoCorrect: true 259 | SpacingAroundComma: 260 | active: true 261 | autoCorrect: true 262 | SpacingAroundCurly: 263 | active: true 264 | autoCorrect: true 265 | SpacingAroundDot: 266 | active: true 267 | autoCorrect: true 268 | SpacingAroundKeyword: 269 | active: true 270 | autoCorrect: true 271 | SpacingAroundOperators: 272 | active: true 273 | autoCorrect: true 274 | SpacingAroundParens: 275 | active: true 276 | autoCorrect: true 277 | SpacingAroundRangeOperator: 278 | active: true 279 | autoCorrect: true 280 | StringTemplate: 281 | active: true 282 | autoCorrect: true 283 | 284 | naming: 285 | active: true 286 | ClassNaming: 287 | active: true 288 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" 289 | classPattern: '[A-Z$][a-zA-Z0-9$]*' 290 | ConstructorParameterNaming: 291 | active: true 292 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" 293 | parameterPattern: '[a-z][A-Za-z0-9]*' 294 | privateParameterPattern: '[a-z][A-Za-z0-9]*' 295 | excludeClassPattern: '$^' 296 | EnumNaming: 297 | active: true 298 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" 299 | enumEntryPattern: '^[A-Z][_a-zA-Z0-9]*' 300 | ForbiddenClassName: 301 | active: false 302 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" 303 | forbiddenName: '' 304 | FunctionMaxLength: 305 | active: false 306 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" 307 | maximumFunctionNameLength: 30 308 | FunctionMinLength: 309 | active: false 310 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" 311 | minimumFunctionNameLength: 3 312 | FunctionNaming: 313 | active: true 314 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" 315 | functionPattern: '^([a-z$][a-zA-Z$0-9]*)|(`.*`)$' 316 | excludeClassPattern: '$^' 317 | ignoreOverridden: true 318 | FunctionParameterNaming: 319 | active: true 320 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" 321 | parameterPattern: '[a-z][A-Za-z0-9]*' 322 | excludeClassPattern: '$^' 323 | ignoreOverriddenFunctions: true 324 | InvalidPackageDeclaration: 325 | active: false 326 | rootPackage: '' 327 | MatchingDeclarationName: 328 | active: true 329 | MemberNameEqualsClassName: 330 | active: false 331 | ignoreOverriddenFunction: true 332 | ObjectPropertyNaming: 333 | active: true 334 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" 335 | constantPattern: '[A-Za-z][_A-Za-z0-9]*' 336 | propertyPattern: '[A-Za-z][_A-Za-z0-9]*' 337 | privatePropertyPattern: '(_)?[A-Za-z][_A-Za-z0-9]*' 338 | PackageNaming: 339 | active: true 340 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" 341 | packagePattern: '^[a-z]+(\.[a-z][A-Za-z0-9]*)*$' 342 | TopLevelPropertyNaming: 343 | active: true 344 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" 345 | constantPattern: '[A-Z][_A-Z0-9]*' 346 | propertyPattern: '[A-Za-z][_A-Za-z0-9]*' 347 | privatePropertyPattern: '_?[A-Za-z][_A-Za-z0-9]*' 348 | VariableMaxLength: 349 | active: false 350 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" 351 | maximumVariableNameLength: 64 352 | VariableMinLength: 353 | active: false 354 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" 355 | minimumVariableNameLength: 1 356 | VariableNaming: 357 | active: true 358 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" 359 | variablePattern: '[a-z][A-Za-z0-9]*' 360 | privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*' 361 | excludeClassPattern: '$^' 362 | ignoreOverridden: true 363 | 364 | performance: 365 | active: true 366 | ArrayPrimitive: 367 | active: false 368 | ForEachOnRange: 369 | active: true 370 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" 371 | SpreadOperator: 372 | active: true 373 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" 374 | UnnecessaryTemporaryInstantiation: 375 | active: true 376 | 377 | potential-bugs: 378 | active: true 379 | DuplicateCaseInWhenExpression: 380 | active: true 381 | EqualsAlwaysReturnsTrueOrFalse: 382 | active: false 383 | EqualsWithHashCodeExist: 384 | active: true 385 | ExplicitGarbageCollectionCall: 386 | active: true 387 | InvalidRange: 388 | active: false 389 | IteratorHasNextCallsNextMethod: 390 | active: false 391 | IteratorNotThrowingNoSuchElementException: 392 | active: false 393 | LateinitUsage: 394 | active: false 395 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" 396 | excludeAnnotatedProperties: "" 397 | ignoreOnClassesPattern: "" 398 | MissingWhenCase: 399 | active: false 400 | RedundantElseInWhen: 401 | active: false 402 | UnconditionalJumpStatementInLoop: 403 | active: false 404 | UnreachableCode: 405 | active: true 406 | UnsafeCallOnNullableType: 407 | active: false 408 | UnsafeCast: 409 | active: false 410 | UselessPostfixExpression: 411 | active: false 412 | WrongEqualsTypeParameter: 413 | active: false 414 | 415 | style: 416 | active: true 417 | CollapsibleIfStatements: 418 | active: false 419 | DataClassContainsFunctions: 420 | active: false 421 | conversionFunctionPrefix: 'to' 422 | DataClassShouldBeImmutable: 423 | active: false 424 | EqualsNullCall: 425 | active: false 426 | EqualsOnSignatureLine: 427 | active: false 428 | ExplicitItLambdaParameter: 429 | active: false 430 | ExpressionBodySyntax: 431 | active: false 432 | includeLineWrapping: false 433 | ForbiddenComment: 434 | active: true 435 | values: 'TODO:,FIXME:,STOPSHIP:' 436 | ForbiddenImport: 437 | active: false 438 | imports: '' 439 | ForbiddenVoid: 440 | active: false 441 | ignoreOverridden: false 442 | ignoreUsageInGenerics: false 443 | FunctionOnlyReturningConstant: 444 | active: false 445 | ignoreOverridableFunction: true 446 | excludedFunctions: 'describeContents' 447 | LibraryCodeMustSpecifyReturnType: 448 | active: false 449 | LoopWithTooManyJumpStatements: 450 | active: false 451 | maxJumpCount: 1 452 | MagicNumber: 453 | active: true 454 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" 455 | ignoreNumbers: '-1,0,1,2' 456 | ignoreHashCodeFunction: true 457 | ignorePropertyDeclaration: false 458 | ignoreConstantDeclaration: true 459 | ignoreCompanionObjectPropertyDeclaration: true 460 | ignoreAnnotation: false 461 | ignoreNamedArgument: true 462 | ignoreEnums: false 463 | ignoreRanges: false 464 | MandatoryBracesIfStatements: 465 | active: false 466 | MaxLineLength: 467 | active: true 468 | maxLineLength: 120 469 | excludePackageStatements: true 470 | excludeImportStatements: true 471 | excludeCommentStatements: false 472 | MayBeConst: 473 | active: false 474 | ModifierOrder: 475 | active: true 476 | NestedClassesVisibility: 477 | active: false 478 | NewLineAtEndOfFile: 479 | active: true 480 | NoTabs: 481 | active: false 482 | OptionalAbstractKeyword: 483 | active: true 484 | OptionalUnit: 485 | active: false 486 | OptionalWhenBraces: 487 | active: false 488 | PreferToOverPairSyntax: 489 | active: false 490 | ProtectedMemberInFinalClass: 491 | active: false 492 | RedundantVisibilityModifierRule: 493 | active: false 494 | ReturnCount: 495 | active: true 496 | max: 2 497 | excludedFunctions: "equals" 498 | excludeLabeled: false 499 | excludeReturnFromLambda: true 500 | SafeCast: 501 | active: true 502 | SerialVersionUIDInSerializableClass: 503 | active: false 504 | SpacingBetweenPackageAndImports: 505 | active: false 506 | ThrowsCount: 507 | active: true 508 | max: 2 509 | TrailingWhitespace: 510 | active: false 511 | UnderscoresInNumericLiterals: 512 | active: false 513 | acceptableDecimalLength: 5 514 | UnnecessaryAbstractClass: 515 | active: false 516 | excludeAnnotatedClasses: "dagger.Module" 517 | UnnecessaryApply: 518 | active: false 519 | UnnecessaryInheritance: 520 | active: false 521 | UnnecessaryLet: 522 | active: false 523 | UnnecessaryParentheses: 524 | active: false 525 | UntilInsteadOfRangeTo: 526 | active: false 527 | UnusedImports: 528 | active: false 529 | UnusedPrivateClass: 530 | active: false 531 | UnusedPrivateMember: 532 | active: false 533 | allowedNames: "(_|ignored|expected|serialVersionUID)" 534 | UseCheckOrError: 535 | active: false 536 | UseDataClass: 537 | active: false 538 | excludeAnnotatedClasses: "" 539 | UseRequire: 540 | active: false 541 | UselessCallOnNotNull: 542 | active: false 543 | UtilityClassWithPublicConstructor: 544 | active: false 545 | VarCouldBeVal: 546 | active: false 547 | WildcardImport: 548 | active: true 549 | excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" 550 | excludeImports: 'java.util.*,kotlinx.android.synthetic.*' 551 | -------------------------------------------------------------------------------- /detekt.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "io.gitlab.arturbosch.detekt" 2 | 3 | detekt { 4 | toolVersion = "1.0.0" 5 | config = files("${rootDir}/default-detekt-config.yml") 6 | } 7 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | [![Kotlin Version](https://img.shields.io/badge/kotlin-1.3.50-blue.svg)](https://kotlinlang.org) 2 | [![API](https://img.shields.io/badge/API-16%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=16) 3 | [![CodeFactor](https://www.codefactor.io/repository/github/diogobernardino/williamchart/badge)](https://www.codefactor.io/repository/github/diogobernardino/williamchart) 4 | 5 | Williamchart is an Android Library to rapidly implement attractive and insightful charts in android applications. 6 | 7 | ### Gradle 8 | 9 | ``` groovy 10 | implementation 'com.diogobernardino:williamchart:3.2.0' 11 | ``` 12 | 13 | If you find this library useful and decide to use it in your projects please drop me a line [@dfbernardino][1], I will be happy to know about it. 14 | 15 | ### Usage 16 | 17 | #### All charts 18 | 19 | ```xml 20 | 26 | ``` 27 | 28 | #### Line Chart 29 | 30 | ```xml 31 | 38 | ``` 39 | 40 | #### Bar Chart 41 | 42 | ```xml 43 | 50 | ``` 51 | 52 | #### Donut Chart 53 | 54 | ```xml 55 | 63 | ``` 64 | 65 | 66 | License 67 | ------- 68 | 69 | Copyright 2019 Diogo Bernardino 70 | 71 | Licensed under the Apache License, Version 2.0 (the "License"); 72 | you may not use this file except in compliance with the License. 73 | You may obtain a copy of the License at 74 | 75 | http://www.apache.org/licenses/LICENSE-2.0 76 | 77 | Unless required by applicable law or agreed to in writing, software 78 | distributed under the License is distributed on an "AS IS" BASIS, 79 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 80 | See the License for the specific language governing permissions and 81 | limitations under the License. 82 | 83 | [1]: https://twitter.com/dfbernardino 84 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-minimal -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | android.enableJetifier=true 10 | android.useAndroidX=true 11 | org.gradle.jvmargs=-Xmx1536m 12 | # When configured, Gradle will run in incubating parallel mode. 13 | # This option should only be used with decoupled projects. More details, visit 14 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 15 | # org.gradle.parallel=true 16 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diogobernardino/williamchart/f0defc0ad2d509aaf32fcbb40fe353470cca35c8/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sat Nov 14 11:56:10 CET 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /jacoco.gradle: -------------------------------------------------------------------------------- 1 | junitJacoco { 2 | jacocoVersion = '0.8.2' // type String 3 | ignoreProjects = [] // type String array 4 | excludes // type String List 5 | includeNoLocationClasses = false // type boolean 6 | includeInstrumentationCoverageInMergedReport = false // type boolean 7 | } 8 | -------------------------------------------------------------------------------- /ktlint.gradle: -------------------------------------------------------------------------------- 1 | configurations { 2 | ktlint 3 | } 4 | 5 | dependencies { 6 | ktlint 'com.pinterest:ktlint:0.35.0' 7 | } 8 | 9 | task ktlint(type: JavaExec, group: "verification") { 10 | description = "Check Kotlin code style." 11 | classpath = configurations.ktlint 12 | main = "com.pinterest.ktlint.Main" 13 | args "src/**/*.kt" 14 | } 15 | 16 | task ktlintFormat(type: JavaExec, group: "formatting") { 17 | description = "Fix Kotlin code style deviations." 18 | classpath = configurations.ktlint 19 | main = "com.pinterest.ktlint.Main" 20 | args "-F", "src/**/*.kt" 21 | } 22 | -------------------------------------------------------------------------------- /mobile/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /mobile/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("com.android.application") 3 | id("com.github.triplet.play") version "2.0.0" 4 | } 5 | 6 | apply plugin: 'com.android.application' 7 | apply plugin: 'kotlin-android' 8 | apply plugin: 'kotlin-android-extensions' 9 | apply plugin: 'com.github.triplet.play' 10 | 11 | Properties properties = new Properties() 12 | File localPropertiesFiles = project.rootProject.file('local.properties') 13 | 14 | if (localPropertiesFiles.exists()) 15 | properties.load(localPropertiesFiles.newDataInputStream()) 16 | 17 | android { 18 | 19 | compileSdkVersion rootProject.targetSdkVersion 20 | 21 | defaultConfig { 22 | applicationId "com.db.williamchartdemo" 23 | minSdkVersion rootProject.minSdkVersion 24 | targetSdkVersion rootProject.targetSdkVersion 25 | versionCode 20 26 | versionName rootProject.williamchartVersion 27 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 28 | } 29 | 30 | if (localPropertiesFiles.exists()) { 31 | signingConfigs { 32 | release { 33 | storeFile file(properties.getProperty("storeFile")) 34 | storePassword properties.getProperty("storePassword") 35 | keyAlias properties.getProperty("keyAlias") 36 | keyPassword properties.getProperty("keyPassword") 37 | } 38 | } 39 | } 40 | 41 | buildTypes { 42 | release { 43 | minifyEnabled false 44 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 45 | if (localPropertiesFiles.exists()) 46 | signingConfig signingConfigs.release 47 | } 48 | } 49 | } 50 | 51 | dependencies { 52 | implementation project(path: ':williamchart') 53 | implementation project(path: ':slidertooltip') 54 | //implementation "com.diogobernardino:williamchart:$rootProject.williamchartVersion" 55 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$rootProject.kotlinVersion" 56 | implementation 'androidx.appcompat:appcompat:1.2.0' 57 | implementation 'com.google.android.material:material:1.2.1' 58 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4' 59 | testImplementation 'junit:junit:4.13.1' 60 | androidTestImplementation 'androidx.test:runner:1.3.0' 61 | } 62 | 63 | play { 64 | serviceAccountEmail = properties.containsKey("play.accountEmail") ? properties.getProperty("play.accountEmail") : "dummyPlayAccountEmail" 65 | serviceAccountCredentials = file(properties.containsKey("play.p12") ? properties.getProperty("play.p12") : "dummyPlayP12") 66 | track = 'alpha' 67 | } -------------------------------------------------------------------------------- /mobile/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /mobile/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /mobile/src/main/java/com/db/williamchartdemo/DemoFragment.kt: -------------------------------------------------------------------------------- 1 | package com.db.williamchartdemo 2 | 3 | import android.graphics.Color 4 | import android.os.Bundle 5 | import android.view.LayoutInflater 6 | import android.view.View 7 | import android.view.ViewGroup 8 | import androidx.fragment.app.Fragment 9 | import com.db.williamchart.ExperimentalFeature 10 | import com.db.williamchart.slidertooltip.SliderTooltip 11 | import kotlinx.android.synthetic.main.demo_fragment.* 12 | 13 | class DemoFragment : Fragment() { 14 | 15 | override fun onCreateView( 16 | inflater: LayoutInflater, 17 | container: ViewGroup?, 18 | savedInstanceState: Bundle? 19 | ): View? = inflater.inflate(R.layout.demo_fragment, container, false) 20 | 21 | @OptIn(ExperimentalFeature::class) 22 | override fun onViewCreated(view: View, saveInstanceState: Bundle?) { 23 | 24 | /** 25 | * Line Chart 26 | */ 27 | lineChart.gradientFillColors = 28 | intArrayOf( 29 | Color.parseColor("#81FFFFFF"), 30 | Color.TRANSPARENT 31 | ) 32 | lineChart.animation.duration = animationDuration 33 | lineChart.tooltip = 34 | SliderTooltip().also { 35 | it.color = Color.WHITE 36 | } 37 | lineChart.onDataPointTouchListener = { index, _, _ -> 38 | lineChartValue.text = 39 | lineSet.toList()[index] 40 | .second 41 | .toString() 42 | } 43 | lineChart.animate(lineSet) 44 | 45 | /** 46 | * Bar Chart 47 | */ 48 | barChart.animation.duration = animationDuration 49 | barChart.animate(barSet) 50 | 51 | /** 52 | * Donut Chart 53 | */ 54 | donutChart.donutColors = intArrayOf( 55 | Color.parseColor("#FFFFFF"), 56 | Color.parseColor("#9EFFFFFF"), 57 | Color.parseColor("#8DFFFFFF") 58 | ) 59 | donutChart.animation.duration = animationDuration 60 | donutChart.animate(donutSet) 61 | 62 | /** 63 | * Horizontal Bar Chart 64 | */ 65 | horizontalBarChart.animation.duration = animationDuration 66 | horizontalBarChart.animate(horizontalBarSet) 67 | } 68 | 69 | companion object { 70 | private val lineSet = listOf( 71 | "label1" to 5f, 72 | "label2" to 4.5f, 73 | "label3" to 4.7f, 74 | "label4" to 3.5f, 75 | "label5" to 3.6f, 76 | "label6" to 7.5f, 77 | "label7" to 7.5f, 78 | "label8" to 10f, 79 | "label9" to 5f, 80 | "label10" to 6.5f, 81 | "label11" to 3f, 82 | "label12" to 4f 83 | ) 84 | 85 | private val barSet = listOf( 86 | "JAN" to 4F, 87 | "FEB" to 7F, 88 | "MAR" to 2F, 89 | "MAY" to 2.3F, 90 | "APR" to 5F, 91 | "JUN" to 4F 92 | ) 93 | 94 | private val horizontalBarSet = listOf( 95 | "PORRO" to 5F, 96 | "FUSCE" to 6.4F, 97 | "EGET" to 3F 98 | ) 99 | 100 | private val donutSet = listOf( 101 | 20f, 102 | 80f, 103 | 100f 104 | ) 105 | 106 | private const val animationDuration = 1000L 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /mobile/src/main/java/com/db/williamchartdemo/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.db.williamchartdemo 2 | 3 | import android.os.Bundle 4 | import androidx.appcompat.app.AppCompatActivity 5 | 6 | class MainActivity : AppCompatActivity() { 7 | 8 | override fun onCreate(savedInstanceState: Bundle?) { 9 | super.onCreate(savedInstanceState) 10 | setContentView(R.layout.activity_main) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /mobile/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /mobile/src/main/res/drawable/ic_barchart.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /mobile/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /mobile/src/main/res/drawable/ic_linechart.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /mobile/src/main/res/drawable/layout_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /mobile/src/main/res/drawable/rounded_card_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /mobile/src/main/res/font/istok_web_bold.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | -------------------------------------------------------------------------------- /mobile/src/main/res/font/open_sans_bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diogobernardino/williamchart/f0defc0ad2d509aaf32fcbb40fe353470cca35c8/mobile/src/main/res/font/open_sans_bold.ttf -------------------------------------------------------------------------------- /mobile/src/main/res/font/opensans_regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diogobernardino/williamchart/f0defc0ad2d509aaf32fcbb40fe353470cca35c8/mobile/src/main/res/font/opensans_regular.ttf -------------------------------------------------------------------------------- /mobile/src/main/res/font/supermercado_one.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /mobile/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /mobile/src/main/res/layout/demo_fragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 16 | 17 | 30 | 31 | 42 | 43 | 61 | 62 | 75 | 76 | 89 | 90 | 101 | 102 | 119 | 120 | 134 | 135 | 152 | 153 | -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diogobernardino/williamchart/f0defc0ad2d509aaf32fcbb40fe353470cca35c8/mobile/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diogobernardino/williamchart/f0defc0ad2d509aaf32fcbb40fe353470cca35c8/mobile/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diogobernardino/williamchart/f0defc0ad2d509aaf32fcbb40fe353470cca35c8/mobile/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diogobernardino/williamchart/f0defc0ad2d509aaf32fcbb40fe353470cca35c8/mobile/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diogobernardino/williamchart/f0defc0ad2d509aaf32fcbb40fe353470cca35c8/mobile/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diogobernardino/williamchart/f0defc0ad2d509aaf32fcbb40fe353470cca35c8/mobile/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diogobernardino/williamchart/f0defc0ad2d509aaf32fcbb40fe353470cca35c8/mobile/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diogobernardino/williamchart/f0defc0ad2d509aaf32fcbb40fe353470cca35c8/mobile/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diogobernardino/williamchart/f0defc0ad2d509aaf32fcbb40fe353470cca35c8/mobile/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diogobernardino/williamchart/f0defc0ad2d509aaf32fcbb40fe353470cca35c8/mobile/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diogobernardino/williamchart/f0defc0ad2d509aaf32fcbb40fe353470cca35c8/mobile/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diogobernardino/williamchart/f0defc0ad2d509aaf32fcbb40fe353470cca35c8/mobile/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diogobernardino/williamchart/f0defc0ad2d509aaf32fcbb40fe353470cca35c8/mobile/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diogobernardino/williamchart/f0defc0ad2d509aaf32fcbb40fe353470cca35c8/mobile/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diogobernardino/williamchart/f0defc0ad2d509aaf32fcbb40fe353470cca35c8/mobile/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mobile/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #475F50 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /mobile/src/main/res/values/font_certs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | @array/com_google_android_gms_fonts_certs_dev 5 | @array/com_google_android_gms_fonts_certs_prod 6 | 7 | 8 | 9 | MIIEqDCCA5CgAwIBAgIJANWFuGx90071MA0GCSqGSIb3DQEBBAUAMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAeFw0wODA0MTUyMzM2NTZaFw0zNTA5MDEyMzM2NTZaMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBANbOLggKv+IxTdGNs8/TGFy0PTP6DHThvbbR24kT9ixcOd9W+EaBPWW+wPPKQmsHxajtWjmQwWfna8mZuSeJS48LIgAZlKkpFeVyxW0qMBujb8X8ETrWy550NaFtI6t9+u7hZeTfHwqNvacKhp1RbE6dBRGWynwMVX8XW8N1+UjFaq6GCJukT4qmpN2afb8sCjUigq0GuMwYXrFVee74bQgLHWGJwPmvmLHC69EH6kWr22ijx4OKXlSIx2xT1AsSHee70w5iDBiK4aph27yH3TxkXy9V89TDdexAcKk/cVHYNnDBapcavl7y0RiQ4biu8ymM8Ga/nmzhRKya6G0cGw8CAQOjgfwwgfkwHQYDVR0OBBYEFI0cxb6VTEM8YYY6FbBMvAPyT+CyMIHJBgNVHSMEgcEwgb6AFI0cxb6VTEM8YYY6FbBMvAPyT+CyoYGapIGXMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbYIJANWFuGx90071MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADggEBABnTDPEF+3iSP0wNfdIjIz1AlnrPzgAIHVvXxunW7SBrDhEglQZBbKJEk5kT0mtKoOD1JMrSu1xuTKEBahWRbqHsXclaXjoBADb0kkjVEJu/Lh5hgYZnOjvlba8Ld7HCKePCVePoTJBdI4fvugnL8TsgK05aIskyY0hKI9L8KfqfGTl1lzOv2KoWD0KWwtAWPoGChZxmQ+nBli+gwYMzM1vAkP+aayLe0a1EQimlOalO762r0GXO0ks+UeXde2Z4e+8S/pf7pITEI/tP+MxJTALw9QUWEv9lKTk+jkbqxbsh8nfBUapfKqYn0eidpwq2AzVp3juYl7//fKnaPhJD9gs= 10 | 11 | 12 | 13 | 14 | MIIEQzCCAyugAwIBAgIJAMLgh0ZkSjCNMA0GCSqGSIb3DQEBBAUAMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDAeFw0wODA4MjEyMzEzMzRaFw0zNjAxMDcyMzEzMzRaMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBAKtWLgDYO6IIrgqWbxJOKdoR8qtW0I9Y4sypEwPpt1TTcvZApxsdyxMJZ2JORland2qSGT2y5b+3JKkedxiLDmpHpDsz2WCbdxgxRczfey5YZnTJ4VZbH0xqWVW/8lGmPav5xVwnIiJS6HXk+BVKZF+JcWjAsb/GEuq/eFdpuzSqeYTcfi6idkyugwfYwXFU1+5fZKUaRKYCwkkFQVfcAs1fXA5V+++FGfvjJ/CxURaSxaBvGdGDhfXE28LWuT9ozCl5xw4Yq5OGazvV24mZVSoOO0yZ31j7kYvtwYK6NeADwbSxDdJEqO4k//0zOHKrUiGYXtqw/A0LFFtqoZKFjnkCAQOjgdkwgdYwHQYDVR0OBBYEFMd9jMIhF1Ylmn/Tgt9r45jk14alMIGmBgNVHSMEgZ4wgZuAFMd9jMIhF1Ylmn/Tgt9r45jk14aloXikdjB0MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLR29vZ2xlIEluYy4xEDAOBgNVBAsTB0FuZHJvaWQxEDAOBgNVBAMTB0FuZHJvaWSCCQDC4IdGZEowjTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBAUAA4IBAQBt0lLO74UwLDYKqs6Tm8/yzKkEu116FmH4rkaymUIE0P9KaMftGlMexFlaYjzmB2OxZyl6euNXEsQH8gjwyxCUKRJNexBiGcCEyj6z+a1fuHHvkiaai+KL8W1EyNmgjmyy8AW7P+LLlkR+ho5zEHatRbM/YAnqGcFh5iZBqpknHf1SKMXFh4dd239FJ1jWYfbMDMy3NS5CTMQ2XFI1MvcyUTdZPErjQfTbQe3aDQsQcafEQPD+nqActifKZ0Np0IS9L9kR/wbNvyz6ENwPiTrjV2KRkEjH78ZMcUQXg0L3BYHJ3lc69Vs5Ddf9uUGGMYldX3WfMBEmh/9iFBDAaTCK 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /mobile/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #85B496 4 | -------------------------------------------------------------------------------- /mobile/src/main/res/values/preloaded_fonts.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | @font/istok_web_bold 5 | @font/supermercado_one 6 | 7 | 8 | -------------------------------------------------------------------------------- /mobile/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | williamchart 3 | 4 | -------------------------------------------------------------------------------- /mobile/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /pointstooltip/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /pointstooltip/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | 4 | android { 5 | compileSdkVersion rootProject.targetSdkVersion 6 | buildToolsVersion "29.0.3" 7 | 8 | defaultConfig { 9 | minSdkVersion rootProject.minSdkVersion 10 | targetSdkVersion rootProject.targetSdkVersion 11 | versionCode 1 12 | versionName rootProject.williamchartVersion 13 | } 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$rootProject.kotlinVersion" 24 | implementation project(path: ':williamchart') 25 | } 26 | 27 | apply from: 'publish.gradle' -------------------------------------------------------------------------------- /pointstooltip/publish.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'maven-publish' 2 | apply plugin: 'com.jfrog.bintray' 3 | 4 | version rootProject.williamchartVersion 5 | group 'com.diogobernardino.williamchart' 6 | 7 | task sourcesJar(type: Jar) { 8 | classifier = 'sources' 9 | from android.sourceSets.main.java.srcDirs 10 | } 11 | 12 | publishing { 13 | publications { 14 | Production(MavenPublication) { 15 | artifact("$buildDir/outputs/aar/pointstooltip-release.aar") 16 | artifact sourcesJar 17 | groupId this.group 18 | artifactId 'tooltip-points' 19 | version this.version 20 | 21 | pom.withXml { 22 | def dependenciesNode = asNode().appendNode('dependencies') 23 | configurations.implementation.allDependencies.each { 24 | if (it.name != 'unspecified') { 25 | def dependencyNode = dependenciesNode.appendNode('dependency') 26 | dependencyNode.appendNode('groupId', it.group) 27 | dependencyNode.appendNode('artifactId', it.name) 28 | dependencyNode.appendNode('version', it.version) 29 | } 30 | } 31 | } 32 | } 33 | } 34 | } 35 | 36 | bintray { 37 | Properties properties = new Properties() 38 | File localPropertiesFiles = project.rootProject.file('local.properties') 39 | if (localPropertiesFiles.exists()) 40 | properties.load(localPropertiesFiles.newDataInputStream()) 41 | 42 | user = properties.containsKey('bintrayUser') ? properties.getProperty('bintrayUser') : System.getenv('BINTRAY_USER') 43 | key = properties.containsKey('bintrayApiKey') ? properties.getProperty('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') 44 | publications = ['Production'] 45 | configurations = ['archives'] 46 | // Default: false. Whether to run this as dry-run, without deploying 47 | dryRun = false 48 | // Default: false. Whether to override version artifacts already published 49 | override = false 50 | // Default: false. Whether version should be auto published after an upload 51 | publish = true 52 | pkg { 53 | repo = 'maven' // the name of the repository you created on Bintray 54 | name = 'com.diogobernardino.williamchart:tooltip-points' 55 | // the name of the package you created inside it 56 | version { 57 | name = this.version 58 | released = new Date() 59 | vcsTag = this.version 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /pointstooltip/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pointstooltip/src/main/java/com/db/williamchart/pointtooltip/PointTooltip.kt: -------------------------------------------------------------------------------- 1 | package com.db.williamchart.pointtooltip 2 | 3 | import android.view.LayoutInflater 4 | import android.view.View 5 | import android.view.ViewGroup 6 | import android.widget.ImageView 7 | import com.db.williamchart.Tooltip 8 | 9 | class PointTooltip : Tooltip { 10 | 11 | private lateinit var tooltipView: View 12 | 13 | @Suppress("MemberVisibilityCanBePrivate") 14 | var drawableRes = R.drawable.circle_point 15 | 16 | override fun onCreateTooltip(parentView: ViewGroup) { 17 | tooltipView = 18 | LayoutInflater.from(parentView.context) 19 | .inflate(R.layout.point_tooltip_layout, parentView, false) 20 | tooltipView.visibility = View.INVISIBLE 21 | 22 | val imageView: ImageView = tooltipView.findViewById(R.id.tooltipImage) 23 | imageView.setImageResource(drawableRes) 24 | 25 | parentView.addView(tooltipView) 26 | } 27 | 28 | override fun onDataPointTouch(x: Float, y: Float) {} 29 | 30 | override fun onDataPointClick(x: Float, y: Float) { 31 | tooltipView.visibility = View.VISIBLE 32 | tooltipView.x = x - tooltipView.width / 2 33 | tooltipView.y = y - tooltipView.height / 2 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /pointstooltip/src/main/res/drawable/circle_point.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | -------------------------------------------------------------------------------- /pointstooltip/src/main/res/layout/point_tooltip_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':mobile', ':williamchart', ':slidertooltip', ':pointstooltip' -------------------------------------------------------------------------------- /slidertooltip/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /slidertooltip/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | 4 | android { 5 | compileSdkVersion rootProject.targetSdkVersion 6 | buildToolsVersion "29.0.3" 7 | 8 | defaultConfig { 9 | minSdkVersion rootProject.minSdkVersion 10 | targetSdkVersion rootProject.targetSdkVersion 11 | versionCode 1 12 | versionName rootProject.williamchartVersion 13 | } 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$rootProject.kotlinVersion" 24 | implementation project(path: ':williamchart') 25 | } 26 | 27 | apply from: 'publish.gradle' -------------------------------------------------------------------------------- /slidertooltip/publish.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'maven-publish' 2 | apply plugin: 'com.jfrog.bintray' 3 | 4 | version rootProject.williamchartVersion 5 | group 'com.diogobernardino.williamchart' 6 | 7 | task sourcesJar(type: Jar) { 8 | classifier = 'sources' 9 | from android.sourceSets.main.java.srcDirs 10 | } 11 | 12 | publishing { 13 | publications { 14 | Production(MavenPublication) { 15 | artifact("$buildDir/outputs/aar/slidertooltip-release.aar") 16 | artifact sourcesJar 17 | groupId this.group 18 | artifactId 'tooltip-slider' 19 | version this.version 20 | 21 | pom.withXml { 22 | def dependenciesNode = asNode().appendNode('dependencies') 23 | configurations.implementation.allDependencies.each { 24 | if (it.name != 'unspecified') { 25 | def dependencyNode = dependenciesNode.appendNode('dependency') 26 | dependencyNode.appendNode('groupId', it.group) 27 | dependencyNode.appendNode('artifactId', it.name) 28 | dependencyNode.appendNode('version', it.version) 29 | } 30 | } 31 | } 32 | } 33 | } 34 | } 35 | 36 | bintray { 37 | Properties properties = new Properties() 38 | File localPropertiesFiles = project.rootProject.file('local.properties') 39 | if (localPropertiesFiles.exists()) 40 | properties.load(localPropertiesFiles.newDataInputStream()) 41 | 42 | user = properties.containsKey('bintrayUser') ? properties.getProperty('bintrayUser') : System.getenv('BINTRAY_USER') 43 | key = properties.containsKey('bintrayApiKey') ? properties.getProperty('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') 44 | publications = ['Production'] 45 | configurations = ['archives'] 46 | // Default: false. Whether to run this as dry-run, without deploying 47 | dryRun = false 48 | // Default: false. Whether to override version artifacts already published 49 | override = false 50 | // Default: false. Whether version should be auto published after an upload 51 | publish = true 52 | pkg { 53 | repo = 'maven' // the name of the repository you created on Bintray 54 | name = 'com.diogobernardino.williamchart:tooltip-slider' 55 | // the name of the package you created inside it 56 | version { 57 | name = this.version 58 | released = new Date() 59 | vcsTag = this.version 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /slidertooltip/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /slidertooltip/src/main/java/com/db/williamchart/slidertooltip/SliderTooltip.kt: -------------------------------------------------------------------------------- 1 | package com.db.williamchart.slidertooltip 2 | 3 | import android.graphics.Color 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import com.db.williamchart.ExperimentalFeature 8 | import com.db.williamchart.Tooltip 9 | 10 | @ExperimentalFeature 11 | class SliderTooltip : Tooltip { 12 | 13 | private lateinit var tooltipView: View 14 | 15 | var color = Color.BLACK 16 | 17 | override fun onCreateTooltip(parentView: ViewGroup) { 18 | tooltipView = 19 | LayoutInflater.from(parentView.context) 20 | .inflate(R.layout.tooltip_layout, parentView, false) 21 | tooltipView.setBackgroundColor(color) 22 | tooltipView.visibility = View.INVISIBLE 23 | parentView.addView(tooltipView) 24 | } 25 | 26 | override fun onDataPointTouch(x: Float, y: Float) { 27 | tooltipView.visibility = View.VISIBLE 28 | tooltipView.x = x - tooltipView.width / 2 29 | } 30 | 31 | override fun onDataPointClick(x: Float, y: Float) {} 32 | } 33 | -------------------------------------------------------------------------------- /slidertooltip/src/main/res/layout/tooltip_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /williamchart/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /williamchart/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | 4 | android { 5 | kotlinOptions { 6 | jvmTarget = "1.8" 7 | } 8 | 9 | compileSdkVersion rootProject.targetSdkVersion 10 | 11 | defaultConfig { 12 | minSdkVersion rootProject.minSdkVersion 13 | targetSdkVersion rootProject.targetSdkVersion 14 | versionCode 1 15 | versionName rootProject.williamchartVersion 16 | } 17 | 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 22 | } 23 | } 24 | 25 | } 26 | 27 | dependencies { 28 | implementation 'androidx.appcompat:appcompat:1.2.0' 29 | implementation 'androidx.core:core-ktx:1.3.2' 30 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$rootProject.kotlinVersion" 31 | testImplementation 'junit:junit:4.13.1' 32 | testImplementation "org.mockito:mockito-core:3.3.3" 33 | testImplementation "com.nhaarman:mockito-kotlin:1.6.0" 34 | } 35 | 36 | apply from: 'publish.gradle' -------------------------------------------------------------------------------- /williamchart/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /williamchart/publish.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'maven-publish' 2 | apply plugin: 'com.jfrog.bintray' 3 | 4 | version rootProject.williamchartVersion 5 | group 'com.diogobernardino' 6 | 7 | publishing { 8 | publications { 9 | Production(MavenPublication) { 10 | artifact("$buildDir/outputs/aar/williamchart-release.aar") 11 | groupId this.group 12 | artifactId 'williamchart' 13 | version this.version 14 | 15 | pom.withXml { 16 | def dependenciesNode = asNode().appendNode('dependencies') 17 | configurations.implementation.allDependencies.each { 18 | if (it.name != 'unspecified') { 19 | def dependencyNode = dependenciesNode.appendNode('dependency') 20 | dependencyNode.appendNode('groupId', it.group) 21 | dependencyNode.appendNode('artifactId', it.name) 22 | dependencyNode.appendNode('version', it.version) 23 | } 24 | } 25 | } 26 | } 27 | } 28 | } 29 | 30 | bintray { 31 | Properties properties = new Properties() 32 | File localPropertiesFiles = project.rootProject.file('local.properties') 33 | if (localPropertiesFiles.exists()) 34 | properties.load(localPropertiesFiles.newDataInputStream()) 35 | 36 | user = properties.containsKey('bintrayUser') ? properties.getProperty('bintrayUser') : System.getenv('BINTRAY_USER') 37 | key = properties.containsKey('bintrayApiKey') ? properties.getProperty('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') 38 | publications = ['Production'] 39 | configurations = ['archives'] 40 | // Default: false. Whether to run this as dry-run, without deploying 41 | dryRun = false 42 | // Default: false. Whether to override version artifacts already published 43 | override = false 44 | // Default: false. Whether version should be auto published after an upload 45 | publish = true 46 | pkg { 47 | repo = 'maven' // the name of the repository you created on Bintray 48 | name = 'com.diogobernardino:williamchart' // the name of the package you created inside it 49 | version { 50 | name = this.version 51 | released = new Date() 52 | vcsTag = this.version 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /williamchart/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /williamchart/src/main/java/com/db/williamchart/ChartContract.kt: -------------------------------------------------------------------------------- 1 | package com.db.williamchart 2 | 3 | import com.db.williamchart.animation.ChartAnimation 4 | import com.db.williamchart.data.configuration.ChartConfiguration 5 | import com.db.williamchart.data.DataPoint 6 | import com.db.williamchart.data.configuration.DonutChartConfiguration 7 | import com.db.williamchart.data.DonutDataPoint 8 | import com.db.williamchart.data.Frame 9 | import com.db.williamchart.data.Label 10 | 11 | interface ChartContract { 12 | 13 | interface AxisView { 14 | fun postInvalidate() 15 | fun drawLabels(xLabels: List