Skip to content

Commit 69f3763

Browse files
author
Adrian Hurtado
committed
WIP in Axes
1 parent 8d42a04 commit 69f3763

File tree

15 files changed

+758
-225
lines changed

15 files changed

+758
-225
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = {
1212
'import/prefer-default-export': 'off',
1313
'vue/attribute-hyphenation': [
1414
2, 'never', {
15-
ignore: ['stroke-width', 'font-size', 'text-anchor', 'stroke-dasharray', 'stop-color', 'stop-opacity', 'foreignObject'],
15+
ignore: ['stroke-width', 'font-size', 'text-anchor', 'alignment-baseline', 'stroke-dasharray', 'stop-color', 'stop-opacity', 'foreignObject'],
1616
},
1717
],
1818
'vue/html-closing-bracket-newline': [

docs/.vuepress/components/Examples/Refactor/Tests.vue

Lines changed: 74 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,75 @@
11
<template>
22
<div>
33
<WCartesian2
4-
:dataset="dataset"
4+
:dataset="dataset2"
55
responsive
66
:padding="chartPadding"
77
>
88
<WLine2
9-
datakeyY="seatTime"
9+
yAxisId="time"
10+
yDatakey="time"
11+
color="#f55"
12+
/>
13+
<WLine2
14+
yAxisId="performance"
15+
yDatakey="tiresPerformance"
16+
color="#55f"
17+
/>
18+
<!-- <WLine
19+
series="chevrolet"
20+
xDatakey="timestamp"
21+
yDatakey="speed"
22+
/> -->
23+
<WXAxis2 type="categorical" datakey="lap" position="bottom" />
24+
<WYAxis2
25+
id="time"
26+
position="left"
27+
:numTicks="4"
28+
:domain2="[0, n => n]"
29+
:axisStyles="{
30+
stroke: '#b88'
31+
}"
32+
/>
33+
<WYAxis2
34+
id="performance"
35+
position="right"
36+
:numTicks="4"
37+
:domain2="[0]"
38+
:tickFormatter2="xTickFormatter"
39+
:axisStyles="{
40+
stroke: '#88b'
41+
}"
42+
/>
43+
</WCartesian2>
44+
45+
<WCartesian2
46+
:dataset="dataseries2"
47+
responsive
48+
:padding="chartPadding"
49+
>
50+
<WLine2
51+
series="seat"
52+
xDatakey="lap"
53+
yDatakey="time"
54+
color="#f55"
55+
/>
56+
<WLine2
57+
series="chevrolet"
58+
xDatakey="num"
59+
yDatakey="totalTime"
60+
color="#55f"
1061
/>
1162
<!-- <WLine
1263
series="chevrolet"
13-
datakeyY="speed"
14-
datakeyX="timestamp"
64+
xDatakey="timestamp"
65+
yDatakey="speed"
1566
/> -->
16-
<WXAxis2 datakey="lap" />
17-
<WYAxis2 />
67+
<WXAxis2 type="categorical" position="bottom" />
68+
<WYAxis2
69+
position="left"
70+
:numTicks="4"
71+
:domain2="[0, n => n]"
72+
/>
1873
</WCartesian2>
1974
</div>
2075
</template>
@@ -33,6 +88,13 @@ export default {
3388
{ lap: 'Lap 4', seatTime: 39, chevroletTime: 32 },
3489
{ lap: 'Lap 5', seatTime: 37, chevroletTime: 33 },
3590
],
91+
dataset2: [
92+
{ lap: 'Lap 1', time: 37, tiresPerformance: 90 },
93+
{ lap: 'Lap 2', time: 38, tiresPerformance: 85 },
94+
{ lap: 'Lap 3', time: 36, tiresPerformance: 83 },
95+
{ lap: 'Lap 4', time: 38, tiresPerformance: 79 },
96+
{ lap: 'Lap 5', time: 39, tiresPerformance: 72 },
97+
],
3698
dataseries1: {
3799
seat: [
38100
{ lap: 'Lap 1', time: 37 },
@@ -55,10 +117,8 @@ export default {
55117
{ lap: 'Lap 2', time: 38 },
56118
{ lap: 'Lap 3', time: 36 },
57119
{ lap: 'Lap 4', time: 39 },
58-
{ lap: 'Lap 5', time: 37 },
59120
],
60121
chevrolet: [
61-
{ num: 'Lap 1', totalTime: 32 },
62122
{ num: 'Lap 2', totalTime: 33 },
63123
{ num: 'Lap 3', totalTime: 31 },
64124
{ num: 'Lap 4', totalTime: 32 },
@@ -71,6 +131,11 @@ export default {
71131
// setTimeout(() => {
72132
// this.chartPadding = 0
73133
// }, 2000)
74-
}
134+
},
135+
methods: {
136+
xTickFormatter (value, index) {
137+
return index % 2 === 0 ? value : null
138+
}
139+
},
75140
}
76141
</script>

0 commit comments

Comments
 (0)