@circutor/charts 0.0.19 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/readme.md +111 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@circutor/charts",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"description": "Stencil Component Starter",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"repository": {
|
|
31
31
|
"type": "git",
|
|
32
|
-
"url": "https://
|
|
32
|
+
"url": "https://gitlab.com/circutor/cloud/myc-web-charts.git"
|
|
33
33
|
},
|
|
34
34
|
"files": [
|
|
35
35
|
"dist/",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"puppeteer": "^21.9.0"
|
|
57
57
|
},
|
|
58
58
|
"license": "MIT",
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "e028b97d43fcb4704607349eed2e891fccecf907"
|
|
60
60
|
}
|
package/readme.md
CHANGED
|
@@ -1 +1,112 @@
|
|
|
1
1
|
[](https://stenciljs.com)
|
|
2
|
+
|
|
3
|
+
### MYC Charts
|
|
4
|
+
|
|
5
|
+
This repository aims to make the charts used by the Cloud team in their web applications accessible to the rest of the organization. This will facilitate their reuse, standardization, and maintenance across different projects.
|
|
6
|
+
|
|
7
|
+
### How to Use
|
|
8
|
+
|
|
9
|
+
**Base Scenario**: We want to use the ITIC curve chart.
|
|
10
|
+
|
|
11
|
+
#### As a Web Component
|
|
12
|
+
|
|
13
|
+
To use the chart as a Web Component, simply import it from the CDN in your HTML code.
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<script type="module" src="https://unpkg.com/@circutor/charts/dist/charts/charts.esm.js"></script>
|
|
17
|
+
<script nomodule src="https://unpkg.com/@circutor/charts/dist/charts/charts.js"></script>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Then, you can directly insert the chart into your HTML:
|
|
21
|
+
|
|
22
|
+
```html
|
|
23
|
+
<itic-chart
|
|
24
|
+
groups='[{"groupName":"L1,L2,L3","points":[{"duration":230,"voltage":93.46,"ts":"2024-06-26T20:23:45.220000+02:00"}],"color":"#00B388"},{"groupName":"L2","points":[{"duration":20,"voltage":0.4000000000000057,"ts":"2025-01-26T23:04:34.840000+01:00"}],"color":"#20262C"}]'
|
|
25
|
+
></itic-chart>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
<details>
|
|
29
|
+
<summary>Complete example</summary>
|
|
30
|
+
|
|
31
|
+
```html
|
|
32
|
+
<!DOCTYPE html>
|
|
33
|
+
<html lang="es">
|
|
34
|
+
<head>
|
|
35
|
+
<meta charset="UTF-8" />
|
|
36
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
37
|
+
<title>Charts</title>
|
|
38
|
+
|
|
39
|
+
<script type="module" src="https://unpkg.com/@circutor/charts/dist/charts/charts.esm.js"></script>
|
|
40
|
+
<script nomodule src="https://unpkg.com/@circutor/charts/dist/charts/charts.js"></script>
|
|
41
|
+
|
|
42
|
+
<style>
|
|
43
|
+
body {
|
|
44
|
+
font-family: Arial, sans-serif;
|
|
45
|
+
text-align: center;
|
|
46
|
+
padding: 20px;
|
|
47
|
+
}
|
|
48
|
+
mi-componente {
|
|
49
|
+
display: block;
|
|
50
|
+
margin-top: 20px;
|
|
51
|
+
}
|
|
52
|
+
</style>
|
|
53
|
+
</head>
|
|
54
|
+
<body>
|
|
55
|
+
<itic-chart
|
|
56
|
+
groups='[{"groupName":"L1,L2,L3","points":[{"duration":230,"voltage":93.46,"ts":"2024-06-26T20:23:45.220000+02:00"}],"color":"#00B388"},{"groupName":"L2","points":[{"duration":20,"voltage":0.4000000000000057,"ts":"2025-01-26T23:04:34.840000+01:00"}],"color":"#20262C"}]'
|
|
57
|
+
></itic-chart>
|
|
58
|
+
</body>
|
|
59
|
+
</html>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
</details>
|
|
63
|
+
|
|
64
|
+
#### From a React Application
|
|
65
|
+
|
|
66
|
+
1. **Install the package**
|
|
67
|
+
First, you need to install the `@circutor/charts-react` package in your project:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
npm install @circutor/charts-react
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
2. **Import the component**
|
|
74
|
+
Then, import the component into your React file:
|
|
75
|
+
|
|
76
|
+
```javascript
|
|
77
|
+
import { IticChart } from '@circutor/charts-react';`>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
3. **Use the component**
|
|
81
|
+
Now, you can use the chart in your application like any other React component. Just pass the necessary data and configurations:
|
|
82
|
+
|
|
83
|
+
```html
|
|
84
|
+
<IticChart
|
|
85
|
+
groups={[
|
|
86
|
+
{
|
|
87
|
+
groupName: "L1,L2,L3",
|
|
88
|
+
points: [
|
|
89
|
+
{
|
|
90
|
+
duration: 230,
|
|
91
|
+
voltage: 93.46,
|
|
92
|
+
ts: "2024-06-26T20:23:45.220000+02:00",
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
color: "#00B388",
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
groupName: "L2",
|
|
99
|
+
points: [
|
|
100
|
+
{
|
|
101
|
+
duration: 20,
|
|
102
|
+
voltage: 0.4000000000000057,
|
|
103
|
+
ts: "2025-01-26T23:04:34.840000+01:00",
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
color: "#20262C",
|
|
107
|
+
},
|
|
108
|
+
]}
|
|
109
|
+
></IticChart>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Remember to consult the documentation for each component for more details and configuration options.
|