-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathindex.html
295 lines (278 loc) · 10.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Multicolor series</title>
<link rel="stylesheet" charset="utf-8" type="text/css" href="css/styles.css" />
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/atom-one-dark.min.css">
<script src="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', (event) => {
document.querySelectorAll('code').forEach((el) => {
hljs.highlightElement(el);
});
const snippets = document.getElementsByTagName('pre');
const numberOfSnippets = snippets.length;
for (let i = 0; i < numberOfSnippets; i++) {
const code = snippets[i].getElementsByTagName('code')[0].innerText,
copyIcon = `<svg width="18px" height="18px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M17.5 14H19C20.1046 14 21 13.1046 21 12V5C21 3.89543 20.1046 3 19 3H12C10.8954 3 10 3.89543 10 5V6.5M5 10H12C13.1046 10 14 10.8954 14 12V19C14 20.1046 13.1046 21 12 21H5C3.89543 21 3 20.1046 3 19V12C3 10.8954 3.89543 10 5 10Z" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>`;
snippets[i].innerHTML = `<button class="hljs-copy">${copyIcon}</button>` + snippets[i].innerHTML;
snippets[i].getElementsByClassName('hljs-copy')[0].addEventListener("click", function () {
button = this;
button.innerText = 'Copying..';
navigator.clipboard.writeText(code);
button.innerText = 'Copied!';
setTimeout(function () {
button.innerHTML = copyIcon;
}, 1000)
});
}
});
</script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="dist/multicolor-series.js"></script>
<script src="samples/demo.js" defer></script>
</head>
<body>
<header>
<div class="container">
<div class="columns">
<div class="details">
<a href="http://blacklabel.net">
<img class="logo" src="https://blacklabel.net/wp-content/uploads/2023/09/blacklabel_logo_white.png"
alt="Black Label">
</a>
<h1>Multicolor Series Highcharts Module</h1>
<p>Typescript-supported Highcharts plugin that adds both line/area multicolor series, where you can define color for each part of a path.</p>
</div>
<div id="showcase-demo" class="chart"></div>
</div>
</div>
</header>
<nav>
<div class="container">
<ul>
<li>
<a href="#prerequisites">Prerequisites</a>
</li>
<li>
<a href="#installation">Installation</a>
</li>
<li>
<a href="#usage">Usage</a>
</li>
<li>
<a href="#parameters">Parameters</a>
</li>
<li>
<a href="#demos">Demos</a>
</li>
<li>
<a href="#tests">Tests</a>
</li>
<li>
<a href="#changelog">Changelog</a>
</li>
<li>
<a href="#license">License</a>
</li>
</ul>
</div>
</nav>
<main class="container">
<section>
<p>
The latest code is available on GitHub:
<a href="https://github.com/blacklabel/multicolor_series/" target=”_blank”>
https://github.com/blacklabel/multicolor_series/
</a>
</p>
</section>
<section>
<h2 id="prerequisites">General prerequisites</h2>
<p>This module requires Highcharts package with the following versions installed in your project:</p>
<ul class="prerequisites-list">
<li>For version <b>3.1.0</b>: Highcharts <b>v12.0.0+</b></li>
<li>For version <b>3.0.0</b>: Highcharts <b>v11.3.0+</b></li>
<li>For version <b>2.4.0 - 3.0.0</b>: Highcharts <b>v10.0.0 - v11.2.0</b></li>
<li>For version <b>2.3.0</b>: Highcharts <b>v9.2.0 - v9.3.3</b></li>
<li>For version <b>2.x.x</b>: Highcharts <b>v4.2.2 - v9.2.0</b></li>
<li>For version <b>1.x.x</b>: Highcharts <b>v4.0.0 - v4.2.2</b></li>
</ul>
</section>
<section>
<h2 id="installation">Installation</h2>
<h3>NPM</h3>
<p>
Get the package from NPM in your app:
<pre><code class="language-javascript">npm install highcharts-multicolor-series</code></pre>
</p>
<p>
If Highcharts is not already installed, get the package with Highcharts:
<pre><code class="language-javascript">npm install highcharts highcharts-multicolor-series</code></pre>
</p>
<h3>CDN</h3>
<p>
Add a <code class="language-html"><script></code> tag below the Highcharts script tag:
</p>
<pre><code class="language-javascript"><script src="https://cdn.jsdelivr.net/npm/highcharts-multicolor-series"></script></code></pre>
</section>
<section>
<h2 id="usage">Usage</h2>
<h3>Basic usage example:</h3>
<p>The Live example is available <a href="https://jsfiddle.net/BlackLabel/ou4L32cn/" target=”_blank”>here</a>.</p>
<pre><code class="language-javascript">Highcharts.chart('container', {
series: [{
type: 'coloredline',
data: [{
y: 70,
segmentColor: 'blue'
}, {
y: 20,
segmentColor: 'green'
}, {
y: 40,
segmentColor: 'yellow'
}, {
y: 50,
segmentColor: 'red'
}, {
y: 10,
segmentColor: 'pink'
}]
}]
});
</code></pre>
<h3>Basic usage example with Typescript (React):</h3>
<p>The Live example is available <a href="https://codesandbox.io/p/sandbox/highcharts-multicolor-series-forked-6m6dd9?file=%2Fsrc%2FApp.tsx&workspaceId=e204a32a-9996-4c96-b99d-9fe3d6fc96d0" target=”_blank”>here</a>.</p>
<pre><code class="language-javascript">import * as Highcharts from "highcharts";
import HighchartsReact from "highcharts-react-official";
// Implement the package module.
import MulticolorSeries from "highcharts-multicolor-series";
MulticolorSeries(Highcharts);
// The package allows you to import both `Highcharts.SeriesMulticolorLineOptions` and
// `Highcharts.SeriesMulticolorAreaOptions` interfaces, accordingly to the series.
// Interfaces extend the default series options.
const App = () => {
// Type the chart options.
const options: Highcharts.Options = {
series: [
{
type: "coloredarea",
data: [
{
y: 40,
segmentColor: "red"
},
{
y: 60,
segmentColor: "blue"
},
{
y: 30,
segmentColor: "yellow"
},
{
y: 10,
segmentColor: "green"
},
{
y: 50,
segmentColor: "brown"
},
{
y: 20,
segmentColor: "pink"
},
{
y: 70,
segmentColor: "orange"
}
]
}
]
};
return <HighchartsReact highcharts={Highcharts} options={options} />;
};
export default App;
</code></pre>
</section>
<section>
<h2 id="parameters">Parameters</h2>
<div class="table-container">
<table>
<thead>
<tr>
<th>Property</th>
<th>Type</th>
<th>Required</th>
<th>Defaults</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code class="language-javascript">series.type</code></td>
<td>String</td>
<td>Yes</td>
<td>-</td>
<td>Set it to <code class="language-javascript">coloredline</code> or <code
class="language-javascript">coloredarea</code> to use multicolor series.</td>
</tr>
<tr>
<td><code class="language-javascript">point.segmentColor</code></td>
<td>String</td>
<td>No</td>
<td>-</td>
<td>Controls line color between n and n+1 point, independent from point.color, which changes marker color.</td>
</tr>
</tbody>
</table>
</div>
</section>
<section>
<h2 id="demos">Demos</h2>
<div id="coloredline" class="chart"></div>
<div id="coloredarea" class="chart"></div>
</section>
<section>
<h2 id="tests">Tests</h2>
<p>This package contains tests for the proper elements rendering. To run tests, type:</p>
<pre><code class="language-javascript">npm run test</code></pre>
</section>
<section>
<h2 id="changelog">Changelog</h2>
<p>The changelog is available <a href="https://github.com/blacklabel/multicolor_series/blob/master/CHANGELOG.md" target=”_blank”>here</a>.</p>
</section>
<section>
<h2 id="license">License</h2>
<p>This package is licensed under <a href="https://github.com/blacklabel/multicolor_series/blob/master/license.txt" target="_blank">MIT.</a></p>
<p>The package is built on top of the Highcharts library which requires a commercial license. Non-commercial use may qualify for a free educational or personal license. Read more about licenses <a href="https://shop.highcharts.com/?utm_source=npmjs&utm_medium=referral&utm_campaign=highchartspage&utm_content=licenseinfo">here</a>.</p>
</section>
</main>
<footer>
<div class="container">
<div class="links">
<a href="http://blacklabel.net">
<img class="logo" src="https://blacklabel.net/wp-content/uploads/2023/09/blacklabel_logo_white.png"
alt="Black Label">
</a>
© 2025
<div class="social">
<a class="social-link" href="https://github.com/blacklabel" title="GitHub">
<img class="social-img"
src="https://blacklabel.net/wp-content/themes/website-wordpress/assets/img/github.png" alt="GitHub">
</a>
<a class="social-link" href="https://www.linkedin.com/company/black-label" title="LinkedIn">
<img class="social-img"
src="https://blacklabel.net/wp-content/themes/website-wordpress/assets/img/linkedin.png" alt="LinkedIn">
</a>
</div>
</div>
</div>
</footer>
</body>
</html>