no message
Former-commit-id: f5c40fc8075c0213f9b67dde351a24b326ded340 Former-commit-id: 49e4b22d84089c1e4097bc24c9b2a8933747cea6 Former-commit-id: e6bb925b422085bc03275d7f51d6dada2b87e6d0
This commit is contained in:
35
src/components/charts/G2/components/NightingaleRose/base.vue
Normal file
35
src/components/charts/G2/components/NightingaleRose/base.vue
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 如果需要开启自动高度功能 需要在这里设置 style="height: 100%;" -->
|
||||||
|
<div ref="chart" style="height: 100%;"></div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import G2 from '@/components/charts/G2/mixins/G2.js'
|
||||||
|
export default {
|
||||||
|
mixins: [
|
||||||
|
G2
|
||||||
|
],
|
||||||
|
methods: {
|
||||||
|
// 初始化图表
|
||||||
|
init () {
|
||||||
|
// mixin 中提供 creatChart
|
||||||
|
this.creatChart()
|
||||||
|
// 本组件的特殊设置
|
||||||
|
this.chart.source(this.data)
|
||||||
|
this.chart.axis('x', {
|
||||||
|
label: {
|
||||||
|
offset: 12
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.chart.coord().transpose()
|
||||||
|
this.chart.interval().position('x*y')
|
||||||
|
// 渲染图表
|
||||||
|
this.chart.render()
|
||||||
|
},
|
||||||
|
// 数据源改变 重新渲染新的数据
|
||||||
|
changeData () {
|
||||||
|
this.chart.changeData(this.data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -14,7 +14,7 @@ export default {
|
|||||||
// 设置图表的内边距 http://antv.alipay.com/zh-cn/g2/3.x/api/chart.html#_padding
|
// 设置图表的内边距 http://antv.alipay.com/zh-cn/g2/3.x/api/chart.html#_padding
|
||||||
padding: {
|
padding: {
|
||||||
required: false,
|
required: false,
|
||||||
default: () => [40, 40, 40, 40]
|
default: () => [30, 40, 50, 50]
|
||||||
},
|
},
|
||||||
// 设置图表整体的边框和背景样式 http://antv.alipay.com/zh-cn/g2/3.x/api/chart.html#_background
|
// 设置图表整体的边框和背景样式 http://antv.alipay.com/zh-cn/g2/3.x/api/chart.html#_background
|
||||||
background: {
|
background: {
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
|
||||||
|
Vue.component('G2BarBase', resolve => { require(['@/components/charts/G2/components/Bar/base.vue'], resolve) })
|
||||||
|
|
||||||
|
Vue.component('G2ColumnBase', resolve => { require(['@/components/charts/G2/components/Column/base.vue'], resolve) })
|
||||||
|
|
||||||
Vue.component('G2LineBase', resolve => { require(['@/components/charts/G2/components/Line/base.vue'], resolve) })
|
Vue.component('G2LineBase', resolve => { require(['@/components/charts/G2/components/Line/base.vue'], resolve) })
|
||||||
Vue.component('G2LineStep', resolve => { require(['@/components/charts/G2/components/Line/step.vue'], resolve) })
|
Vue.component('G2LineStep', resolve => { require(['@/components/charts/G2/components/Line/step.vue'], resolve) })
|
||||||
|
|
||||||
Vue.component('G2ColumnBase', resolve => { require(['@/components/charts/G2/components/Column/base.vue'], resolve) })
|
Vue.component('G2NightingaleRoseBase', resolve => { require(['@/components/charts/G2/components/NightingaleRose/base.vue'], resolve) })
|
||||||
|
|
||||||
Vue.component('G2BarBase', resolve => { require(['@/components/charts/G2/components/Bar/base.vue'], resolve) })
|
|
||||||
|
|
||||||
Vue.component('G2PieBase', resolve => { require(['@/components/charts/G2/components/Pie/base.vue'], resolve) })
|
Vue.component('G2PieBase', resolve => { require(['@/components/charts/G2/components/Pie/base.vue'], resolve) })
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
// 核心组件
|
// 核心组件
|
||||||
import './core'
|
import './core/register'
|
||||||
// 非核心组件 只是在很多演示页面中用到的组件
|
// 非核心组件 只是在很多演示页面中用到的组件
|
||||||
import './demo'
|
import './demo/register'
|
||||||
// 图表组件
|
// 图表组件
|
||||||
import './charts'
|
import './charts/register'
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
<GridItem v-bind="layout.layout[5]" @resized="handleResized(chart[5].refName)">
|
<GridItem v-bind="layout.layout[5]" @resized="handleResized(chart[5].refName)">
|
||||||
<el-card class="header-in">
|
<el-card class="header-in">
|
||||||
<ChartCardHeader slot="header" @refresh="handleRefreshData(5)" title="近年行情"></ChartCardHeader>
|
<ChartCardHeader slot="header" @refresh="handleRefreshData(5)" title="近年行情"></ChartCardHeader>
|
||||||
|
<G2NightingaleRoseBase :ref="chart[5].refName" v-bind="chart[5]"></G2NightingaleRoseBase>
|
||||||
</el-card>
|
</el-card>
|
||||||
</GridItem>
|
</GridItem>
|
||||||
</GridLayout>
|
</GridLayout>
|
||||||
@@ -59,32 +59,34 @@ export default {
|
|||||||
{
|
{
|
||||||
api: {url: '/api/chart/G2Line', data: {type: 'base'}},
|
api: {url: '/api/chart/G2Line', data: {type: 'base'}},
|
||||||
refName: 'G2LineBase',
|
refName: 'G2LineBase',
|
||||||
data: [],
|
data: []
|
||||||
padding: [30, 40, 50, 50]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
api: {url: '/api/chart/G2Line', data: {type: 'step'}},
|
api: {url: '/api/chart/G2Line', data: {type: 'step'}},
|
||||||
refName: 'G2LineStep',
|
refName: 'G2LineStep',
|
||||||
data: [],
|
data: []
|
||||||
padding: [30, 40, 50, 50]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
api: {url: '/api/chart/G2Column', data: {type: 'base'}},
|
api: {url: '/api/chart/G2Column', data: {type: 'base'}},
|
||||||
refName: 'G2ColumnBase',
|
refName: 'G2ColumnBase',
|
||||||
data: [],
|
data: []
|
||||||
padding: [30, 40, 50, 50]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
api: {url: '/api/chart/G2Bar', data: {type: 'base'}},
|
api: {url: '/api/chart/G2Bar', data: {type: 'base'}},
|
||||||
refName: 'G2BarBase',
|
refName: 'G2BarBase',
|
||||||
data: [],
|
data: []
|
||||||
padding: [30, 40, 50, 50]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
api: {url: '/api/chart/G2Pie', data: {type: 'base'}},
|
api: {url: '/api/chart/G2Pie', data: {type: 'base'}},
|
||||||
refName: 'G2PieBase',
|
refName: 'G2PieBase',
|
||||||
data: [],
|
data: [],
|
||||||
padding: [30, 30, 30, 30]
|
padding: [30, 30, 30, 30]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
api: {url: '/api/chart/G2NightingaleRose', data: {type: 'base'}},
|
||||||
|
refName: 'G2NightingaleRoseBase',
|
||||||
|
data: [],
|
||||||
|
padding: [30, 30, 30, 30]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
layout: {
|
layout: {
|
||||||
|
|||||||
Reference in New Issue
Block a user