UNPKG

4.87 kBMarkdownView Raw
1<p align="center">
2 <img src="/assets/logo.png" alt="" width="330" height="" />
3</p>
4
5<p align="center">
6 <a href="https://www.npmjs.com/package/singledivui" target="_blank">
7 <img src="https://img.shields.io/npm/v/singledivui?style=flat-square" />
8 </a>
9 <a href="https://github.com/soundar24/singledivui/blob/master/LICENSE" target="_blank">
10 <img src="https://img.shields.io/github/license/soundar24/singledivui?style=flat-square" />
11 </a>
12</p>
13
14<p align="center">
15 <a href="https://singledivui.com"> https://singledivui.com </a> <br />
16</p>
17
18<p align="center">
19 A list of Chart components that made with a <b>single div</b> element.
20</p>
21
22<a href="https://singledivui.com">
23 <img src="/assets/showcase.png" alt="singledivui - Line chart, Bar chart, Area chart" />
24</a>
25
26---
27
28## Intro
29The SingleDivUI is a simple and smallest UI components library which includes Line chart, Bar chart, Area chart (and more coming on). Here the complete component was made up of with a single DIV element alone, with the CSS capabilities. There is no images, SVG or Canvas nothing used.
30
31<!-- toc -->
32## Table of contents
33
34- [Getting started](#getting-started)
35- [Quickstart](#quickstart)
36- [APIs](#apis)
37- [Demos](#demos)
38- [Screenshots](#screenshots)
39- [Facts](#facts)
40- [License](#license)
41
42<!-- tocstop -->
43---
44
45## Getting started
46
47Refer the [Getting started](https://singledivui.com/docs/getting-started) documentation for the detailed information.
48
49## Quickstart
50
51The simple and easiest way to try and start using **SingleDivUI's** Chart component is using the editable samples from **CodePen** or **StackBlitz**. Try the below basic chart,
52* demo based on **npm**
53 * <a href="https://stackblitz.com/edit/singledivui-v1"> StackBlitz Demo </a>
54* demo based on CDN
55 * <a href="https://codepen.io/soundar24/pen/zYmGPaz"> CodePen Demo </a>
56
57
58Just fork the above samples and try to edit yourself for more customization. Also refer the [API Reference](/docs/api-reference) document to know about the available options.
59
60## APIs
61
62Here are the complete list of APIs from the Chart component.
63
64Please note that these are the all available API's with their default values. So to create a basic Chart you don't need to include all of these, for the customization only these needed.
65
66Refer the [Usage](https://singledivui.com/docs/getting-started#usage) section for the basic Chart creation, also refer the [API Reference](https://singledivui.com/docs/api-reference) for the detailed information of these APIs.
67
68```JavaScript
69new Chart('#chart', {
70 // type should be 'line', 'bar' or 'area'
71 type: null,
72 data: {
73 labels: [],
74
75 series: {
76 points: [],
77
78 // ------ for line-chart related customizations ------
79 lineColor: null,
80 lineSize: null,
81 pointRadius: null,
82 pointColor: null,
83 pointBorderWidth: null,
84 pointBorderColor: null,
85 pointStyle: null,
86 pointInnerColor: null,
87 dotRadius: null,
88
89 // ------ for bar-chart related customizations ------
90 barSize: null,
91 barColor: null,
92
93 // ------ for area-chart related customizations ------
94 areaColor: null
95 },
96 },
97
98 graphSettings: {
99 labelFontSize: '11px',
100 labelFontFamily: 'Verdana, Arial, sans-serif',
101 gridLineColor: null,
102 gridLineSize: null,
103 axisLineColor: null,
104 axisLineSize: null,
105 labelColor: null,
106 labelDistance: null,
107
108 xAxis: {
109 verticalLabel: false,
110 padding: [0, 0],
111 labelFormatter: null
112 },
113 yAxis: {
114 maxTicks: 10,
115 startFromZero: false,
116 labelFormatter: null,
117
118 customScale: {
119 min: null,
120 max: null,
121 interval: null
122 }
123 }
124 },
125
126 height: 260,
127 width: '100%',
128 responsive: true,
129 stylesAppendTo: 'head'
130});
131```
132
133## Demos
134
135Refer the [Demos](https://singledivui.com/demos/line-chart/basic) section to check out multiple demo samples and customizations.
136
137## Screenshots
138
139![singledivui - line chart, bar chart, area chart - colourful appearances](/assets/Screenshot-1.png)
140
141![singledivui - line chart, bar chart, area chart - customization](/assets/Screenshot-2.png)
142
143## Facts
144- The complete rendering was done by CSS, and inside a single div alone
145- The size of the library is very small with no dependencies
146- No built-in interactions, based on the requirement it can be added in the near future
147- No animation, but still CSS transition will works on dynamic data update
148- Inspired by Lynn Fisher's CSS drawing with a <a href="https://singlediv.com/">single div</a>
149
150## License
151
152[MIT](https://github.com/soundar24/SingleDivUI/blob/main/LICENSE)