8000 add scatter chart demo · clarkdo/hare@de2dc53 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit de2dc53

Browse files
committed
add scatter chart demo
1 parent 0394195 commit de2dc53

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<script>
2+
import Component from 'class-component'
3+
import { Scatter } from 'vue-chartjs'
4+
5+
@Component
6+
export default class ScatterDemo extends Scatter {
7+
chartData = {
8+
datasets: [{
9+
label: 'Alibaba',
10+
fill: false,
11+
borderColor: '#f87979',
12+
backgroundColor: '#f87979',
13+
data: [{
14+
x: -2,
15+
y: -4
16+
}, {
17+
x: -1,
18+
y: -1
19+
}, {
20+
x: 0,
21+
y: 0
22+
}, {
23+
x: 1,
24+
y: 3
25+
}, {
26+
x: 2,
27+
y: 4
28+
}]
29+
},
30+
{
31+
label: 'Google',
32+
fill: false,
33+
borderColor: '#7acbf9',
34+
backgroundColor: '#7acbf9',
35+
data: [{
36+
x: -2,
37+
y: -4
38+
}, {
39+
x: -1,
40+
y: -3
41+
}, {
42+
x: 0,
43+
y: 1
44+
}, {
45+
x: 1,
46+
y: 1
47+
}, {
48+
x: 2,
49+
y: 6
50+
}]
51+
}]
52+
}
53+
mounted () {
54+
this.renderChart(this.chartData)
55+
}
56+
}
57+
</script>

client/pages/examples/charts.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@
5656
</el-row>
5757
</el-card>
5858
</el-col>
59+
<el-col :span="10">
60+
<el-card>
61+
<div slot="header" class="clearfix">
62+
<span>Scatter Chart</span>
63+
</div>
64+
<el-row>
65+
<scatter-demo :width="3" :height="2"></scatter-demo>
66+
</el-row>
67+
</el-card>
5968
</el-col>
6069
</el-row>
6170
</div>
@@ -68,6 +77,7 @@ import Component from 'class-component'
6877
import BarDemo from '~components/charts/BarDemo'
6978
import PieDemo from '~components/charts/PieDemo'
7079
import LineDemo from '~components/charts/LineDemo'
80+
import ScatterDemo from '~components/charts/ScatterDemo'
7181
import DoughnutDemo from '~components/charts/DoughnutDemo'
7282
import ReactiveDemo from '~components/charts/ReactiveDemo'
7383
@@ -76,6 +86,7 @@ import ReactiveDemo from '~components/charts/ReactiveDemo'
7686
BarDemo,
7787
PieDemo,
7888
LineDemo,
89+
ScatterDemo,
7990
DoughnutDemo,
8091
ReactiveDemo
8192
}

0 commit comments

Comments
 (0)
0