Skip to content

Commit ab74abf

Browse files
committed
chore: update chart.js
1 parent 747a352 commit ab74abf

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

js/chart.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,14 @@ chart.setOption(
9393
name: 'Path',
9494
type: 'line',
9595
data: allPathData,
96-
showSymbol: false,
97-
animation: false,
9896
lineStyle: {
9997
width: autoFontSize(300),
100-
color: 'white'
101-
}
98+
color: "white",
99+
},
100+
showSymbol: false,
101+
animation: false,
102+
xAxisIndex: 0,
103+
yAxisIndex: 0,
102104
},
103105
{
104106
name: 'Ball',
@@ -113,7 +115,7 @@ chart.setOption(
113115
},
114116
itemStyle: {
115117
color: '#58D9F9'
116-
}
118+
},
117119
},
118120
{
119121
data: allAltData,
@@ -220,6 +222,7 @@ chart.setOption(
220222
distance: autoFontSize(100),
221223
color: "#58D9F9",
222224
fontSize: autoFontSize(100),
225+
fontWeight: 'bold',
223226
formatter: function (value) {
224227
return value.toFixed(0);
225228
}
@@ -237,7 +240,7 @@ chart.setOption(
237240
height: 20,
238241
offsetCenter: [
239242
0,
240-
"-20%"
243+
"-25%"
241244
],
242245
valueAnimation: true,
243246
fontSize: autoFontSize(50),
@@ -257,7 +260,7 @@ chart.setOption(
257260
{
258261
type: 'gauge',
259262
center: ['50%', '90%'],
260-
radius: "25%",
263+
radius: "20%",
261264
startAngle: 200,
262265
endAngle: -20,
263266
min: 0,
@@ -297,8 +300,8 @@ chart.setOption(
297300
axisLabel: {
298301
distance: -autoFontSize(48),
299302
color: '#58D9F9',
300-
fontWeight: 'bold',
301303
fontSize: autoFontSize(75),
304+
fontWeight: 'bold',
302305
formatter: function (value) {
303306
return value.toFixed(0);
304307
}

tests/echats_path_demo.html

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
const allAltData = data.map(item => [item.t, item.a]);
5454

5555
const echartContainer = document.getElementById('my-chart');
56+
let chartHeight = echartContainer.offsetHeight;
5657
const myChart = echarts.init(echartContainer, null, {renderer: 'svg'});
5758

5859
function autoFontSize(scale) {
@@ -250,6 +251,7 @@
250251
distance: autoFontSize(100),
251252
color: "#58D9F9",
252253
fontSize: autoFontSize(100),
254+
fontWeight: 'bold',
253255
formatter: function (value) {
254256
return value.toFixed(0);
255257
}
@@ -359,7 +361,7 @@
359361
{
360362
type: 'text',
361363
left: '15px',
362-
top: echartContainer.offsetHeight / 2 - autoFontSize(24) - autoFontSize(75),
364+
top: chartHeight / 2 - autoFontSize(24) - autoFontSize(75),
363365
style: {
364366
text: 'BPM',
365367
fill: 'rgba(255,255,255,0.8)',
@@ -372,7 +374,7 @@
372374
{
373375
type: 'text',
374376
left: '10px',
375-
top: echartContainer.offsetHeight / 2 - autoFontSize(24),
377+
top: chartHeight / 2 - autoFontSize(24),
376378
style: {
377379
text: '0',
378380
fill: 'rgba(255,255,255)',
@@ -381,11 +383,10 @@
381383
textVerticalAlign: 'middle'
382384
}
383385
},
384-
385386
{
386387
type: 'text',
387388
left: '15px',
388-
top: echartContainer.offsetHeight / 2 + autoFontSize(24) - autoFontSize(75),
389+
top: chartHeight / 2 + autoFontSize(24) - autoFontSize(75),
389390
style: {
390391
text: 'RPM',
391392
fill: 'rgba(255,255,255,0.8)',
@@ -398,7 +399,7 @@
398399
{
399400
type: 'text',
400401
left: '10px',
401-
top: echartContainer.offsetHeight / 2 + autoFontSize(24),
402+
top: chartHeight / 2 + autoFontSize(24),
402403
style: {
403404
text: '0',
404405
fill: 'rgba(255,255,255)',
@@ -410,7 +411,7 @@
410411
{
411412
type: 'text',
412413
left: autoFontSize(48) + 'px',
413-
top: echartContainer.offsetHeight - autoFontSize(32) - echartContainer.offsetHeight / 16,
414+
top: chartHeight - autoFontSize(32) - chartHeight / 16,
414415
style: {
415416
text: '-49.99%',
416417
fill: 'rgba(255,255,255)',

0 commit comments

Comments
 (0)