Skip to content

Commit 20b41b5

Browse files
authored
Merge pull request #117 from yml-org/release/v2.1.0
Release/v2.1.0
2 parents 6ef0c8d + b5c83ff commit 20b41b5

File tree

2 files changed

+239
-10
lines changed

2 files changed

+239
-10
lines changed

README.md

+238-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,60 @@
11
# YCharts
22

3-
YCharts is a light and extensible chart library for Jetpack Compose system. It comprises two main modules:
3+
YCharts is a Jetpack-compose based charts library which enables developers to easily integrate various types of charts/graphs into their existing ui to visually represent statistical data. YCharts supports both cartesian(XY-charts) and polar charts(Radial charts), which include:
4+
5+
A. Cartesian charts:
6+
1. Line chart
7+
<div>
8+
<figure>
9+
<img width=100 src="https://github.com/AkYML/YCharts/assets/102035914/58352fc4-8039-46e6-9248-1f338efc705d"/>
10+
</figure>
11+
</div>
12+
13+
2. Bar chart
14+
<div>
15+
<figure>
16+
<img width=100 src="https://github.com/AkYML/YCharts/assets/102035914/5af22ba1-232f-4d1a-8067-c08f56a61b13"/>
17+
</figure>
18+
</div>
19+
20+
3. Wave chart
21+
<div>
22+
<figure>
23+
<img width=100 src="https://github.com/AkYML/YCharts/assets/102035914/be694054-d5cc-49ec-b7ee-be80c1562df7"/>
24+
</figure>
25+
</div>
26+
27+
4. Bubble chart
28+
<div>
29+
<figure>
30+
<img width=100 src="https://github.com/AkYML/YCharts/assets/102035914/cb177d4d-3fa8-4171-b3bd-7064458b1964"/>
31+
</figure>
32+
</div>
33+
5. Combined chart
34+
<div>
35+
<figure>
36+
<img width=100 src="https://github.com/AkYML/YCharts/assets/102035914/809bff58-a857-4ed1-8415-cd1d97be300f"/>
37+
</figure>
38+
</div>
39+
40+
B.Radial charts:
41+
1. Pie chart
42+
<div>
43+
<figure>
44+
<img width=100 src="https://github.com/AkYML/YCharts/assets/102035914/ac6eb6c7-033d-439b-b416-d6083ba0ee83"/>
45+
</figure>
46+
</div>
47+
2. Donut chart
48+
<div>
49+
<figure>
50+
<img width=100 src="https://github.com/AkYML/YCharts/assets/102035914/3296d983-4a9a-4b91-8b46-49f84a80041c"/>
51+
</figure>
52+
</div>
53+
54+
55+
56+
57+
It comprises two main modules:
458

559
- `YChartslib` (Chart components for Jetpack Compose)
660
- `app` (sample app to showcase chart components)
@@ -12,7 +66,7 @@ You can add the library via Maven:
1266
Gradle:
1367

1468
```groovy
15-
implementation 'co.yml:ycharts:2.0.0'
69+
implementation 'co.yml:ycharts:2.1.0'
1670
```
1771

1872
## Modules
@@ -100,11 +154,18 @@ Let's see how we can use the chart components and style them with available cust
100154

101155
<figure>
102156
<div align = "center">
103-
<img width=317 src="https://user-images.githubusercontent.com/107846675/189699724-c8064338-8894-45e2-b60b-3d830123e813.png" />
104-
<p> Line chart looks like this!</p>
157+
<img width=317 src="https://github.com/AkYML/YCharts/assets/102035914/58352fc4-8039-46e6-9248-1f338efc705d"/>
158+
<p> Line chart looks like this! </p>
159+
160+
<img width=317 src="https://github.com/AkYML/YCharts/assets/102035914/a5d5c153-c2df-43d7-8d05-41548ed64e5c"/>
161+
<p> Line chart with dots looks like this! </p>
162+
105163
</div>
106164
</figure>
107165

166+
167+
168+
108169
### 2. Bar Chart:
109170

110171
- Create list of barChartData using the random generator extension and `BarData` data class.
@@ -152,11 +213,15 @@ Let's see how we can use the chart components and style them with available cust
152213

153214
<figure>
154215
<div align = "center">
155-
<img width=347 src="https://user-images.githubusercontent.com/107846675/189836621-eeac8181-f7de-491e-8fd8-7e1276e2fb9f.png" />
216+
<img width=347 src="https://github.com/AkYML/YCharts/assets/102035914/0d2a6cfd-98c4-46ee-92a7-b88814f8d186" />
156217
<p> Bar chart looks like this!</p>
218+
<img width=347 src="https://github.com/AkYML/YCharts/assets/102035914/6dec92d7-95ed-4892-89b7-44a03d0711b9" />
219+
<p> Horizontal Bar chart looks like this!</p>
220+
157221
</div>
158222
</figure>
159223

224+
160225
### 3. Grouped Bar Chart:
161226

162227
- Create list of grouped combinations of bar chart data using the random generator extension and `BarPlotData` data class.
@@ -208,8 +273,10 @@ Let's see how we can use the chart components and style them with available cust
208273

209274
<figure>
210275
<div align = "center">
211-
<img width=338 src="https://user-images.githubusercontent.com/107846675/189845009-6ef2ccc6-3c75-446e-9273-fe1b1e1e94d0.png" />
276+
<img width=338 src="https://github.com/AkYML/YCharts/assets/102035914/55df945d-bcd9-4b08-b47e-5d439a7abf39" />
212277
<p> Grouped Bar chart looks like this!</p>
278+
<img width=338 src="https://github.com/AkYML/YCharts/assets/102035914/00af9045-4054-4544-b4c5-93b568df2b85" />
279+
<p> Stacked Bar chart looks like this!</p>
213280
</div>
214281
</figure>
215282

@@ -253,11 +320,20 @@ Let's see how we can use the chart components and style them with available cust
253320

254321
<figure>
255322
<div align = "center">
256-
<img width=238 src="https://user-images.githubusercontent.com/107846675/189865767-377f3b12-1568-46c9-a248-6454ed9bb96e.png" />
323+
<img width=238 src="https://github.com/AkYML/YCharts/assets/102035914/457b6034-eef0-4f70-bd40-0fc0e950298a" />
257324
<p> Pie chart looks like this!</p>
325+
326+
<img width=238 src="https://github.com/AkYML/YCharts/assets/102035914/ac6eb6c7-033d-439b-b416-d6083ba0ee83" />
327+
<p> Pie chart with lables like this!</p>
328+
258329
</div>
259330
</figure>
260331

332+
333+
334+
335+
336+
261337
### 5. Donut Chart:
262338

263339
- Similar to pie chart here we need create list of slices using the `PieChartData` data class.
@@ -300,11 +376,14 @@ Let's see how we can use the chart components and style them with available cust
300376

301377
<figure>
302378
<div align = "center">
303-
<img width=233 src="https://user-images.githubusercontent.com/107846675/189868490-cbaecf87-2beb-4788-ba8e-f57b667cbf10.png" />
379+
<img width=233 src="https://github.com/AkYML/YCharts/assets/102035914/3296d983-4a9a-4b91-8b46-49f84a80041c" />
304380
<p> Donut chart looks like this!</p>
305381
</div>
306382
</figure>
307383

384+
385+
386+
308387
### 6. Combined Chart:
309388

310389
- Similar to line and bar chart we can combine both entities in one chart, just need to initialize the line and bar plot data using the random generator extension and add styling related to individual component.
@@ -374,12 +453,162 @@ Let's see how we can use the chart components and style them with available cust
374453
_Note_ : To show legends infomartion related to bar, `Legends` component can be used.
375454
<figure>
376455
<div align = "center">
377-
<img width=292 src="https://user-images.githubusercontent.com/107846675/192773924-74421edd-7314-4b44-bdb1-13aaf3598796.png" />
456+
<img width=292 src="https://github.com/AkYML/YCharts/assets/102035914/809bff58-a857-4ed1-8415-cd1d97be300f" />
378457
<p> Combined bar with line chart looks like this!</p>
379458
</div>
380459
</figure>
381460
<br>
382461

462+
463+
464+
### 7. Wave Chart:
465+
466+
- Wave charts, also referred to as waveform charts or waveform displays, are specialized visualizations used primarily in the field of signal processing and electronics. These charts illustrate the amplitude (vertical axis) and time (horizontal axis) of a waveform.
467+
468+
```kotlin
469+
val waveChartData = WaveChartData(
470+
wavePlotData = WavePlotData(
471+
lines = listOf(
472+
Wave(
473+
dataPoints = pointsData,
474+
waveStyle = LineStyle(color = Color.Black),
475+
selectionHighlightPoint = SelectionHighlightPoint(),
476+
shadowUnderLine = ShadowUnderLine(),
477+
selectionHighlightPopUp = SelectionHighlightPopUp(),
478+
waveFillColor = WaveFillColor(topColor = Color.Green, bottomColor = Color.Red),
479+
)
480+
)
481+
),
482+
xAxisData = xAxisData,
483+
yAxisData = yAxisData,
484+
gridLines = GridLines()
485+
)
486+
```
487+
488+
- Initialize X and Y Axis builders using the `AxisData` data class.
489+
490+
```kotlin
491+
val xAxisData = AxisData.Builder()
492+
.axisStepSize(30.dp)
493+
.steps(maxOf(barChartData.size - 1, lineChartData.size - 1))
494+
.bottomPadding(40.dp)
495+
.labelData { index -> index.toString() }
496+
.build()
497+
498+
val yAxisData = AxisData.Builder()
499+
.steps(yStepSize)
500+
.labelAndAxisLinePadding(20.dp)
501+
.axisOffset(20.dp)
502+
.labelData { index -> (index * (maxRange / yStepSize)).toString() }
503+
.build()
504+
```
505+
506+
- Initialize the Wave chart config data with `WaveChartData` data class in order to achieve styling and configurations related to same.
507+
508+
```kotlin
509+
val waveChartData = WaveChartData(
510+
wavePlotData = WavePlotData(
511+
lines = listOf(
512+
Wave(
513+
dataPoints = pointsData,
514+
waveStyle = LineStyle(color = Color.Black),
515+
selectionHighlightPoint = SelectionHighlightPoint(),
516+
shadowUnderLine = ShadowUnderLine(),
517+
selectionHighlightPopUp = SelectionHighlightPopUp(),
518+
waveFillColor = WaveFillColor(topColor = Color.Green, bottomColor = Color.Red),
519+
)
520+
)
521+
),
522+
xAxisData = xAxisData,
523+
yAxisData = yAxisData,
524+
gridLines = GridLines()
525+
)
526+
```
527+
528+
- Finally, use the _**`WaveChart`**_ component to render the chart.
529+
```kotlin
530+
WaveChart(
531+
modifier = Modifier
532+
.fillMaxWidth()
533+
.height(300.dp),
534+
waveChartData = data
535+
)
536+
```
537+
_Note_ : To show legends infomartion related to bar, `Legends` component can be used.
538+
<figure>
539+
<div align = "center">
540+
<img width=292 src="https://github.com/AkYML/YCharts/assets/102035914/be694054-d5cc-49ec-b7ee-be80c1562df7" />
541+
<p> Wavechart looks like this!</p>
542+
<img width=292 src="https://github.com/AkYML/YCharts/assets/102035914/2d8b02af-1252-44fb-83e1-06d1f6230733" />
543+
<p> Sinewavechart looks like this!</p>
544+
</div>
545+
</figure>
546+
<br>
547+
548+
### 8. Bubble Chart:
549+
550+
- Bubble charts are a variation of the scatter plot, where the data points are represented as bubbles or circles instead of simple dots. The bubbles' size represents the value of a third variable, in addition to the x-axis and y-axis variables. Bubble charts are effective in visualizing and comparing three different dimensions of data simultaneously.
551+
552+
```kotlin
553+
val bubbleChartData = BubbleChartData(
554+
DataUtils.getBubbleChartDataWithGradientStyle(pointsData),
555+
xAxisData = xAxisData,
556+
yAxisData = yAxisData,
557+
gridLines = GridLines()
558+
)
559+
```
560+
561+
- Initialize X and Y Axis builders using the `AxisData` data class.
562+
563+
```kotlin
564+
val xAxisData = AxisData.Builder()
565+
.axisStepSize(30.dp)
566+
.steps(maxOf(barChartData.size - 1, lineChartData.size - 1))
567+
.bottomPadding(40.dp)
568+
.labelData { index -> index.toString() }
569+
.build()
570+
571+
val yAxisData = AxisData.Builder()
572+
.steps(yStepSize)
573+
.labelAndAxisLinePadding(20.dp)
574+
.axisOffset(20.dp)
575+
.labelData { index -> (index * (maxRange / yStepSize)).toString() }
576+
.build()
577+
```
578+
579+
- Initialize the Bubble chart config data with `BubbleChartData` data class in order to achieve styling and configurations related to same.
580+
581+
```kotlin
582+
val bubbleChartData = BubbleChartData(
583+
DataUtils.getBubbleChartDataWithGradientStyle(pointsData),
584+
xAxisData = xAxisData,
585+
yAxisData = yAxisData,
586+
gridLines = GridLines()
587+
)
588+
589+
```
590+
591+
- Finally, use the _**`BubbleChart`**_ component to render the chart.
592+
```kotlin
593+
BubbleChart(
594+
modifier = Modifier
595+
.fillMaxWidth()
596+
.height(500.dp),
597+
bubbleChartData = data
598+
)
599+
```
600+
_Note_ : To show legends infomartion related to bar, `Legends` component can be used.
601+
<figure>
602+
<div align = "center">
603+
<img width=292 src="https://github.com/AkYML/YCharts/assets/102035914/be103f93-8562-4939-add8-1693d76441ef" />
604+
<p> Gradient-Bubble chart looks like this!</p>
605+
<img width=292 src="https://github.com/AkYML/YCharts/assets/102035914/cb177d4d-3fa8-4171-b3bd-7064458b1964" />
606+
<p> Bubble chart looks like this!</p>
607+
</div>
608+
</figure>
609+
<br>
610+
611+
383612
## Accessibility Support
384613

385614
To interact with your device with touch and spoken feedback, you can turn on the TalkBack screen reader. TalkBack describes the graphs/charts when tapped on the graph container.

YChartsLib/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ publishing {
5353
register<MavenPublication>("release") {
5454
groupId = "co.yml"
5555
artifactId = "ycharts"
56-
version = "1.0.1"
56+
version = "2.1.0"
5757
afterEvaluate {
5858
from(components["release"])
5959
}

0 commit comments

Comments
 (0)