This commit is contained in:
Jane
2023-12-22 12:18:52 +08:00
parent 340f82a67e
commit 812109656a
746 changed files with 84928 additions and 0 deletions

View File

@@ -0,0 +1,639 @@
<template>
<div class="chart-container">
<div class="widget-left-container">
<div class="widget-left-header">
<span>数据集</span>
<el-dropdown trigger="click" style="float: right; color: #499df3;" @command="handleCommand">
<span class="el-dropdown-link">
切换<i class="el-icon-arrow-down el-icon--right" />
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item v-for="item in dataSetOptions" :key="item.id" :command="item.id">{{ item.setName }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<div class="widget-left-field">
<div class="widget-left-field-cate"><i class="icon iconfont icon-weidu" /><span>维度列</span></div>
<draggable v-model="dimensions" class="widget-left-field-draggable" :options="{sort: false, ghostClass: 'ghost', group: {name: 'dimensions', pull: true, put: false}}">
<el-tag v-for="(item, index) in dimensions" :key="index" class="draggable-label"><div>{{ item.alias ? item.alias + '(' + item.col + ')' : item.col }}</div></el-tag>
</draggable>
</div>
<div class="widget-left-field">
<div class="widget-left-field-cate"><i class="icon iconfont icon-zhibiao" /><span>指标列</span></div>
<draggable v-model="measures" class="widget-left-field-draggable" :options="{sort: false, ghostClass: 'ghost', group: {name: 'measures', pull: true, put: false}}">
<el-tag v-for="(item, index) in measures" :key="index" class="draggable-label"><div>{{ item.alias ? item.alias + '(' + item.col + ')' : item.col }}</div></el-tag>
</draggable>
</div>
</div>
<div class="widget-center-container">
<div class="widget-center-header">
<div class="widget-center-header-collapse" @click="handleCollapse"><i :class="{'is-active': isCollapse}" class="el-icon-d-arrow-right" /></div>
<div class="widget-center-header-button">
<el-button icon="el-icon-view" type="text" @click="handlePreview">
预览
</el-button>
<el-button icon="el-icon-delete" type="text" @click="handleReset">
重置
</el-button>
<el-button v-hasPerm="['visual:chart:build']" icon="el-icon-plus" type="text" @click="handleSubmit">
保存
</el-button>
<el-button icon="el-icon-close" type="text" @click="handleCancel">
取消
</el-button>
</div>
</div>
<div class="widget-center-content">
<div class="widget-center-draggable-wrapper">
<el-divider content-position="left">行维</el-divider>
<div class="widget-center-draggable-text">
<draggable group="dimensions" :list="widget.rows" class="widget-center-draggable-line">
<el-tag v-for="(item, index) in widget.rows" :key="index" class="draggable-item" closable @close="handleKeyTagClose(index, item)">
{{ item.alias ? item.alias + '(' + item.col + ')' : item.col }}
</el-tag>
</draggable>
</div>
<el-divider content-position="left">列维</el-divider>
<div class="widget-center-draggable-text">
<draggable group="dimensions" :list="widget.columns" class="widget-center-draggable-line">
<el-tag v-for="(item, index) in widget.columns" :key="index" class="draggable-item" closable @close="handleGroupTagClose(index, item)">
{{ item.alias ? item.alias + '(' + item.col + ')' : item.col }}
</el-tag>
</draggable>
</div>
<el-divider content-position="left">指标</el-divider>
<div class="widget-center-draggable-text">
<draggable group="measures" :list="widget.measures" class="widget-center-draggable-line" @change="handleValueDragChange">
<div v-for="(item, index) in widget.measures" :key="index" class="draggable-item">
<el-tag>{{ item.alias ? item.aggregateType + '(' + item.col + ') -> ' + item.alias : item.aggregateType + '(' + item.col + ')' }}</el-tag>
<el-popover
placement="top"
width="400"
trigger="click"
>
<el-radio-group v-model="item.aggregateType" size="mini">
<el-radio label="sum" size="mini">求和</el-radio>
<el-radio label="count" size="mini">计数</el-radio>
<el-radio label="avg" size="mini">平均值</el-radio>
<el-radio label="max" size="mini">最大值</el-radio>
<el-radio label="min" size="mini">最小值</el-radio>
</el-radio-group>
<span slot="reference" class="draggable-item-handle"><i class="el-icon-edit-outline" /></span>
</el-popover>
<span class="draggable-item-handle" @click="handleValueTagClose(index, item)"><i class="el-icon-delete" /></span>
</div>
</draggable>
</div>
</div>
<div class="widget-center-pane">
<el-tabs type="card">
<el-tab-pane label="图表预览">
<div class="widget-center-pane-chart">
<chart-panel v-if="visible" id="chartPanel" ref="chartPanel" :chart-schema="widget" :chart-data="chartData.data" />
</div>
</el-tab-pane>
<el-tab-pane label="查询脚本">
<div class="widget-center-pane-script">{{ chartData.sql }}</div>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
<div class="widget-right-container" :class="{hideRightContainer: isCollapse}">
<el-tabs type="border-card" stretch class="widget-right-tab">
<el-tab-pane label="图表属性">
<div class="widget-right-pane-form">
<el-form size="mini" label-position="top">
<el-form-item label="图表名称">
<el-input v-model="dataChart.chartName" :disabled="true" />
</el-form-item>
<el-form-item label="缩略图">
<el-upload
action="#"
accept=".png, .jpg, .jpeg"
list-type="picture-card"
:limit="1"
:auto-upload="false"
:before-upload="beforeUpload"
:on-change="handleChange"
:on-remove="handleRemove"
:file-list="fileList"
:class="{ hideUpload: hideUpload }"
>
<i slot="default" class="el-icon-plus" />
</el-upload>
</el-form-item>
<el-form-item label="图表类型">
<div class="chart-type-list">
<span v-for="item in chartTypes" :key="item.value" :class="item.value === widget.chartType ? 'active': ''" @click="item.status && item.rule.check(widget.rows, widget.columns, widget.measures) && changeChart(item.value)">
<el-tooltip :content="item.name + ':' + item.rule.text" placement="top">
<svg-icon class="icon" :icon-class="item.icon + (item.status && item.rule.check(widget.rows, widget.columns, widget.measures) ? '_active': '')" />
</el-tooltip>
</span>
</div>
</el-form-item>
</el-form>
</div>
</el-tab-pane>
<el-tab-pane label="图表配置">
<div class="widget-right-pane-config">
<el-collapse v-model="collapsActiveNames" accordion>
<el-collapse-item title="图表主题" name="1">
<el-form size="mini">
<el-form-item>
<el-select v-model="widget.theme">
<el-option
v-for="(theme, index) in chartThemes"
:key="index"
:label="theme"
:value="theme"
/>
</el-select>
</el-form-item>
</el-form>
</el-collapse-item>
<el-collapse-item title="标题组件" name="2">
<el-form size="mini">
<el-form-item label="是否显示">
<el-switch v-model="widget.options.title.show" active-text="开启" />
</el-form-item>
<el-form-item label="主标题文本">
<el-input v-model="widget.options.title.text" />
</el-form-item>
<el-form-item label="副标题文本">
<el-input v-model="widget.options.title.subtext" />
</el-form-item>
<el-form-item label="离左侧的距离">
<el-slider v-model="widget.options.title.leftVal" @change="widget.options.title.left = widget.options.title.leftVal + '%'" />
</el-form-item>
<el-form-item label="离上侧的距离">
<el-slider v-model="widget.options.title.topVal" @change="widget.options.title.top = widget.options.title.topVal + '%'" />
</el-form-item>
<el-form-item label="主标题字体大小">
<el-input-number v-model="widget.options.title.textStyle.fontSize" :min="1" :max="30" />
</el-form-item>
<el-form-item label="主标题文字的颜色">
<el-color-picker v-model="widget.options.title.textStyle.color" />
</el-form-item>
<el-form-item label="副标题字体大小">
<el-input-number v-model="widget.options.title.subtextStyle.fontSize" :min="1" :max="20" />
</el-form-item>
<el-form-item label="副标题文字的颜色">
<el-color-picker v-model="widget.options.title.subtextStyle.color" />
</el-form-item>
</el-form>
</el-collapse-item>
<el-collapse-item title="图例组件" name="3">
<el-form size="mini">
<el-form-item label="是否显示">
<el-switch v-model="widget.options.legend.show" active-text="开启" />
</el-form-item>
<el-form-item label="图例的类型">
<el-select v-model="widget.options.legend.type">
<el-option label="普通图例" value="plain" />
<el-option label="可滚动翻页的图例" value="scroll" />
</el-select>
</el-form-item>
<el-form-item label="离左侧的距离">
<el-slider v-model="widget.options.legend.leftVal" @change="widget.options.legend.left = widget.options.legend.leftVal + '%'" />
</el-form-item>
<el-form-item label="离上侧的距离">
<el-slider v-model="widget.options.legend.topVal" @change="widget.options.legend.top = widget.options.legend.topVal + '%'" />
</el-form-item>
<el-form-item label="列表的布局朝向">
<el-select v-model="widget.options.legend.orient">
<el-option label="横向" value="horizontal" />
<el-option label="纵向" value="vertical" />
</el-select>
</el-form-item>
</el-form>
</el-collapse-item>
<el-collapse-item title="数据系列" name="4">
<el-form size="mini">
<el-form-item>
<el-select v-model="widget.seriesType">
<el-option
v-for="(item, index) in chartSeriesTypes[widget.chartType]"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-form>
</el-collapse-item>
</el-collapse>
</div>
</el-tab-pane>
</el-tabs>
</div>
</div>
</template>
<script>
import { getDataChart, buildDataChart, dataParser } from '@/api/visual/datachart'
import { getDataSet, listDataSet } from '@/api/visual/dataset'
import draggable from 'vuedraggable'
import { chartTypes, chartThemes, chartSeriesTypes, chartOptions } from '@/utils/visual-chart'
import ChartPanel from './components/ChartPanel'
import { compressImg, dataURLtoBlob } from '@/utils/compressImage'
export default {
name: 'DataChartBuild',
components: {
draggable,
ChartPanel
},
data() {
return {
dataChart: {},
widget: {
dataSetId: undefined,
chartType: 'table',
rows: [],
columns: [],
measures: [],
// 过滤条件
filters: [],
// 图表配置项
options: chartOptions,
// 图表主题
theme: 'default',
// 系列类型
seriesType: undefined
},
dataSetOptions: [],
dataSet: {},
dimensions: [],
measures: [],
chartTypes,
chartThemes,
chartSeriesTypes,
chartData: {
data: [],
sql: ''
},
visible: false,
isCollapse: false,
collapsActiveNames: '1',
// 文件上传
fileList: [],
hideUpload: false
}
},
created() {
this.getDataChart(this.$route.params.id)
this.getDataSetList()
},
methods: {
getDataChart(id) {
getDataChart(id).then(response => {
if (response.success) {
this.dataChart = response.data
if (this.dataChart.chartThumbnail) {
const blob = dataURLtoBlob(this.dataChart.chartThumbnail)
const fileUrl = URL.createObjectURL(blob)
this.fileList.push({ url: fileUrl })
this.hideUpload = true
}
if (this.dataChart.chartConfig) {
const chartConfig = JSON.parse(this.dataChart.chartConfig)
getDataSet(chartConfig.dataSetId).then(response => {
if (response.success) {
this.dataSet = response.data
this.dimensions = this.dataSet.schemaConfig.dimensions.filter(x => [...chartConfig.rows, ...chartConfig.columns].every(y => y.col !== x.col))
this.measures = this.dataSet.schemaConfig.measures.filter(x => chartConfig.measures.every(y => y.col !== x.col))
}
})
this.widget.dataSetId = chartConfig.dataSetId
this.widget.chartType = chartConfig.chartType
this.widget.rows = chartConfig.rows || []
this.widget.columns = chartConfig.columns || []
this.widget.measures = chartConfig.measures || []
}
}
})
},
getDataSetList() {
listDataSet().then(response => {
if (response.success) {
this.dataSetOptions = response.data
}
})
},
handleCommand(id) {
getDataSet(id).then(response => {
if (response.success) {
this.dataSet = response.data
this.widget.dataSetId = this.dataSet.id
this.handleReset()
}
})
},
handleKeyTagClose(index, tag) {
this.widget.rows.splice(index, 1)
this.dimensions.push(tag)
},
handleGroupTagClose(index, tag) {
this.widget.columns.splice(index, 1)
this.dimensions.push(tag)
},
handleValueDragChange(tag) {
if (tag.added) {
this.$set(tag.added.element, 'aggregateType', 'sum')
}
},
handleValueTagClose(index, tag) {
this.widget.measures.splice(index, 1)
tag.aggregateType = ''
this.measures.push(tag)
},
handleCollapse() {
this.isCollapse = !this.isCollapse
},
handlePreview() {
dataParser(this.widget).then(response => {
if (response.success) {
const { data } = response
this.chartData.data = data.data
this.chartData.sql = data.sql
this.visible = true
}
})
},
handleReset() {
this.dimensions = JSON.parse(JSON.stringify(this.dataSet.schemaConfig.dimensions))
this.measures = JSON.parse(JSON.stringify(this.dataSet.schemaConfig.measures))
this.widget.chartType = 'table'
this.widget.rows = []
this.widget.columns = []
this.widget.measures = []
this.chartData.data = []
this.chartData.sql = ''
this.visible = false
},
handleSubmit() {
const data = {
id: this.dataChart.id,
chartThumbnail: this.dataChart.chartThumbnail,
chartConfig: JSON.stringify(this.widget)
}
buildDataChart(data).then(response => {
if (response.success) {
this.$message.success('保存成功')
}
})
},
handleCancel() {
window.location.href = 'about:blank'
window.close()
},
changeChart(chart) {
this.widget.chartType = chart
this.widget.seriesType = ((this.chartSeriesTypes[this.widget.chartType] || [])[0] || {}).value || undefined
},
beforeUpload(file) {
const isLt2M = file.size / 1024 / 1024 < 2
if (!isLt2M) {
this.$message.error('上传图片大小不能超过 2MB')
}
return isLt2M
},
handleChange(file, fileList) {
this.hideUpload = fileList.length >= 1
const config = {
width: 250, // 压缩后图片的宽
height: 150, // 压缩后图片的高
quality: 0.8 // 压缩后图片的清晰度取值0-1值越小所绘制出的图像越模糊
}
compressImg(file.raw, config).then(result => {
// result 为压缩后二进制文件
this.$set(this.dataChart, 'chartThumbnail', result)
})
},
handleRemove(file, fileList) {
this.hideUpload = fileList.length >= 1
this.$set(this.dataChart, 'chartThumbnail', 'x')
}
}
}
</script>
<style lang="scss" scoped>
.chart-container {
height: 100vh;
width: 100%;
margin: 0;
padding: 0;
overflow: hidden;
display: flex;
flex-direction: row;
flex: 1;
flex-basis: auto;
box-sizing: border-box;
min-width: 0;
::-webkit-scrollbar {
width: 3px;
height: 5px;
}
::-webkit-scrollbar-track-piece {
background: #d3dce6;
}
::-webkit-scrollbar-thumb {
background: #99a9bf;
border-radius: 10px;
}
.widget-left-container {
width: 250px;
box-sizing: border-box;
.widget-left-header {
height: 40px;
line-height: 40px;
padding: 0 20px;
.el-dropdown {
cursor: pointer;
}
}
.widget-left-field {
height: 250px;
.widget-left-field-cate {
height: 40px;
line-height: 40px;
text-align: center;
border-top: 1px solid #e4e7ed;
border-bottom: 1px solid #e4e7ed;
i {
margin-right: 5px;
}
}
.widget-left-field-draggable {
height: calc(100% - 40px);
padding: 20px;
overflow-x: hidden;
overflow-y: auto;
.draggable-label {
font-size: 12px;
display: block;
width: 90px;
position: relative;
float: left;
left: 0;
margin: 5px;
color: #333;
border: 1px solid #F4F6FC;
&:hover {
color: #409EFF;
border: 1px dashed #409EFF;
}
& > div {
display: block;
cursor: move;
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
}
}
.widget-center-container {
width: calc(100% - 550px);
flex: 1;
flex-basis: auto;
box-sizing: border-box;
border-left: 1px solid #e4e7ed;
border-right: 1px solid #e4e7ed;
.widget-center-header {
height: 40px;
line-height: 40px;
border-bottom: 1px solid #e4e7ed;
.widget-center-header-collapse {
float: right;
background-color: #f0f8ff;
.is-active {
transform: rotate(180deg);
}
}
.widget-center-header-button {
text-align: right;
padding-right: 20px;
float: right;
}
}
.widget-center-content {
height: 100%;
.widget-center-draggable-wrapper {
height: 266px;
padding: 0 20px;
border-bottom: 1px solid #e4e7ed;
.widget-center-draggable-text {
min-height: 40px;
height: auto;
line-height: 40px;
border: 1px solid #d7dae2;
background: #f4f4f7;
overflow-x: auto;
overflow-y: hidden;
width: 100%;
white-space: nowrap;
.widget-center-draggable-line {
min-height: 40px;
height: 40px;
.draggable-item {
margin: 0 5px;
display: inline-block;
border: 1px solid #ebecef;
border-radius: 4px;
.draggable-item-handle {
background-color: #ecf5ff;
border-color: #d9ecff;
display: inline-block;
padding: 0 10px;
line-height: 30px;
font-size: 12px;
color: #409EFF;
border-width: 1px;
border-style: solid;
box-sizing: border-box;
white-space: nowrap;
cursor: pointer;
}
}
}
}
}
.widget-center-pane {
height: calc(100% - 266px);
.widget-center-pane-chart {
height: 200px;
padding: 0 20px;
overflow-x: hidden;
overflow-y: auto;
}
.widget-center-pane-script {
height: 200px;
padding: 0 20px;
overflow-x: hidden;
overflow-y: auto;
}
}
}
}
.widget-right-container {
width: 300px;
box-sizing: border-box;
// 折叠
&.hideRightContainer{
width: 0px;
}
.widget-right-pane-form {
height: calc(100vh - 40px);
overflow-x: hidden;
overflow-y: auto;
.hideUpload ::v-deep {
.el-upload--picture-card {
display: none;
}
}
::v-deep {
.el-upload-list__item {
width: 250px;
height: 150px;
}
}
.chart-type-list {
width: 100%;
display: grid;
justify-items: center;
align-content: center;
grid-template-columns: repeat(5, 40px);
grid-template-rows: repeat(4, 40px);
grid-gap: 10px;
span {
height: 40px;
width: 40px;
line-height: 40px;
font-size: 25px;
cursor: pointer;
text-align: center;
}
.active {
box-shadow: 0 0 0 2px rgba(81, 130, 227, .06), inset 0 0 0 2px rgba(81, 129, 228, .6);
}
}
}
.widget-right-pane-config {
height: calc(100vh - 40px);
overflow-x: hidden;
overflow-y: auto;
.el-form-item__content {
.el-slider {
padding: 0 10px;
margin-top: 20px;
}
}
}
}
}
</style>

View File

@@ -0,0 +1,227 @@
<template>
<div class="chart-container">
<el-row>
<el-col>
<el-pagination
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper"
:current-page.sync="queryParams.pageNum"
:page-size.sync="queryParams.pageSize"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</el-col>
</el-row>
<el-divider />
<el-row :gutter="20">
<el-col v-hasPerm="['visual:chart:add']" class="box-card-col">
<el-card :body-style="{ padding: '0px' }" class="box-card-item">
<div class="box-card-item-add" @click="handleAdd">
<div class="icon-block">
<i class="el-icon-plus" />
</div>
</div>
</el-card>
</el-col>
<el-col v-for="(item, index) in tableDataList" :key="item.id" class="box-card-col">
<el-card :body-style="{ padding: '0px' }" class="box-card-item">
<div class="box-card-item-body" @mouseenter="mouseEnter(item)" @mouseleave="mouseLeave(item)">
<el-image :src="item.chartThumbnail ? item.chartThumbnail : ''">
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline" />
</div>
</el-image>
<div class="box-card-item-edit" :style="{display: (item.show ? 'block' : 'none')}">
<el-button v-hasPerm="['visual:chart:build']" type="primary" @click="handleConfig(item)">编辑</el-button>
</div>
</div>
<div class="box-card-item-footer">
<span class="box-card-item-footer-text">{{ item.chartName }}</span>
<div class="clearfix">
<i v-hasPerm="['visual:chart:edit']" class="el-icon-edit-outline" @click="handleEdit(item)" />
<i v-hasPerm="['visual:chart:remove']" class="el-icon-delete" @click="handleDelete(item)" />
<i v-hasPerm="['visual:chart:copy']" class="el-icon-copy-document" @click="handleCopy(item)" />
</div>
</div>
</el-card>
</el-col>
</el-row>
<chart-form v-if="dialogFormVisible" :visible.sync="dialogFormVisible" :data="currentChart" @handleChartFormFinished="getList" />
</div>
</template>
<script>
import { pageDataChart, delDataChart, copyDataChart } from '@/api/visual/datachart'
import ChartForm from './components/ChartForm'
export default {
name: 'DataChartList',
components: { ChartForm },
data() {
return {
// 表格数据
tableDataList: [],
// 总数据条数
total: 0,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10
},
dialogFormVisible: false,
currentChart: {}
}
},
created() {
this.getList()
},
methods: {
/** 查询数据列表 */
getList() {
pageDataChart(this.queryParams).then(response => {
if (response.success) {
const { data } = response
this.tableDataList = data.data
this.total = data.total
}
})
},
handleSizeChange(val) {
console.log(`每页 ${val}`)
this.queryParams.pageNum = 1
this.queryParams.pageSize = val
this.getList()
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`)
this.queryParams.pageNum = val
this.getList()
},
mouseEnter(data) {
this.$set(data, 'show', true)
},
mouseLeave(data) {
this.$set(data, 'show', false)
},
handleAdd() {
this.dialogFormVisible = true
this.currentChart = {}
},
handleConfig(data) {
const route = this.$router.resolve({ path: `/visual/chart/build/${data.id}` })
window.open(route.href, '_blank')
},
handleEdit(data) {
this.dialogFormVisible = true
this.currentChart = Object.assign({}, data)
},
handleDelete(data) {
this.$confirm('选中数据将被永久删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delDataChart(data.id).then(response => {
if (response.success) {
this.$message.success('删除成功')
this.getList()
}
})
}).catch(() => {
})
},
handleCopy(data) {
this.$confirm('确认拷贝当前图表, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
copyDataChart(data.id).then(response => {
if (response.success) {
this.$message.success('拷贝成功')
this.getList()
}
})
}).catch(() => {
})
}
}
}
</script>
<style lang="scss" scoped>
.el-pagination {
text-align: center;
}
.box-card-col {
width: 260px;
height: 185px;
padding-left: 0px;
padding-right: 0px;
margin-right: 10px;
margin-bottom: 10px;
.box-card-item {
width: 260px;
height: 185px;
.box-card-item-body {
display: flex;
justify-content: center;
align-items: center;
.box-card-item-edit {
width: 260px;
height: 150px;
text-align: center;
position: absolute;
background: rgba(4, 11, 28, 0.7);
opacity: 0.8;
button {
margin-top: 55px;
}
}
}
.el-image{
width: 260px;
height: 150px;
display: block;
::v-deep .image-slot {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
background: #f5f7fa;
color: #909399;
}
}
.box-card-item-add {
width: 260px;
height: 185px;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
i {
font-size: 30px;
}
}
.box-card-item-footer {
padding: 8px 5px;
background-color: #dcdcdc;
display: flex;
justify-content: space-between;
.box-card-item-footer-text {
width: 150px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
i {
margin-right: 5px;
cursor: pointer;
}
}
}
}
</style>

View File

@@ -0,0 +1,93 @@
<template>
<el-dialog title="图表" width="50%" :visible.sync="dialogVisible" :show-close="false" :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="图表名称" prop="chartName">
<el-input v-model="form.chartName" placeholder="请输入图表名称" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确定</el-button>
<el-button @click="dialogVisible = false">取消</el-button>
</span>
</el-dialog>
</template>
<script>
import { addDataChart, updateDataChart } from '@/api/visual/datachart'
export default {
name: 'ChartForm',
props: {
visible: {
type: Boolean,
default: function() {
return false
}
},
data: {
type: Object,
default: function() {
return {}
}
}
},
data() {
return {
form: {
chartName: undefined
},
rules: {
chartName: [
{ required: true, message: '图表名称不能为空', trigger: 'blur' }
]
}
}
},
computed: {
dialogVisible: {
get() {
return this.visible
},
set(val) {
this.$emit('update:visible', val)
}
}
},
created() {
this.form = this.data
},
methods: {
submitForm() {
this.$refs['form'].validate(valid => {
if (valid) {
if (this.form.id) {
updateDataChart(this.form).then(response => {
if (response.success) {
this.$message.success('保存成功')
this.dialogVisible = false
this.$emit('handleChartFormFinished')
}
}).catch(error => {
this.$message.error(error.msg || '保存失败')
})
} else {
addDataChart(this.form).then(response => {
if (response.success) {
this.$message.success('保存成功')
this.dialogVisible = false
this.$emit('handleChartFormFinished')
}
}).catch(error => {
this.$message.error(error.msg || '保存失败')
})
}
}
})
}
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,106 @@
<template>
<component
:is="currentChart.component"
:data="chartData"
:rows="rows"
:columns="columns"
:values="values"
:chart-type="currentChart.value"
:chart-theme="chartTheme"
:chart-option="chartOption"
:chart-series-type="chartSeriesType"
:chart-style="chartStyle"
/>
</template>
<script>
import { chartTypes } from '@/utils/visual-chart'
import ChartTable from './widgets/ChartTable'
import ChartLine from './widgets/ChartLine'
import ChartBar from './widgets/ChartBar'
import ChartPie from './widgets/ChartPie'
import ChartKpi from './widgets/ChartKpi'
import ChartRadar from './widgets/ChartRadar'
import ChartFunnel from './widgets/ChartFunnel'
import ChartScatter from './widgets/ChartScatter'
import ChartGauge from './widgets/ChartGauge'
import ChartTreemap from './widgets/ChartTreemap'
import ChartWordCloud from './widgets/ChartWordCloud'
import ChartLiquidFill from './widgets/ChartLiquidFill'
import ChartSankey from './widgets/ChartSankey'
import ChartMap from './widgets/ChartMap'
import ChartTree from './widgets/ChartTree'
import ChartSunburst from './widgets/ChartSunburst'
import ChartPolar from './widgets/ChartPolar'
export default {
name: 'ChartPanel',
components: {
ChartTable, ChartLine, ChartBar, ChartPie,
ChartKpi, ChartRadar, ChartFunnel, ChartScatter,
ChartGauge, ChartTreemap, ChartWordCloud, ChartLiquidFill,
ChartSankey, ChartMap, ChartTree, ChartSunburst, ChartPolar
},
props: {
chartSchema: {
type: Object,
required: true
},
chartData: {
type: Array,
required: true
},
chartStyle: {
type: Object,
require: false
}
},
data() {
return {
chartTypes
}
},
computed: {
currentChart() {
return chartTypes.find(item => item.value === this.chartSchema.chartType)
},
rows() {
return this.chartSchema.rows.map((row, index, arr) => {
return {
key: `${row.col}`,
label: `${row.col}`
}
}) || []
},
columns() {
return this.chartSchema.columns.map((column, index, arr) => {
return {
key: `${column.col}`,
label: `${column.col}`
}
}) || []
},
values() {
return this.chartSchema.measures.map((measure, index, arr) => {
return {
key: `${measure.col}`,
label: `${measure.col}`
}
}) || []
},
chartTheme() {
return this.chartSchema.theme || 'default'
},
chartSeriesType() {
return this.chartSchema.seriesType || undefined
},
chartOption() {
return this.chartSchema.options || {}
}
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,424 @@
<template>
<div ref="chart" :style="chartStyle">ChartBar</div>
</template>
<script>
import echarts from 'echarts'
import { convertPathToMap, SEPARATOR } from '@/utils/visual-chart'
export default {
name: 'ChartBar',
props: {
data: {
type: Array,
required: true,
default: () => []
},
rows: {
type: Array,
required: true,
default: () => []
},
columns: {
type: Array,
required: true,
default: () => []
},
values: {
type: Array,
required: true,
default: () => []
},
chartType: {
type: String,
required: true
},
chartTheme: {
type: String,
require: true,
default: 'default'
},
chartSeriesType: {
type: String,
require: true,
default: ''
},
chartOption: {
type: Object,
require: false,
default: () => ({})
},
chartStyle: {
type: Object,
require: false,
default: () => {
return {
height: '200px'
}
}
}
},
data() {
return {
localRows: [],
localColumns: [],
localValues: [],
localData: [],
// 连接符
connector: '-',
chart: null,
calcOption: {
xAxis: {
type: 'category',
axisLine: {
lineStyle: {
color: 'rgba(0, 0, 0, 1)'
}
}
},
yAxis: {
type: 'value',
axisLine: {
lineStyle: {
color: 'rgba(0, 0, 0, 1)'
}
}
},
tooltip: { trigger: 'axis' }
},
calcData: {
legendData: [],
xAxisData: [],
seriesObj: {}
}
}
},
computed: {
watchAllProps() {
const { rows, columns, values, data } = this
return { rows, columns, values, data }
}
},
watch: {
watchAllProps() {
this.init()
this.mergeChartOption()
},
chartTheme() {
this.mergeChartTheme()
},
chartSeriesType() {
this.mergeChartOption()
},
chartOption: {
handler(newValue, oldValue) {
this.mergeChartOption()
},
deep: true
}
},
mounted() {
this.renderChart()
this.$on('resized', this.handleResize)
window.addEventListener('resize', this.handleResize)
},
created() {
this.init()
},
beforeDestroy() {
if (this.chart) {
this.chart.dispose()
}
window.removeEventListener('resize', this.handleResize)
},
methods: {
init() {
if (this.rows.length || this.columns.length || this.values.length) {
this.handleDataClone()
this.setValuesToColAndRow()
this.handleCalcData()
} else {
console.warn('[Warn]: props.rows, props.columns, props.values at least one is not empty.')
}
},
// clone data
handleDataClone() {
this.localRows = JSON.parse(JSON.stringify(this.rows))
this.localColumns = JSON.parse(JSON.stringify(this.columns))
this.localValues = JSON.parse(JSON.stringify(this.values))
this.localData = Object.freeze(this.data)
},
// set the `values` attribute to rows and columns
setValuesToColAndRow() {
const rowKeys = this.localRows.map(({ key }) => key)
const columnKeys = this.localColumns.map(({ key }) => key)
const rowValues = this._findCategory(rowKeys, this.localData)
const columnValues = this._findCategory(columnKeys, this.localData)
this.localRows.forEach((row) => {
const { key, values } = row
this.$set(row, 'values', values || rowValues[key] || [])
})
this.localColumns.forEach((column) => {
const { key, values } = column
this.$set(column, 'values', values || columnValues[key] || [])
})
},
// 计算值
handleCalcData() {
if (!this.localRows.length || !this.localValues.length) return
const _rowPaths = this._combineRowPaths(
this.localData,
...this.localRows.map(({ key, values }) => { return { key, values } })
)
const _rowKeys = this.localRows.map(({ key }) => key)
const _colPaths = this._combineColPaths(
...this.localColumns.map(({ values }) => values)
)
const _colKeys = this.localColumns.map(({ key }) => key)
// 行对应的条件
const rowConditions = convertPathToMap(_rowPaths, _rowKeys)
// 列对应的条件
const colConditions = convertPathToMap(_colPaths, _colKeys)
// 针对没传入行或列的处理
!colConditions.length && colConditions.push({})
!rowConditions.length && rowConditions.push({})
const xAxisData = []
const legendData = []
const seriesObj = {}
rowConditions.forEach((rowCondition) => {
xAxisData.push(Object.values(rowCondition).join(this.connector))
})
colConditions.forEach((colCondition) => {
const isEmptyCol = !Object.keys(colCondition).length
this.localValues.forEach(({ key }) => {
const seriesName = isEmptyCol ? key : Object.values(colCondition).join(this.connector) + this.connector + key
legendData.push(seriesName)
seriesObj[seriesName] = {
name: seriesName,
type: this.chartType,
data: []
}
})
})
// 计算每个series数据
colConditions.forEach((colCondition, colConditionIndex) => {
const isEmptyCol = !Object.keys(colCondition).length
rowConditions.forEach((rowCondition, rowConditionIndex) => {
// 当前单元对应的条件
const conditions = Object.assign({}, rowCondition, colCondition)
// 通过当前单元对应的条件,过滤数据
const filterData = this._filterData(conditions, this.localData)
// 多个值,多条数据
this.localValues.forEach(({ key }) => {
const value = this._reduceValue(filterData, key)
const seriesName = isEmptyCol ? key : Object.values(colCondition).join(this.connector) + this.connector + key
seriesObj[seriesName].data.push(value)
})
})
})
this.calcData.legendData = legendData
this.calcData.xAxisData = xAxisData
this.calcData.seriesObj = seriesObj
},
handleResize() {
if (this.chart) {
this.chart.resize()
}
},
renderChart() {
if (!this.$refs.chart) return
let option = Object.assign({}, this.chartOption, this.calcOption)
option.legend.data = this.calcData.legendData
option.xAxis.data = this.calcData.xAxisData
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
this.parseChartSeries(option, series, this.chartSeriesType)
option.series = series
setTimeout(() => {
if (!this.chart) {
if (this.chartTheme !== 'default') {
require('./themes/' + this.chartTheme + '.js')
}
this.chart = echarts.init(this.$refs.chart, this.chartTheme)
}
this.chart.clear()
this.chart.setOption(option)
}, 0)
},
mergeChartTheme() {
if (!this.$refs.chart) return
if (this.chart) {
// 使用刚指定的配置项和数据显示图表
let option = Object.assign({}, this.chartOption, this.calcOption)
option.legend.data = this.calcData.legendData
option.xAxis.data = this.calcData.xAxisData
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
this.parseChartSeries(option, series, this.chartSeriesType)
option.series = series
if (this.chartTheme !== 'default') {
require('./themes/' + this.chartTheme + '.js')
}
this.chart.dispose()
// 基于准备好的dom初始化echarts实例
this.chart = echarts.init(this.$refs.chart, this.chartTheme)
this.chart.setOption(option)
}
},
mergeChartOption() {
if (!this.$refs.chart) return
if (this.chart) {
let option = Object.assign({}, this.chartOption, this.calcOption)
option.legend.data = this.calcData.legendData
option.xAxis.data = this.calcData.xAxisData
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
this.parseChartSeries(option, series, this.chartSeriesType)
option.series = series
this.chart.clear()
this.chart.setOption(option, true)
}
},
parseChartSeries(option, series, type) {
if (type === 'stackbar') {
series.forEach((item) => {
item.stack = '总量'
})
} else if (type === 'percentagestackbar') {
const sum_data = []
for (let j = 0; j < option.xAxis.data.length; j++) {
let sum = 0
for (let i = 0; i < series.length; i++) {
sum += series[i].data[j] ? Number(series[i].data[j]) : 0
}
sum_data[j] = sum
}
series.forEach((item) => {
const serieCalcData = item.data.map((data, index) => {
return (parseFloat(data) / parseFloat(sum_data[index]) * 100).toFixed(2)
})
item.data = serieCalcData
item.stack = '总量'
})
option.yAxis.min = 0
option.yAxis.max = 100
} else if (type === 'barchart') {
const xAxis = JSON.parse(JSON.stringify(option.xAxis))
const yAxis = JSON.parse(JSON.stringify(option.yAxis))
option.xAxis = yAxis
option.yAxis = xAxis
} else if (type === 'stackbarchart') {
const xAxis = JSON.parse(JSON.stringify(option.xAxis))
const yAxis = JSON.parse(JSON.stringify(option.yAxis))
option.xAxis = yAxis
option.yAxis = xAxis
series.forEach((item) => {
item.stack = '总量'
})
} else if (type === 'percentagestackbarchart') {
const sum_data = []
for (let j = 0; j < option.xAxis.data.length; j++) {
let sum = 0
for (let i = 0; i < series.length; i++) {
sum += series[i].data[j] ? Number(series[i].data[j]) : 0
}
sum_data[j] = sum
}
series.forEach((item) => {
const serieCalcData = item.data.map((data, index) => {
return (parseFloat(data) / parseFloat(sum_data[index]) * 100).toFixed(2)
})
item.data = serieCalcData
item.stack = '总量'
})
const xAxis = JSON.parse(JSON.stringify(option.xAxis))
const yAxis = JSON.parse(JSON.stringify(option.yAxis))
option.xAxis = yAxis
option.yAxis = xAxis
option.xAxis.min = 0
option.xAxis.max = 100
}
},
_combineRowPaths(data, ...arrays) {
const len = arrays.length
let _result = []
if (len) {
const rowPaths = arrays.reduce((prev, curr) => {
const arr = []
prev.values.forEach(_prevEl => {
const prevKey = prev.key.split(SEPARATOR)
curr.values.forEach(_currEl => {
const currKey = curr.key
const conditions = {}
prevKey.forEach((key, i) => {
conditions[key] = _prevEl.split(SEPARATOR)[i]
})
conditions[currKey] = _currEl
// 判断数据里是否有该项
const filter = data.some((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
if (filter) {
arr.push(_prevEl + SEPARATOR + _currEl)
}
})
})
return { key: prev.key + SEPARATOR + curr.key, values: arr }
}) || {}
_result = rowPaths.values || []
}
return _result
},
_combineColPaths(...arrays) {
return arrays.length ? arrays.reduce((prev, curr) => {
const arr = []
prev.forEach(_prevEl => {
curr.forEach(_currEl => {
arr.push(_prevEl + SEPARATOR + _currEl)
})
})
return arr
}) : arrays
},
_findCategory(keys = [], data = []) {
const _result = {}
data.forEach(item => {
keys.forEach(key => {
// Remove duplicates
_result[key] = _result[key] || []
_result[key].push(item[key])
_result[key] = [...new Set(_result[key])]
})
})
return _result
},
_reduceValue(data, key) {
if (!data.length) return 0
return data.reduce((sum, item) => { return sum + Number(item[key]) }, 0)
},
_filterData(conditions, data) {
return data.filter((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
}
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,387 @@
<template>
<div ref="chart" :style="chartStyle">ChartFunnel</div>
</template>
<script>
import echarts from 'echarts'
import { convertPathToMap, SEPARATOR } from '@/utils/visual-chart'
export default {
name: 'ChartFunnel',
props: {
data: {
type: Array,
required: true,
default: () => []
},
rows: {
type: Array,
required: true,
default: () => []
},
columns: {
type: Array,
required: true,
default: () => []
},
values: {
type: Array,
required: true,
default: () => []
},
chartType: {
type: String,
required: true
},
chartTheme: {
type: String,
require: true,
default: 'default'
},
chartSeriesType: {
type: String,
require: true,
default: ''
},
chartOption: {
type: Object,
require: false,
default: () => ({})
},
chartStyle: {
type: Object,
require: false,
default: () => {
return {
height: '200px'
}
}
}
},
data() {
return {
localRows: [],
localColumns: [],
localValues: [],
localData: [],
// 连接符
connector: '-',
chart: null,
calcOption: {
tooltip: { trigger: 'item' }
},
calcData: {
legendData: [],
seriesObj: {}
}
}
},
computed: {
watchAllProps() {
const { rows, columns, values, data } = this
return { rows, columns, values, data }
}
},
watch: {
watchAllProps() {
this.init()
this.mergeChartOption()
},
chartTheme() {
this.mergeChartTheme()
},
chartSeriesType() {
this.mergeChartOption()
},
chartOption: {
handler(newValue, oldValue) {
this.mergeChartOption()
},
deep: true
}
},
mounted() {
this.renderChart()
this.$on('resized', this.handleResize)
window.addEventListener('resize', this.handleResize)
},
created() {
this.init()
},
beforeDestroy() {
if (this.chart) {
this.chart.dispose()
}
window.removeEventListener('resize', this.handleResize)
},
methods: {
init() {
if (this.rows.length || this.columns.length || this.values.length) {
this.handleDataClone()
this.setValuesToColAndRow()
this.handleCalcData()
} else {
console.warn('[Warn]: props.rows, props.columns, props.values at least one is not empty.')
}
},
// clone data
handleDataClone() {
this.localRows = JSON.parse(JSON.stringify(this.rows))
this.localColumns = JSON.parse(JSON.stringify(this.columns))
this.localValues = JSON.parse(JSON.stringify(this.values))
this.localData = Object.freeze(this.data)
},
// set the `values` attribute to rows and columns
setValuesToColAndRow() {
const rowKeys = this.localRows.map(({ key }) => key)
const columnKeys = this.localColumns.map(({ key }) => key)
const rowValues = this._findCategory(rowKeys, this.localData)
const columnValues = this._findCategory(columnKeys, this.localData)
this.localRows.forEach((row) => {
const { key, values } = row
this.$set(row, 'values', values || rowValues[key] || [])
})
this.localColumns.forEach((column) => {
const { key, values } = column
this.$set(column, 'values', values || columnValues[key] || [])
})
},
// 计算值
handleCalcData() {
if (!this.localValues.length) return
const _rowPaths = this._combineRowPaths(
this.localData,
...this.localRows.map(({ key, values }) => { return { key, values } })
)
const _rowKeys = this.localRows.map(({ key }) => key)
const _colPaths = this._combineColPaths(
...this.localColumns.map(({ values }) => values)
)
const _colKeys = this.localColumns.map(({ key }) => key)
// 行对应的条件
const rowConditions = convertPathToMap(_rowPaths, _rowKeys)
// 列对应的条件
const colConditions = convertPathToMap(_colPaths, _colKeys)
// 针对没传入行或列的处理
!colConditions.length && colConditions.push({})
!rowConditions.length && rowConditions.push({})
const legendData = []
this.localValues.forEach(({ key }) => {
legendData.push(key)
})
const seriesObj = {}
rowConditions.forEach((rowCondition, index) => {
const seriesName = Object.values(rowCondition).join(this.connector) || ''
seriesObj[seriesName] = {
name: seriesName,
type: this.chartType,
label: {
show: true,
position: 'inside'
},
sort: 'descending',
data: []
}
})
// 计算每个series数据
rowConditions.forEach((rowCondition, rowConditionIndex) => {
const seriesName = Object.values(rowCondition).join(this.connector) || ''
const seriesData = []
colConditions.forEach((colCondition, colConditionIndex) => {
// 当前单元对应的条件
const conditions = Object.assign({}, rowCondition, colCondition)
// 通过当前单元对应的条件,过滤数据
const filterData = this._filterData(conditions, this.localData)
// 多个值,多条数据
this.localValues.forEach(({ key }) => {
const seriesDataValue = { name: '', value: '' }
seriesDataValue.name = key
const value = this._reduceValue(filterData, key)
seriesDataValue.value = value
seriesData.push(seriesDataValue)
})
})
seriesObj[seriesName].data = seriesData
})
this.calcData.legendData = legendData
this.calcData.seriesObj = seriesObj
},
handleResize() {
if (this.chart) {
this.chart.resize()
}
},
renderChart() {
if (!this.$refs.chart) return
let option = Object.assign({}, this.chartOption, this.calcOption)
option.legend.data = this.calcData.legendData
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
this.parseChartSeries(option, series, this.chartSeriesType)
option.series = series
setTimeout(() => {
if (!this.chart) {
if (this.chartTheme !== 'default') {
require('./themes/' + this.chartTheme + '.js')
}
this.chart = echarts.init(this.$refs.chart, this.chartTheme)
}
this.chart.clear()
this.chart.setOption(option)
}, 0)
},
mergeChartTheme() {
if (!this.$refs.chart) return
if (this.chart) {
// 使用刚指定的配置项和数据显示图表
let option = Object.assign({}, this.chartOption, this.calcOption)
option.legend.data = this.calcData.legendData
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
this.parseChartSeries(option, series, this.chartSeriesType)
option.series = series
if (this.chartTheme !== 'default') {
require('./themes/' + this.chartTheme + '.js')
}
this.chart.dispose()
// 基于准备好的dom初始化echarts实例
this.chart = echarts.init(this.$refs.chart, this.chartTheme)
this.chart.setOption(option)
}
},
mergeChartOption() {
if (!this.$refs.chart) return
if (this.chart) {
let option = Object.assign({}, this.chartOption, this.calcOption)
option.legend.data = this.calcData.legendData
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
this.parseChartSeries(option, series, this.chartSeriesType)
option.series = series
this.chart.clear()
this.chart.setOption(option, true)
}
},
parseChartSeries(option, series, type) {
const b = 100 / (series.length * 9 + 1)
if (type === 'funnel') {
series.forEach((item, index) => {
item.left = b + index * b * 9 + '%'
item.width = b * 8 + '%'
item.maxSize = '100%'
item.label.formatter = (params) => {
return params.value + '\n' + params.percent + '%'
}
})
}
if (type === 'pyramidfunnel') {
series.forEach((item, index) => {
item.sort = 'ascending'
item.left = b + index * b * 9 + '%'
item.width = b * 8 + '%'
item.maxSize = '100%'
item.label.formatter = (params) => {
return params.value + '\n' + params.percent + '%'
}
})
} else if (type === 'contrastfunnel') {
let percent = 100
series.forEach((item, index) => {
if (index === 0) {
item.label.position = 'outside'
} else {
item.label.formatter = (params) => {
return params.value + '\n' + params.percent + '%'
}
}
item.maxSize = percent + '%'
percent *= 0.8
})
}
option.tooltip.formatter = (params) => {
return params.seriesName + ' <br/>' + params.name + ' : ' + params.value + '<br>' + params.percent + '%'
}
},
_combineRowPaths(data, ...arrays) {
const len = arrays.length
let _result = []
if (len) {
const rowPaths = arrays.reduce((prev, curr) => {
const arr = []
prev.values.forEach(_prevEl => {
const prevKey = prev.key.split(SEPARATOR)
curr.values.forEach(_currEl => {
const currKey = curr.key
const conditions = {}
prevKey.forEach((key, i) => {
conditions[key] = _prevEl.split(SEPARATOR)[i]
})
conditions[currKey] = _currEl
// 判断数据里是否有该项
const filter = data.some((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
if (filter) {
arr.push(_prevEl + SEPARATOR + _currEl)
}
})
})
return { key: prev.key + SEPARATOR + curr.key, values: arr }
}) || {}
_result = rowPaths.values || []
}
return _result
},
_combineColPaths(...arrays) {
return arrays.length ? arrays.reduce((prev, curr) => {
const arr = []
prev.forEach(_prevEl => {
curr.forEach(_currEl => {
arr.push(_prevEl + SEPARATOR + _currEl)
})
})
return arr
}) : arrays
},
_findCategory(keys = [], data = []) {
const _result = {}
data.forEach(item => {
keys.forEach(key => {
// Remove duplicates
_result[key] = _result[key] || []
_result[key].push(item[key])
_result[key] = [...new Set(_result[key])]
})
})
return _result
},
_reduceValue(data, key) {
if (!data.length) return 0
return data.reduce((sum, item) => { return sum + Number(item[key]) }, 0)
},
_filterData(conditions, data) {
return data.filter((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
}
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,292 @@
<template>
<div ref="chart" :style="chartStyle">ChartGauge</div>
</template>
<script>
import echarts from 'echarts'
import { SEPARATOR } from '@/utils/visual-chart'
export default {
name: 'ChartGauge',
props: {
data: {
type: Array,
required: true,
default: () => []
},
rows: {
type: Array,
required: true,
default: () => []
},
columns: {
type: Array,
required: true,
default: () => []
},
values: {
type: Array,
required: true,
default: () => []
},
chartType: {
type: String,
required: true
},
chartTheme: {
type: String,
require: true
},
chartOption: {
type: Object,
require: false,
default: () => ({})
},
chartStyle: {
type: Object,
require: false,
default: () => {
return {
height: '200px'
}
}
}
},
data() {
return {
localRows: [],
localColumns: [],
localValues: [],
localData: [],
// 连接符
connector: '-',
chart: null,
calcOption: {
tooltip: { trigger: 'item' }
},
calcData: {
seriesObj: {}
}
}
},
computed: {
watchAllProps() {
const { rows, columns, values, data } = this
return { rows, columns, values, data }
}
},
watch: {
watchAllProps() {
this.init()
this.mergeChartOption()
},
chartTheme() {
this.mergeChartTheme()
},
chartOption: {
handler(newValue, oldValue) {
this.mergeChartOption()
},
deep: true
}
},
mounted() {
this.renderChart()
this.$on('resized', this.handleResize)
window.addEventListener('resize', this.handleResize)
},
created() {
this.init()
},
beforeDestroy() {
if (this.chart) {
this.chart.dispose()
}
window.removeEventListener('resize', this.handleResize)
},
methods: {
init() {
console.log('初始化属性')
if (this.rows.length || this.columns.length || this.values.length) {
this.handleDataClone()
this.setValuesToColAndRow()
this.handleCalcData()
} else {
console.warn('[Warn]: props.rows, props.columns, props.values at least one is not empty.')
}
},
// clone data
handleDataClone() {
this.localRows = JSON.parse(JSON.stringify(this.rows))
this.localColumns = JSON.parse(JSON.stringify(this.columns))
this.localValues = JSON.parse(JSON.stringify(this.values))
this.localData = Object.freeze(this.data)
},
// set the `values` attribute to rows and columns
setValuesToColAndRow() {
const rowKeys = this.localRows.map(({ key }) => key)
const columnKeys = this.localColumns.map(({ key }) => key)
const rowValues = this._findCategory(rowKeys, this.localData)
const columnValues = this._findCategory(columnKeys, this.localData)
this.localRows.forEach((row) => {
const { key, values } = row
this.$set(row, 'values', values || rowValues[key] || [])
})
this.localColumns.forEach((column) => {
const { key, values } = column
this.$set(column, 'values', values || columnValues[key] || [])
})
},
// 计算值
handleCalcData() {
if (!this.localValues.length) return
const seriesObj = {}
const localValue = this.localValues[0]
const seriesName = localValue.key
const seriesData = []
seriesData.push({
name: seriesName,
value: this.localData[0][seriesName]
})
seriesObj[seriesName] = {
name: seriesName,
type: this.chartType,
radius: '100%',
detail: { formatter: '{value}%' },
data: seriesData
}
this.calcData.seriesObj = seriesObj
},
handleResize() {
if (this.chart) {
this.chart.resize()
}
},
renderChart() {
if (!this.$refs.chart) return
let option = Object.assign({}, this.chartOption, this.calcOption)
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
option.series = series
setTimeout(() => {
if (!this.chart) {
if (this.chartTheme !== 'default') {
require('./themes/' + this.chartTheme + '.js')
}
this.chart = echarts.init(this.$refs.chart, this.chartTheme)
}
this.chart.clear()
this.chart.setOption(option)
}, 0)
},
mergeChartTheme() {
if (!this.$refs.chart) return
if (this.chart) {
// 使用刚指定的配置项和数据显示图表
let option = Object.assign({}, this.chartOption, this.calcOption)
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
option.series = series
if (this.chartTheme !== 'default') {
require('./themes/' + this.chartTheme + '.js')
}
this.chart.dispose()
// 基于准备好的dom初始化echarts实例
this.chart = echarts.init(this.$refs.chart, this.chartTheme)
this.chart.setOption(option)
}
},
mergeChartOption() {
if (!this.$refs.chart) return
if (this.chart) {
let option = Object.assign({}, this.chartOption, this.calcOption)
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
option.series = series
this.chart.clear()
this.chart.setOption(option, true)
}
},
_combineRowPaths(data, ...arrays) {
const len = arrays.length
let _result = []
if (len) {
const rowPaths = arrays.reduce((prev, curr) => {
const arr = []
prev.values.forEach(_prevEl => {
const prevKey = prev.key.split(SEPARATOR)
curr.values.forEach(_currEl => {
const currKey = curr.key
const conditions = {}
prevKey.forEach((key, i) => {
conditions[key] = _prevEl.split(SEPARATOR)[i]
})
conditions[currKey] = _currEl
// 判断数据里是否有该项
const filter = data.some((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
if (filter) {
arr.push(_prevEl + SEPARATOR + _currEl)
}
})
})
return { key: prev.key + SEPARATOR + curr.key, values: arr }
}) || {}
_result = rowPaths.values || []
}
return _result
},
_combineColPaths(...arrays) {
return arrays.length ? arrays.reduce((prev, curr) => {
const arr = []
prev.forEach(_prevEl => {
curr.forEach(_currEl => {
arr.push(_prevEl + SEPARATOR + _currEl)
})
})
return arr
}) : arrays
},
_findCategory(keys = [], data = []) {
const _result = {}
data.forEach(item => {
keys.forEach(key => {
// Remove duplicates
_result[key] = _result[key] || []
_result[key].push(item[key])
_result[key] = [...new Set(_result[key])]
})
})
return _result
},
_reduceValue(data, key) {
if (!data.length) return 0
return data.reduce((sum, item) => { return sum + Number(item[key]) }, 0)
},
_filterData(conditions, data) {
return data.filter((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
}
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,233 @@
<template>
<div ref="chart" :style="chartStyle" style="max-height: 100%; max-width: 100%;">
<div class="card-panel">
<div class="card-panel-description">
<div class="card-panel-num">{{ calcData.val }}</div>
<div class="card-panel-text">{{ calcData.key }}</div>
</div>
</div>
</div>
</template>
<script>
import { SEPARATOR } from '@/utils/visual-chart'
export default {
name: 'ChartKpi',
props: {
data: {
type: Array,
required: true,
default: () => []
},
rows: {
type: Array,
required: true,
default: () => []
},
columns: {
type: Array,
required: true,
default: () => []
},
values: {
type: Array,
required: true,
default: () => []
},
chartType: {
type: String,
required: true
},
chartTheme: {
type: String,
require: true,
default: 'default'
},
chartOption: {
type: Object,
require: false,
default: () => ({})
},
chartStyle: {
type: Object,
require: false,
default: () => ({})
}
},
data() {
return {
localRows: [],
localColumns: [],
localValues: [],
localData: [],
// 连接符
connector: '-',
calcData: { key: '', val: '' }
}
},
computed: {
watchAllProps() {
const { rows, columns, values, data } = this
return { rows, columns, values, data }
}
},
watch: {
watchAllProps() {
this.init()
this.mergeChartOption()
},
chartTheme() {
this.mergeChartTheme()
},
chartOption: {
handler(newValue, oldValue) {
this.mergeChartOption()
},
deep: true
}
},
created() {
this.init()
},
methods: {
init() {
if (this.rows.length || this.columns.length || this.values.length) {
this.handleDataClone()
this.setValuesToColAndRow()
this.handleCalcData()
} else {
console.warn('[Warn]: props.rows, props.columns, props.values at least one is not empty.')
}
},
// clone data
handleDataClone() {
this.localRows = JSON.parse(JSON.stringify(this.rows))
this.localColumns = JSON.parse(JSON.stringify(this.columns))
this.localValues = JSON.parse(JSON.stringify(this.values))
this.localData = Object.freeze(this.data)
},
// set the `values` attribute to rows and columns
setValuesToColAndRow() {
const rowKeys = this.localRows.map(({ key }) => key)
const columnKeys = this.localColumns.map(({ key }) => key)
const rowValues = this._findCategory(rowKeys, this.localData)
const columnValues = this._findCategory(columnKeys, this.localData)
this.localRows.forEach((row) => {
const { key, values } = row
this.$set(row, 'values', values || rowValues[key] || [])
})
this.localColumns.forEach((column) => {
const { key, values } = column
this.$set(column, 'values', values || columnValues[key] || [])
})
},
// 计算值
handleCalcData() {
if (!this.localValues.length) return
const localValue = this.localValues[0]
const seriesName = localValue.key
this.calcData.key = seriesName
this.calcData.val = this.localData[0][seriesName]
},
mergeChartOption() {},
mergeChartTheme() {},
_combineRowPaths(data, ...arrays) {
const len = arrays.length
let _result = []
if (len) {
const rowPaths = arrays.reduce((prev, curr) => {
const arr = []
prev.values.forEach(_prevEl => {
const prevKey = prev.key.split(SEPARATOR)
curr.values.forEach(_currEl => {
const currKey = curr.key
const conditions = {}
prevKey.forEach((key, i) => {
conditions[key] = _prevEl.split(SEPARATOR)[i]
})
conditions[currKey] = _currEl
// 判断数据里是否有该项
const filter = data.some((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
if (filter) {
arr.push(_prevEl + SEPARATOR + _currEl)
}
})
})
return { key: prev.key + SEPARATOR + curr.key, values: arr }
}) || {}
_result = rowPaths.values || []
}
return _result
},
_combineColPaths(...arrays) {
return arrays.length ? arrays.reduce((prev, curr) => {
const arr = []
prev.forEach(_prevEl => {
curr.forEach(_currEl => {
arr.push(_prevEl + SEPARATOR + _currEl)
})
})
return arr
}) : arrays
},
_findCategory(keys = [], data = []) {
const _result = {}
data.forEach(item => {
keys.forEach(key => {
// Remove duplicates
_result[key] = _result[key] || []
_result[key].push(item[key])
_result[key] = [...new Set(_result[key])]
})
})
return _result
},
_reduceValue(data, key) {
if (!data.length) return 0
return data.reduce((sum, item) => { return sum + Number(item[key]) }, 0)
},
_filterData(conditions, data) {
return data.filter((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
}
}
}
</script>
<style lang="scss" scoped>
.card-panel {
align-items: center; /*垂直居中*/
justify-content: center; /*水平居中*/
.card-panel-description {
text-align: center;
.card-panel-num {
font-size: 38px;
font-weight: bold;
color: rgba(0, 0, 0, 1);
}
.card-panel-text {
color: rgba(0, 0, 0, 0.8);
font-size: 16px;
margin-top: 12px;
}
}
}
</style>

View File

@@ -0,0 +1,412 @@
<template>
<div ref="chart" :style="chartStyle">ChartLine</div>
</template>
<script>
import echarts from 'echarts'
import { convertPathToMap, SEPARATOR } from '@/utils/visual-chart'
export default {
name: 'ChartLine',
props: {
data: {
type: Array,
required: true,
default: () => []
},
rows: {
type: Array,
required: true,
default: () => []
},
columns: {
type: Array,
required: true,
default: () => []
},
values: {
type: Array,
required: true,
default: () => []
},
chartType: {
type: String,
required: true
},
chartTheme: {
type: String,
require: true,
default: 'default'
},
chartSeriesType: {
type: String,
require: true,
default: ''
},
chartOption: {
type: Object,
require: false,
default: () => ({})
},
chartStyle: {
type: Object,
require: false,
default: () => {
return {
height: '200px'
}
}
}
},
data() {
return {
localRows: [],
localColumns: [],
localValues: [],
localData: [],
// 连接符
connector: '-',
chart: null,
calcOption: {
xAxis: {
type: 'category',
axisLine: {
lineStyle: {
color: 'rgba(0, 0, 0, 1)'
}
}
},
yAxis: {
type: 'value',
axisLine: {
lineStyle: {
color: 'rgba(0, 0, 0, 1)'
}
}
},
tooltip: { trigger: 'axis' }
},
calcData: {
legendData: [],
xAxisData: [],
seriesObj: {}
}
}
},
computed: {
watchAllProps() {
const { rows, columns, values, data } = this
return { rows, columns, values, data }
}
},
watch: {
watchAllProps() {
this.init()
this.mergeChartOption()
},
chartTheme() {
this.mergeChartTheme()
},
chartSeriesType() {
this.mergeChartOption()
},
chartOption: {
handler(newValue, oldValue) {
this.mergeChartOption()
},
deep: true
}
},
mounted() {
this.renderChart()
this.$on('resized', this.handleResize)
window.addEventListener('resize', this.handleResize)
},
created() {
this.init()
},
beforeDestroy() {
if (this.chart) {
this.chart.dispose()
}
window.removeEventListener('resize', this.handleResize)
},
methods: {
init() {
if (this.rows.length || this.columns.length || this.values.length) {
this.handleDataClone()
this.setValuesToColAndRow()
this.handleCalcData()
} else {
console.warn('[Warn]: props.rows, props.columns, props.values at least one is not empty.')
}
},
// clone data
handleDataClone() {
this.localRows = JSON.parse(JSON.stringify(this.rows))
this.localColumns = JSON.parse(JSON.stringify(this.columns))
this.localValues = JSON.parse(JSON.stringify(this.values))
this.localData = Object.freeze(this.data)
},
// set the `values` attribute to rows and columns
setValuesToColAndRow() {
const rowKeys = this.localRows.map(({ key }) => key)
const columnKeys = this.localColumns.map(({ key }) => key)
const rowValues = this._findCategory(rowKeys, this.localData)
const columnValues = this._findCategory(columnKeys, this.localData)
this.localRows.forEach((row) => {
const { key, values } = row
this.$set(row, 'values', values || rowValues[key] || [])
})
this.localColumns.forEach((column) => {
const { key, values } = column
this.$set(column, 'values', values || columnValues[key] || [])
})
},
// 计算值
handleCalcData() {
if (!this.localRows.length || !this.localValues.length) return
const _rowPaths = this._combineRowPaths(
this.localData,
...this.localRows.map(({ key, values }) => { return { key, values } })
)
const _rowKeys = this.localRows.map(({ key }) => key)
const _colPaths = this._combineColPaths(
...this.localColumns.map(({ values }) => values)
)
const _colKeys = this.localColumns.map(({ key }) => key)
// 行对应的条件
const rowConditions = convertPathToMap(_rowPaths, _rowKeys)
// 列对应的条件
const colConditions = convertPathToMap(_colPaths, _colKeys)
// 针对没传入行或列的处理
!colConditions.length && colConditions.push({})
!rowConditions.length && rowConditions.push({})
const xAxisData = []
const legendData = []
const seriesObj = {}
rowConditions.forEach((rowCondition) => {
xAxisData.push(Object.values(rowCondition).join(this.connector))
})
colConditions.forEach((colCondition) => {
const isEmptyCol = !Object.keys(colCondition).length
this.localValues.forEach(({ key }) => {
const seriesName = isEmptyCol ? key : Object.values(colCondition).join(this.connector) + this.connector + key
legendData.push(seriesName)
seriesObj[seriesName] = {
name: seriesName,
type: this.chartType,
data: []
}
})
})
// 计算每个series数据
colConditions.forEach((colCondition, colConditionIndex) => {
const isEmptyCol = !Object.keys(colCondition).length
rowConditions.forEach((rowCondition, rowConditionIndex) => {
// 当前单元对应的条件
const conditions = Object.assign({}, rowCondition, colCondition)
// 通过当前单元对应的条件,过滤数据
const filterData = this._filterData(conditions, this.localData)
// 多个值,多条数据
this.localValues.forEach(({ key }) => {
const value = this._reduceValue(filterData, key)
const seriesName = isEmptyCol ? key : Object.values(colCondition).join(this.connector) + this.connector + key
seriesObj[seriesName].data.push(value)
})
})
})
this.calcData.legendData = legendData
this.calcData.xAxisData = xAxisData
this.calcData.seriesObj = seriesObj
},
handleResize() {
if (this.chart) {
this.chart.resize()
}
},
renderChart() {
if (!this.$refs.chart) return
let option = Object.assign({}, this.chartOption, this.calcOption)
option.legend.data = this.calcData.legendData
option.xAxis.data = this.calcData.xAxisData
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
this.parseChartSeries(option, series, this.chartSeriesType)
option.series = series
setTimeout(() => {
if (!this.chart) {
if (this.chartTheme !== 'default') {
require('./themes/' + this.chartTheme + '.js')
}
this.chart = echarts.init(this.$refs.chart, this.chartTheme)
}
this.chart.clear()
this.chart.setOption(option)
}, 0)
},
mergeChartTheme() {
if (!this.$refs.chart) return
if (this.chart) {
// 使用刚指定的配置项和数据显示图表
let option = Object.assign({}, this.chartOption, this.calcOption)
option.legend.data = this.calcData.legendData
option.xAxis.data = this.calcData.xAxisData
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
this.parseChartSeries(option, series, this.chartSeriesType)
option.series = series
if (this.chartTheme !== 'default') {
require('./themes/' + this.chartTheme + '.js')
}
this.chart.dispose()
// 基于准备好的dom初始化echarts实例
this.chart = echarts.init(this.$refs.chart, this.chartTheme)
this.chart.setOption(option)
}
},
mergeChartOption() {
if (!this.$refs.chart) return
if (this.chart) {
let option = Object.assign({}, this.chartOption, this.calcOption)
option.legend.data = this.calcData.legendData
option.xAxis.data = this.calcData.xAxisData
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
this.parseChartSeries(option, series, this.chartSeriesType)
option.series = series
this.chart.clear()
this.chart.setOption(option, true)
}
},
parseChartSeries(option, series, type) {
if (type === 'arealine') {
series.forEach((item) => {
item.areaStyle = {}
})
option.xAxis.boundaryGap = false
} else if (type === 'stackline') {
series.forEach((item) => {
item.stack = '总量'
})
option.xAxis.boundaryGap = false
} else if (type === 'stackarealine') {
series.forEach((item) => {
item.stack = '总量'
item.areaStyle = {}
})
option.xAxis.boundaryGap = false
} else if (type === 'percentagestackarealine') {
const sum_data = []
for (let j = 0; j < option.xAxis.data.length; j++) {
let sum = 0
for (let i = 0; i < series.length; i++) {
sum += series[i].data[j] ? Number(series[i].data[j]) : 0
}
sum_data[j] = sum
}
series.forEach((item) => {
const serieCalcData = item.data.map((data, index) => {
return (parseFloat(data) / parseFloat(sum_data[index]) * 100).toFixed(2)
})
item.data = serieCalcData
item.stack = '总量'
item.areaStyle = {}
})
option.yAxis.min = 0
option.yAxis.max = 100
option.xAxis.boundaryGap = false
// option.tooltip.formatter = function(params) {
// let s = params[0].name + '</br>'
// const sum = params.reduce((total, cur) => total + cur.value, 0)
// for (let i = 0; i < params.length; i++) {
// s += '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:' + params[i].color + '"></span>'
// s += params[i].seriesName + ' : ' + (100 * parseFloat(params[i].value) / parseFloat(sum)).toFixed(2) + '%<br>'
// }
// return s
// }
}
},
_combineRowPaths(data, ...arrays) {
const len = arrays.length
let _result = []
if (len) {
const rowPaths = arrays.reduce((prev, curr) => {
const arr = []
prev.values.forEach(_prevEl => {
const prevKey = prev.key.split(SEPARATOR)
curr.values.forEach(_currEl => {
const currKey = curr.key
const conditions = {}
prevKey.forEach((key, i) => {
conditions[key] = _prevEl.split(SEPARATOR)[i]
})
conditions[currKey] = _currEl
// 判断数据里是否有该项
const filter = data.some((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
if (filter) {
arr.push(_prevEl + SEPARATOR + _currEl)
}
})
})
return { key: prev.key + SEPARATOR + curr.key, values: arr }
}) || {}
_result = rowPaths.values || []
}
return _result
},
_combineColPaths(...arrays) {
return arrays.length ? arrays.reduce((prev, curr) => {
const arr = []
prev.forEach(_prevEl => {
curr.forEach(_currEl => {
arr.push(_prevEl + SEPARATOR + _currEl)
})
})
return arr
}) : arrays
},
_findCategory(keys = [], data = []) {
const _result = {}
data.forEach(item => {
keys.forEach(key => {
// Remove duplicates
_result[key] = _result[key] || []
_result[key].push(item[key])
_result[key] = [...new Set(_result[key])]
})
})
return _result
},
_reduceValue(data, key) {
if (!data.length) return 0
return data.reduce((sum, item) => { return sum + Number(item[key]) }, 0)
},
_filterData(conditions, data) {
return data.filter((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
}
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,331 @@
<template>
<div ref="chart" :style="chartStyle">ChartLiquidfill</div>
</template>
<script>
import echarts from 'echarts'
require('echarts-liquidfill')
import { SEPARATOR } from '@/utils/visual-chart'
export default {
name: 'ChartLiquidfill',
props: {
data: {
type: Array,
required: true,
default: () => []
},
rows: {
type: Array,
required: true,
default: () => []
},
columns: {
type: Array,
required: true,
default: () => []
},
values: {
type: Array,
required: true,
default: () => []
},
chartType: {
type: String,
required: true
},
chartTheme: {
type: String,
require: true,
default: 'default'
},
chartSeriesType: {
type: String,
require: true,
default: ''
},
chartOption: {
type: Object,
require: false,
default: () => ({})
},
chartStyle: {
type: Object,
require: false,
default: () => {
return {
height: '200px'
}
}
}
},
data() {
return {
localRows: [],
localColumns: [],
localValues: [],
localData: [],
// 连接符
connector: '-',
chart: null,
calcOption: {
tooltip: { trigger: 'item' }
},
calcData: {
seriesObj: {}
}
}
},
computed: {
watchAllProps() {
const { rows, columns, values, data } = this
return { rows, columns, values, data }
}
},
watch: {
watchAllProps() {
this.init()
this.mergeChartOption()
},
chartTheme() {
this.mergeChartTheme()
},
chartSeriesType() {
this.mergeChartOption()
},
chartOption: {
handler(newValue, oldValue) {
this.mergeChartOption()
},
deep: true
}
},
mounted() {
this.renderChart()
this.$on('resized', this.handleResize)
window.addEventListener('resize', this.handleResize)
},
created() {
this.init()
},
beforeDestroy() {
if (this.chart) {
this.chart.dispose()
}
window.removeEventListener('resize', this.handleResize)
},
methods: {
init() {
if (this.rows.length || this.columns.length || this.values.length) {
this.handleDataClone()
this.setValuesToColAndRow()
this.handleCalcData()
} else {
console.warn('[Warn]: props.rows, props.columns, props.values at least one is not empty.')
}
},
// clone data
handleDataClone() {
this.localRows = JSON.parse(JSON.stringify(this.rows))
this.localColumns = JSON.parse(JSON.stringify(this.columns))
this.localValues = JSON.parse(JSON.stringify(this.values))
this.localData = Object.freeze(this.data)
},
// set the `values` attribute to rows and columns
setValuesToColAndRow() {
const rowKeys = this.localRows.map(({ key }) => key)
const columnKeys = this.localColumns.map(({ key }) => key)
const rowValues = this._findCategory(rowKeys, this.localData)
const columnValues = this._findCategory(columnKeys, this.localData)
this.localRows.forEach((row) => {
const { key, values } = row
this.$set(row, 'values', values || rowValues[key] || [])
})
this.localColumns.forEach((column) => {
const { key, values } = column
this.$set(column, 'values', values || columnValues[key] || [])
})
},
// 计算值
handleCalcData() {
if (!this.localValues.length) return
const seriesObj = {}
const localValue = this.localValues[0]
const seriesName = localValue.key
const seriesData = []
seriesData.push(this.localData[0][seriesName])
seriesObj[seriesName] = {
name: seriesName,
type: this.chartType,
label: { fontSize: 20 },
data: seriesData
}
this.calcData.seriesObj = seriesObj
},
handleResize() {
if (this.chart) {
this.chart.resize()
}
},
renderChart() {
if (!this.$refs.chart) return
let option = Object.assign({}, this.chartOption, this.calcOption)
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
this.parseChartSeries(option, series, this.chartSeriesType)
option.series = series
setTimeout(() => {
if (!this.chart) {
if (this.chartTheme !== 'default') {
require('./themes/' + this.chartTheme + '.js')
}
this.chart = echarts.init(this.$refs.chart, this.chartTheme)
}
this.chart.clear()
this.chart.setOption(option)
}, 0)
},
mergeChartTheme() {
if (!this.$refs.chart) return
if (this.chart) {
// 使用刚指定的配置项和数据显示图表
let option = Object.assign({}, this.chartOption, this.calcOption)
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
this.parseChartSeries(option, series, this.chartSeriesType)
option.series = series
if (this.chartTheme !== 'default') {
require('./themes/' + this.chartTheme + '.js')
}
this.chart.dispose()
// 基于准备好的dom初始化echarts实例
this.chart = echarts.init(this.$refs.chart, this.chartTheme)
this.chart.setOption(option)
}
},
mergeChartOption() {
if (!this.$refs.chart) return
if (this.chart) {
let option = Object.assign({}, this.chartOption, this.calcOption)
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
this.parseChartSeries(option, series, this.chartSeriesType)
option.series = series
this.chart.clear()
this.chart.setOption(option, true)
}
},
parseChartSeries(option, series, type) {
if (type === 'circle') {
series.forEach((item) => {
item.shape = 'circle'
})
} else if (type === 'rect') {
series.forEach((item) => {
item.shape = 'rect'
})
} else if (type === 'roundRect') {
series.forEach((item) => {
item.shape = 'roundRect'
})
} else if (type === 'triangle') {
series.forEach((item) => {
item.shape = 'triangle'
})
} else if (type === 'diamond') {
series.forEach((item) => {
item.shape = 'diamond'
})
} else if (type === 'pin') {
series.forEach((item) => {
item.shape = 'pin'
})
} else if (type === 'arrow') {
series.forEach((item) => {
item.shape = 'arrow'
})
}
},
_combineRowPaths(data, ...arrays) {
const len = arrays.length
let _result = []
if (len) {
const rowPaths = arrays.reduce((prev, curr) => {
const arr = []
prev.values.forEach(_prevEl => {
const prevKey = prev.key.split(SEPARATOR)
curr.values.forEach(_currEl => {
const currKey = curr.key
const conditions = {}
prevKey.forEach((key, i) => {
conditions[key] = _prevEl.split(SEPARATOR)[i]
})
conditions[currKey] = _currEl
// 判断数据里是否有该项
const filter = data.some((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
if (filter) {
arr.push(_prevEl + SEPARATOR + _currEl)
}
})
})
return { key: prev.key + SEPARATOR + curr.key, values: arr }
}) || {}
_result = rowPaths.values || []
}
return _result
},
_combineColPaths(...arrays) {
return arrays.length ? arrays.reduce((prev, curr) => {
const arr = []
prev.forEach(_prevEl => {
curr.forEach(_currEl => {
arr.push(_prevEl + SEPARATOR + _currEl)
})
})
return arr
}) : arrays
},
_findCategory(keys = [], data = []) {
const _result = {}
data.forEach(item => {
keys.forEach(key => {
// Remove duplicates
_result[key] = _result[key] || []
_result[key].push(item[key])
_result[key] = [...new Set(_result[key])]
})
})
return _result
},
_reduceValue(data, key) {
if (!data.length) return 0
return data.reduce((sum, item) => { return sum + Number(item[key]) }, 0)
},
_filterData(conditions, data) {
return data.filter((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
}
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,364 @@
<template>
<div ref="chart" :style="chartStyle">ChartGeo</div>
</template>
<script>
import echarts from 'echarts'
import { convertPathToMap, SEPARATOR } from '@/utils/visual-chart'
export default {
name: 'ChartGeo',
props: {
data: {
type: Array,
required: true,
default: () => []
},
rows: {
type: Array,
required: true,
default: () => []
},
columns: {
type: Array,
required: true,
default: () => []
},
values: {
type: Array,
required: true,
default: () => []
},
chartType: {
type: String,
required: true
},
chartTheme: {
type: String,
require: true,
default: 'default'
},
chartSeriesType: {
type: String,
require: true,
default: ''
},
chartOption: {
type: Object,
require: false,
default: () => ({})
},
chartStyle: {
type: Object,
require: false,
default: () => {
return {
height: '200px'
}
}
}
},
data() {
return {
localRows: [],
localColumns: [],
localValues: [],
localData: [],
// 连接符
connector: '-',
chart: null,
calcOption: {
tooltip: { trigger: 'item' }
},
calcData: {
areaCode: '100000',
seriesObj: {}
}
}
},
computed: {
watchAllProps() {
const { rows, columns, values, data } = this
return { rows, columns, values, data }
}
},
watch: {
watchAllProps() {
this.init()
this.mergeChartOption()
},
chartTheme() {
this.mergeChartTheme()
},
chartSeriesType() {
this.mergeChartOption()
},
chartOption: {
handler(newValue, oldValue) {
this.mergeChartOption()
},
deep: true
}
},
mounted() {
this.renderChart()
this.$on('resized', this.handleResize)
window.addEventListener('resize', this.handleResize)
},
created() {
this.init()
},
beforeDestroy() {
if (this.chart) {
this.chart.dispose()
}
window.removeEventListener('resize', this.handleResize)
},
methods: {
init() {
if (this.rows.length || this.columns.length || this.values.length) {
this.handleDataClone()
this.setValuesToColAndRow()
this.handleCalcData()
} else {
console.warn('[Warn]: props.rows, props.columns, props.values at least one is not empty.')
}
},
// clone data
handleDataClone() {
this.localRows = JSON.parse(JSON.stringify(this.rows))
this.localColumns = JSON.parse(JSON.stringify(this.columns))
this.localValues = JSON.parse(JSON.stringify(this.values))
this.localData = Object.freeze(this.data)
},
// set the `values` attribute to rows and columns
setValuesToColAndRow() {
const rowKeys = this.localRows.map(({ key }) => key)
const columnKeys = this.localColumns.map(({ key }) => key)
const rowValues = this._findCategory(rowKeys, this.localData)
const columnValues = this._findCategory(columnKeys, this.localData)
this.localRows.forEach((row) => {
const { key, values } = row
this.$set(row, 'values', values || rowValues[key] || [])
})
this.localColumns.forEach((column) => {
const { key, values } = column
this.$set(column, 'values', values || columnValues[key] || [])
})
},
// 计算值
handleCalcData() {
if (!this.localRows.length || !this.localValues.length) return
const _rowPaths = this._combineRowPaths(
this.localData,
...this.localRows.map(({ key, values }) => { return { key, values } })
)
const _rowKeys = this.localRows.map(({ key }) => key)
const _colPaths = this._combineColPaths(
...this.localColumns.map(({ values }) => values)
)
const _colKeys = this.localColumns.map(({ key }) => key)
// 行对应的条件
const rowConditions = convertPathToMap(_rowPaths, _rowKeys)
// 列对应的条件
const colConditions = convertPathToMap(_colPaths, _colKeys)
// 针对没传入行或列的处理
!colConditions.length && colConditions.push({})
!rowConditions.length && rowConditions.push({})
const seriesData = []
this.localValues.forEach(({ key }) => {
rowConditions.forEach((rowCondition, rowConditionIndex) => {
// 当前单元对应的条件
const conditions = Object.assign({}, rowCondition)
// 通过当前单元对应的条件,过滤数据
const filterData = this._filterData(conditions, this.localData)
if (filterData.length) {
// 多个值,多条数据
const value = this._reduceValue(filterData, key)
seriesData.push(
{ name: Object.values(rowCondition).join(this.connector), value: value }
)
}
})
})
const seriesObj = {}
const seriesName = this.localValues[0].key
seriesObj[seriesName] = {
name: seriesName,
type: this.chartType,
map: this.calcData.areaCode,
roam: true,
selectedMode: 'single',
showLegendSymbol: false,
aspectScale: 0.75,
zoom: 3,
itemStyle: {
normal: {
areaColor: 'transparent',
borderColor: '#B5B5B5',
borderWidth: 1,
shadowColor: 'rgba(63, 218, 255, 0.5)',
shadowBlur: 30
},
emphasis: {
areaColor: '#2B91B7'
}
},
data: seriesData
}
this.calcData.seriesObj = seriesObj
},
handleResize() {
if (this.chart) {
this.chart.resize()
}
},
renderChart() {
if (!this.$refs.chart) return
let option = Object.assign({}, this.chartOption, this.calcOption)
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
this.parseChartSeries(option, series, this.chartSeriesType)
option.series = series
setTimeout(() => {
if (!this.chart) {
if (this.chartTheme !== 'default') {
require('./themes/' + this.chartTheme + '.js')
}
this.chart = echarts.init(this.$refs.chart, this.chartTheme)
}
const rawGeoJson = require('./maps/' + this.calcData.areaCode + '.json')
echarts.registerMap(this.calcData.areaCode, rawGeoJson)
this.chart.clear()
this.chart.setOption(option)
}, 0)
},
mergeChartTheme() {
if (!this.$refs.chart) return
if (this.chart) {
// 使用刚指定的配置项和数据显示图表
let option = Object.assign({}, this.chartOption, this.calcOption)
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
this.parseChartSeries(option, series, this.chartSeriesType)
option.series = series
if (this.chartTheme !== 'default') {
require('./themes/' + this.chartTheme + '.js')
}
this.chart.dispose()
// 基于准备好的dom初始化echarts实例
this.chart = echarts.init(this.$refs.chart, this.chartTheme)
this.chart.setOption(option)
}
},
mergeChartOption() {
if (!this.$refs.chart) return
if (this.chart) {
let option = Object.assign({}, this.chartOption, this.calcOption)
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
this.parseChartSeries(option, series, this.chartSeriesType)
option.series = series
this.chart.clear()
this.chart.setOption(option, true)
}
},
parseChartSeries(option, series, type) {
if (type === 'visualMap') {
option.visualMap = [{
type: 'continuous',
inRange: {
color: ['#e0ffff', '#006edd']
},
calculable: true,
pieces: [
{ gt: 100 },
{ gt: 10, lte: 99 },
{ gt: 0, lte: 9 }
]
}]
}
},
_combineRowPaths(data, ...arrays) {
const len = arrays.length
let _result = []
if (len) {
const rowPaths = arrays.reduce((prev, curr) => {
const arr = []
prev.values.forEach(_prevEl => {
const prevKey = prev.key.split(SEPARATOR)
curr.values.forEach(_currEl => {
const currKey = curr.key
const conditions = {}
prevKey.forEach((key, i) => {
conditions[key] = _prevEl.split(SEPARATOR)[i]
})
conditions[currKey] = _currEl
// 判断数据里是否有该项
const filter = data.some((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
if (filter) {
arr.push(_prevEl + SEPARATOR + _currEl)
}
})
})
return { key: prev.key + SEPARATOR + curr.key, values: arr }
}) || {}
_result = rowPaths.values || []
}
return _result
},
_combineColPaths(...arrays) {
return arrays.length ? arrays.reduce((prev, curr) => {
const arr = []
prev.forEach(_prevEl => {
curr.forEach(_currEl => {
arr.push(_prevEl + SEPARATOR + _currEl)
})
})
return arr
}) : arrays
},
_findCategory(keys = [], data = []) {
const _result = {}
data.forEach(item => {
keys.forEach(key => {
// Remove duplicates
_result[key] = _result[key] || []
_result[key].push(item[key])
_result[key] = [...new Set(_result[key])]
})
})
return _result
},
_reduceValue(data, key) {
if (!data.length) return 0
return data.reduce((sum, item) => { return sum + Number(item[key]) }, 0)
},
_filterData(conditions, data) {
return data.filter((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
}
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,365 @@
<template>
<div ref="chart" :style="chartStyle">ChartPie</div>
</template>
<script>
import echarts from 'echarts'
import { convertPathToMap, SEPARATOR } from '@/utils/visual-chart'
export default {
name: 'ChartPie',
props: {
data: {
type: Array,
required: true,
default: () => []
},
rows: {
type: Array,
required: true,
default: () => []
},
columns: {
type: Array,
required: true,
default: () => []
},
values: {
type: Array,
required: true,
default: () => []
},
chartType: {
type: String,
required: true
},
chartTheme: {
type: String,
require: true,
default: 'default'
},
chartSeriesType: {
type: String,
require: true,
default: ''
},
chartOption: {
type: Object,
require: false,
default: () => ({})
},
chartStyle: {
type: Object,
require: false,
default: () => {
return {
height: '200px'
}
}
}
},
data() {
return {
localRows: [],
localColumns: [],
localValues: [],
localData: [],
// 连接符
connector: '-',
chart: null,
calcOption: {
tooltip: { trigger: 'item' }
},
calcData: {
legendData: [],
seriesObj: {}
}
}
},
computed: {
watchAllProps() {
const { rows, columns, values, data } = this
return { rows, columns, values, data }
}
},
watch: {
watchAllProps() {
this.init()
this.mergeChartOption()
},
chartTheme() {
this.mergeChartTheme()
},
chartSeriesType() {
this.mergeChartOption()
},
chartOption: {
handler(newValue, oldValue) {
this.mergeChartOption()
},
deep: true
}
},
mounted() {
this.renderChart()
this.$on('resized', this.handleResize)
window.addEventListener('resize', this.handleResize)
},
created() {
this.init()
},
beforeDestroy() {
if (this.chart) {
this.chart.dispose()
}
window.removeEventListener('resize', this.handleResize)
},
methods: {
init() {
if (this.rows.length || this.columns.length || this.values.length) {
this.handleDataClone()
this.setValuesToColAndRow()
this.handleCalcData()
} else {
console.warn('[Warn]: props.rows, props.columns, props.values at least one is not empty.')
}
},
// clone data
handleDataClone() {
this.localRows = JSON.parse(JSON.stringify(this.rows))
this.localColumns = JSON.parse(JSON.stringify(this.columns))
this.localValues = JSON.parse(JSON.stringify(this.values))
this.localData = Object.freeze(this.data)
},
// set the `values` attribute to rows and columns
setValuesToColAndRow() {
const rowKeys = this.localRows.map(({ key }) => key)
const columnKeys = this.localColumns.map(({ key }) => key)
const rowValues = this._findCategory(rowKeys, this.localData)
const columnValues = this._findCategory(columnKeys, this.localData)
this.localRows.forEach((row) => {
const { key, values } = row
this.$set(row, 'values', values || rowValues[key] || [])
})
this.localColumns.forEach((column) => {
const { key, values } = column
this.$set(column, 'values', values || columnValues[key] || [])
})
},
// 计算值
handleCalcData() {
if (!this.localRows.length || !this.localValues.length) return
const _rowPaths = this._combineRowPaths(
this.localData,
...this.localRows.map(({ key, values }) => { return { key, values } })
)
const _rowKeys = this.localRows.map(({ key }) => key)
const _colPaths = this._combineColPaths(
...this.localColumns.map(({ values }) => values)
)
const _colKeys = this.localColumns.map(({ key }) => key)
// 行对应的条件
const rowConditions = convertPathToMap(_rowPaths, _rowKeys)
// 列对应的条件
const colConditions = convertPathToMap(_colPaths, _colKeys)
// 针对没传入行或列的处理
!colConditions.length && colConditions.push({})
!rowConditions.length && rowConditions.push({})
const legendData = []
rowConditions.forEach((rowCondition) => {
legendData.push(Object.values(rowCondition).join(this.connector))
})
const seriesObj = {}
const b = 100 / (colConditions.length * this.localValues.length * 9 + 1)
colConditions.forEach((colCondition, colConditionIndex) => {
const isEmptyCol = !Object.keys(colCondition).length
this.localValues.forEach(({ key }, index) => {
const seriesName = isEmptyCol ? key : Object.values(colCondition).join(this.connector) + this.connector + key
seriesObj[seriesName] = {
name: seriesName,
type: this.chartType,
center: [5 * b + (colConditionIndex + 1) * index * 9 * b + '%', '50%'],
data: []
}
})
})
// 计算每个series数据
colConditions.forEach((colCondition, colConditionIndex) => {
const isEmptyCol = !Object.keys(colCondition).length
rowConditions.forEach((rowCondition, rowConditionIndex) => {
// 当前单元对应的条件
const conditions = Object.assign({}, rowCondition, colCondition)
// 通过当前单元对应的条件,过滤数据
const filterData = this._filterData(conditions, this.localData)
// 多个值,多条数据
this.localValues.forEach(({ key }) => {
const value = this._reduceValue(filterData, key)
const seriesName = isEmptyCol ? key : Object.values(colCondition).join(this.connector) + this.connector + key
seriesObj[seriesName].data.push(
{
name: Object.values(rowCondition).join(this.connector),
value: value
}
)
})
})
})
this.calcData.legendData = legendData
this.calcData.seriesObj = seriesObj
},
handleResize() {
if (this.chart) {
this.chart.resize()
}
},
renderChart() {
if (!this.$refs.chart) return
let option = Object.assign({}, this.chartOption, this.calcOption)
option.legend.data = this.calcData.legendData
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
this.parseChartSeries(option, series, this.chartSeriesType)
option.series = series
setTimeout(() => {
if (!this.chart) {
if (this.chartTheme !== 'default') {
require('./themes/' + this.chartTheme + '.js')
}
this.chart = echarts.init(this.$refs.chart, this.chartTheme)
}
this.chart.clear()
this.chart.setOption(option)
}, 0)
},
mergeChartTheme() {
if (!this.$refs.chart) return
if (this.chart) {
// 使用刚指定的配置项和数据显示图表
let option = Object.assign({}, this.chartOption, this.calcOption)
option.legend.data = this.calcData.legendData
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
this.parseChartSeries(option, series, this.chartSeriesType)
option.series = series
if (this.chartTheme !== 'default') {
require('./themes/' + this.chartTheme + '.js')
}
this.chart.dispose()
// 基于准备好的dom初始化echarts实例
this.chart = echarts.init(this.$refs.chart, this.chartTheme)
this.chart.setOption(option)
}
},
mergeChartOption() {
if (!this.$refs.chart) return
if (this.chart) {
let option = Object.assign({}, this.chartOption, this.calcOption)
option.legend.data = this.calcData.legendData
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
this.parseChartSeries(option, series, this.chartSeriesType)
option.series = series
this.chart.clear()
this.chart.setOption(option, true)
}
},
parseChartSeries(option, series, type) {
if (type === 'roseradiuspie') {
series.forEach((item) => {
item.roseType = 'radius'
item.radius = ['30%', '100%']
})
} else if (type === 'roseareapie') {
series.forEach((item) => {
item.roseType = 'area'
item.radius = ['30%', '100%']
})
} else if (type === 'donutpie') {
series.forEach((item) => {
item.radius = ['70%', '100%']
})
}
},
_combineRowPaths(data, ...arrays) {
const len = arrays.length
let _result = []
if (len) {
const rowPaths = arrays.reduce((prev, curr) => {
const arr = []
prev.values.forEach(_prevEl => {
const prevKey = prev.key.split(SEPARATOR)
curr.values.forEach(_currEl => {
const currKey = curr.key
const conditions = {}
prevKey.forEach((key, i) => {
conditions[key] = _prevEl.split(SEPARATOR)[i]
})
conditions[currKey] = _currEl
// 判断数据里是否有该项
const filter = data.some((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
if (filter) {
arr.push(_prevEl + SEPARATOR + _currEl)
}
})
})
return { key: prev.key + SEPARATOR + curr.key, values: arr }
}) || {}
_result = rowPaths.values || []
}
return _result
},
_combineColPaths(...arrays) {
return arrays.length ? arrays.reduce((prev, curr) => {
const arr = []
prev.forEach(_prevEl => {
curr.forEach(_currEl => {
arr.push(_prevEl + SEPARATOR + _currEl)
})
})
return arr
}) : arrays
},
_findCategory(keys = [], data = []) {
const _result = {}
data.forEach(item => {
keys.forEach(key => {
// Remove duplicates
_result[key] = _result[key] || []
_result[key].push(item[key])
_result[key] = [...new Set(_result[key])]
})
})
return _result
},
_reduceValue(data, key) {
if (!data.length) return 0
return data.reduce((sum, item) => { return sum + Number(item[key]) }, 0)
},
_filterData(conditions, data) {
return data.filter((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
}
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,60 @@
<template>
<div ref="chart" :style="chartStyle">ChartPolar</div>
</template>
<script>
export default {
name: 'ChartPolar',
props: {
data: {
type: Array,
required: true,
default: () => []
},
rows: {
type: Array,
required: true,
default: () => []
},
columns: {
type: Array,
required: true,
default: () => []
},
values: {
type: Array,
required: true,
default: () => []
},
chartType: {
type: String,
required: true
},
chartTheme: {
type: String,
require: true
},
chartOption: {
type: Object,
require: false,
default: () => ({})
},
chartStyle: {
type: Object,
require: false,
default: () => {
return {
height: '200px'
}
}
}
},
created() {
console.log(this.data)
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,369 @@
<template>
<div ref="chart" :style="chartStyle">ChartRadar</div>
</template>
<script>
import echarts from 'echarts'
import { convertPathToMap, SEPARATOR } from '@/utils/visual-chart'
export default {
name: 'ChartRadar',
props: {
data: {
type: Array,
required: true,
default: () => []
},
rows: {
type: Array,
required: true,
default: () => []
},
columns: {
type: Array,
required: true,
default: () => []
},
values: {
type: Array,
required: true,
default: () => []
},
chartType: {
type: String,
required: true
},
chartTheme: {
type: String,
require: true,
default: 'default'
},
chartSeriesType: {
type: String,
require: true,
default: ''
},
chartOption: {
type: Object,
require: false,
default: () => ({})
},
chartStyle: {
type: Object,
require: false,
default: () => {
return {
height: '200px'
}
}
}
},
data() {
return {
localRows: [],
localColumns: [],
localValues: [],
localData: [],
// 连接符
connector: '-',
chart: null,
calcOption: {
radar: {
indicator: [],
axisLine: {
lineStyle: {
color: 'rgba(0, 0, 0, 1)'
}
}
},
tooltip: { trigger: 'item' }
},
calcData: {
legendData: [],
radarIndicator: [],
seriesObj: {}
}
}
},
computed: {
watchAllProps() {
const { rows, columns, values, data } = this
return { rows, columns, values, data }
}
},
watch: {
watchAllProps() {
this.init()
this.mergeChartOption()
},
chartTheme() {
this.mergeChartTheme()
},
chartSeriesType() {
this.mergeChartOption()
},
chartOption: {
handler(newValue, oldValue) {
this.mergeChartOption()
},
deep: true
}
},
mounted() {
this.renderChart()
this.$on('resized', this.handleResize)
window.addEventListener('resize', this.handleResize)
},
created() {
this.init()
},
beforeDestroy() {
if (this.chart) {
this.chart.dispose()
}
window.removeEventListener('resize', this.handleResize)
},
methods: {
init() {
if (this.rows.length || this.columns.length || this.values.length) {
this.handleDataClone()
this.setValuesToColAndRow()
this.handleCalcData()
} else {
console.warn('[Warn]: props.rows, props.columns, props.values at least one is not empty.')
}
},
// clone data
handleDataClone() {
this.localRows = JSON.parse(JSON.stringify(this.rows))
this.localColumns = JSON.parse(JSON.stringify(this.columns))
this.localValues = JSON.parse(JSON.stringify(this.values))
this.localData = Object.freeze(this.data)
},
// set the `values` attribute to rows and columns
setValuesToColAndRow() {
const rowKeys = this.localRows.map(({ key }) => key)
const columnKeys = this.localColumns.map(({ key }) => key)
const rowValues = this._findCategory(rowKeys, this.localData)
const columnValues = this._findCategory(columnKeys, this.localData)
this.localRows.forEach((row) => {
const { key, values } = row
this.$set(row, 'values', values || rowValues[key] || [])
})
this.localColumns.forEach((column) => {
const { key, values } = column
this.$set(column, 'values', values || columnValues[key] || [])
})
},
// 计算值
handleCalcData() {
if (!this.localRows.length || !this.localValues.length) return
const _rowPaths = this._combineRowPaths(
this.localData,
...this.localRows.map(({ key, values }) => { return { key, values } })
)
const _rowKeys = this.localRows.map(({ key }) => key)
const _colPaths = this._combineColPaths(
...this.localColumns.map(({ values }) => values)
)
const _colKeys = this.localColumns.map(({ key }) => key)
// 行对应的条件
const rowConditions = convertPathToMap(_rowPaths, _rowKeys)
// 列对应的条件
const colConditions = convertPathToMap(_colPaths, _colKeys)
// 针对没传入行或列的处理
!colConditions.length && colConditions.push({})
!rowConditions.length && rowConditions.push({})
const radarIndicator = []
const legendData = []
const seriesObj = {}
const seriesDataObj = {}
rowConditions.forEach((rowCondition) => {
radarIndicator.push({ name: Object.values(rowCondition).join(this.connector) })
})
colConditions.forEach((colCondition) => {
const isEmptyCol = !Object.keys(colCondition).length
this.localValues.forEach(({ key }) => {
const seriesName = isEmptyCol ? key : Object.values(colCondition).join(this.connector) + this.connector + key
legendData.push(seriesName)
seriesDataObj[seriesName] = {
name: seriesName,
value: []
}
})
})
seriesObj.radar = {
name: 'radar',
type: this.chartType,
data: []
}
// 计算每个series数据
colConditions.forEach((colCondition, colConditionIndex) => {
const isEmptyCol = !Object.keys(colCondition).length
rowConditions.forEach((rowCondition, rowConditionIndex) => {
// 当前单元对应的条件
const conditions = Object.assign({}, rowCondition, colCondition)
// 通过当前单元对应的条件,过滤数据
const filterData = this._filterData(conditions, this.localData)
// 多个值,多条数据
this.localValues.forEach(({ key }) => {
const value = this._reduceValue(filterData, key)
const seriesName = isEmptyCol ? key : Object.values(colCondition).join(this.connector) + this.connector + key
seriesDataObj[seriesName].value.push(value)
})
})
})
seriesObj.radar.data = Object.values(seriesDataObj)
this.calcData.legendData = legendData
this.calcData.radarIndicator = radarIndicator
this.calcData.seriesObj = seriesObj
},
handleResize() {
if (this.chart) {
this.chart.resize()
}
},
renderChart() {
if (!this.$refs.chart) return
let option = Object.assign({}, this.chartOption, this.calcOption)
option.legend.data = this.calcData.legendData
option.radar.indicator = this.calcData.radarIndicator
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
this.parseChartSeries(option, series, this.chartSeriesType)
option.series = series
setTimeout(() => {
if (!this.chart) {
if (this.chartTheme !== 'default') {
require('./themes/' + this.chartTheme + '.js')
}
this.chart = echarts.init(this.$refs.chart, this.chartTheme)
}
this.chart.clear()
this.chart.setOption(option)
}, 0)
},
mergeChartTheme() {
if (!this.$refs.chart) return
if (this.chart) {
// 使用刚指定的配置项和数据显示图表
let option = Object.assign({}, this.chartOption, this.calcOption)
option.legend.data = this.calcData.legendData
option.radar.indicator = this.calcData.radarIndicator
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
this.parseChartSeries(option, series, this.chartSeriesType)
option.series = series
if (this.chartTheme !== 'default') {
require('./themes/' + this.chartTheme + '.js')
}
this.chart.dispose()
// 基于准备好的dom初始化echarts实例
this.chart = echarts.init(this.$refs.chart, this.chartTheme)
this.chart.setOption(option)
}
},
mergeChartOption() {
if (!this.$refs.chart) return
if (this.chart) {
let option = Object.assign({}, this.chartOption, this.calcOption)
option.legend.data = this.calcData.legendData
option.radar.indicator = this.calcData.radarIndicator
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
this.parseChartSeries(option, series, this.chartSeriesType)
option.series = series
this.chart.clear()
this.chart.setOption(option, true)
}
},
parseChartSeries(option, series, type) {
if (type === 'arearadar') {
series.forEach((item) => {
item.areaStyle = {}
})
}
},
_combineRowPaths(data, ...arrays) {
const len = arrays.length
let _result = []
if (len) {
const rowPaths = arrays.reduce((prev, curr) => {
const arr = []
prev.values.forEach(_prevEl => {
const prevKey = prev.key.split(SEPARATOR)
curr.values.forEach(_currEl => {
const currKey = curr.key
const conditions = {}
prevKey.forEach((key, i) => {
conditions[key] = _prevEl.split(SEPARATOR)[i]
})
conditions[currKey] = _currEl
// 判断数据里是否有该项
const filter = data.some((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
if (filter) {
arr.push(_prevEl + SEPARATOR + _currEl)
}
})
})
return { key: prev.key + SEPARATOR + curr.key, values: arr }
}) || {}
_result = rowPaths.values || []
}
return _result
},
_combineColPaths(...arrays) {
return arrays.length ? arrays.reduce((prev, curr) => {
const arr = []
prev.forEach(_prevEl => {
curr.forEach(_currEl => {
arr.push(_prevEl + SEPARATOR + _currEl)
})
})
return arr
}) : arrays
},
_findCategory(keys = [], data = []) {
const _result = {}
data.forEach(item => {
keys.forEach(key => {
// Remove duplicates
_result[key] = _result[key] || []
_result[key].push(item[key])
_result[key] = [...new Set(_result[key])]
})
})
return _result
},
_reduceValue(data, key) {
if (!data.length) return 0
return data.reduce((sum, item) => { return sum + Number(item[key]) }, 0)
},
_filterData(conditions, data) {
return data.filter((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
}
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,354 @@
<template>
<div ref="chart" :style="chartStyle">ChartSankey</div>
</template>
<script>
import echarts from 'echarts'
import { convertPathToMap, SEPARATOR } from '@/utils/visual-chart'
export default {
name: 'ChartSankey',
props: {
data: {
type: Array,
required: true,
default: () => []
},
rows: {
type: Array,
required: true,
default: () => []
},
columns: {
type: Array,
required: true,
default: () => []
},
values: {
type: Array,
required: true,
default: () => []
},
chartType: {
type: String,
required: true
},
chartTheme: {
type: String,
require: true,
default: 'default'
},
chartOption: {
type: Object,
require: false,
default: () => ({})
},
chartStyle: {
type: Object,
require: false,
default: () => {
return {
height: '200px'
}
}
}
},
data() {
return {
localRows: [],
localColumns: [],
localValues: [],
localData: [],
// 连接符
connector: '-',
chart: null,
calcOption: {
tooltip: { trigger: 'item' }
},
calcData: {
seriesObj: {}
}
}
},
computed: {
watchAllProps() {
const { rows, columns, values, data } = this
return { rows, columns, values, data }
}
},
watch: {
watchAllProps() {
this.init()
this.mergeChartOption()
},
chartTheme() {
this.mergeChartTheme()
},
chartOption: {
handler(newValue, oldValue) {
this.mergeChartOption()
},
deep: true
}
},
mounted() {
this.renderChart()
this.$on('resized', this.handleResize)
window.addEventListener('resize', this.handleResize)
},
created() {
this.init()
},
beforeDestroy() {
if (this.chart) {
this.chart.dispose()
}
window.removeEventListener('resize', this.handleResize)
},
methods: {
init() {
if (this.rows.length || this.columns.length || this.values.length) {
this.handleDataClone()
this.setValuesToColAndRow()
this.handleCalcData()
} else {
console.warn('[Warn]: props.rows, props.columns, props.values at least one is not empty.')
}
},
// clone data
handleDataClone() {
this.localRows = JSON.parse(JSON.stringify(this.rows))
this.localColumns = JSON.parse(JSON.stringify(this.columns))
this.localValues = JSON.parse(JSON.stringify(this.values))
this.localData = Object.freeze(this.data)
},
// set the `values` attribute to rows and columns
setValuesToColAndRow() {
const rowKeys = this.localRows.map(({ key }) => key)
const columnKeys = this.localColumns.map(({ key }) => key)
const rowValues = this._findCategory(rowKeys, this.localData)
const columnValues = this._findCategory(columnKeys, this.localData)
this.localRows.forEach((row) => {
const { key, values } = row
this.$set(row, 'values', values || rowValues[key] || [])
})
this.localColumns.forEach((column) => {
const { key, values } = column
this.$set(column, 'values', values || columnValues[key] || [])
})
},
// 计算值
handleCalcData() {
if (!this.localRows.length || !this.localValues.length) return
const _rowPaths = this._combineRowPaths(
this.localData,
...this.localRows.map(({ key, values }) => { return { key, values } })
)
const _rowKeys = this.localRows.map(({ key }) => key)
const _colPaths = this._combineColPaths(
...this.localColumns.map(({ values }) => values)
)
const _colKeys = this.localColumns.map(({ key }) => key)
// 行对应的条件
const rowConditions = convertPathToMap(_rowPaths, _rowKeys)
// 列对应的条件
const colConditions = convertPathToMap(_colPaths, _colKeys)
// 针对没传入行或列的处理
!colConditions.length && colConditions.push({})
!rowConditions.length && rowConditions.push({})
const seriesData = []
const seriesLinks = []
rowConditions.forEach((rowCondition, rowConditionIndex) => {
seriesData.push({ name: Object.values(rowCondition).join(this.connector) })
})
// 判断没传入列的处理
if (!this.localColumns.length) {
this.localValues.forEach(({ key }) => {
seriesData.push({ name: key })
rowConditions.forEach((rowCondition, rowConditionIndex) => {
// 当前单元对应的条件
const conditions = Object.assign({}, rowCondition)
// 通过当前单元对应的条件,过滤数据
const filterData = this._filterData(conditions, this.localData)
if (filterData.length) {
// 多个值,多条数据
const value = this._reduceValue(filterData, key)
seriesLinks.push(
{
source: Object.values(rowCondition).join(this.connector),
target: key,
value: value
}
)
}
})
})
} else {
colConditions.forEach((colCondition, colConditionIndex) => {
seriesData.push({ name: Object.values(colCondition).join(this.connector) })
rowConditions.forEach((rowCondition, rowConditionIndex) => {
// 当前单元对应的条件
const conditions = Object.assign({}, rowCondition, colCondition)
// 通过当前单元对应的条件,过滤数据
const filterData = this._filterData(conditions, this.localData)
if (filterData.length) {
// 多个值,多条数据
this.localValues.forEach(({ key }) => {
const value = this._reduceValue(filterData, key)
seriesLinks.push(
{
source: Object.values(rowCondition).join(this.connector),
target: Object.values(colCondition).join(this.connector),
value: value
}
)
})
}
})
})
}
const seriesObj = {}
const seriesName = 'sankey'
seriesObj[seriesName] = {
name: seriesName,
type: this.chartType,
layout: 'none',
draggable: false,
links: seriesLinks,
data: seriesData
}
this.calcData.seriesObj = seriesObj
},
handleResize() {
if (this.chart) {
this.chart.resize()
}
},
renderChart() {
if (!this.$refs.chart) return
let option = Object.assign({}, this.chartOption, this.calcOption)
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
option.series = series
setTimeout(() => {
if (!this.chart) {
if (this.chartTheme !== 'default') {
require('./themes/' + this.chartTheme + '.js')
}
this.chart = echarts.init(this.$refs.chart, this.chartTheme)
}
this.chart.clear()
this.chart.setOption(option)
}, 0)
},
mergeChartTheme() {
if (!this.$refs.chart) return
if (this.chart) {
// 使用刚指定的配置项和数据显示图表
let option = Object.assign({}, this.chartOption, this.calcOption)
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
option.series = series
if (this.chartTheme !== 'default') {
require('./themes/' + this.chartTheme + '.js')
}
this.chart.dispose()
// 基于准备好的dom初始化echarts实例
this.chart = echarts.init(this.$refs.chart, this.chartTheme)
this.chart.setOption(option)
}
},
mergeChartOption() {
if (!this.$refs.chart) return
if (this.chart) {
let option = Object.assign({}, this.chartOption, this.calcOption)
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
option.series = series
this.chart.clear()
this.chart.setOption(option, true)
}
},
_combineRowPaths(data, ...arrays) {
const len = arrays.length
let _result = []
if (len) {
const rowPaths = arrays.reduce((prev, curr) => {
const arr = []
prev.values.forEach(_prevEl => {
const prevKey = prev.key.split(SEPARATOR)
curr.values.forEach(_currEl => {
const currKey = curr.key
const conditions = {}
prevKey.forEach((key, i) => {
conditions[key] = _prevEl.split(SEPARATOR)[i]
})
conditions[currKey] = _currEl
// 判断数据里是否有该项
const filter = data.some((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
if (filter) {
arr.push(_prevEl + SEPARATOR + _currEl)
}
})
})
return { key: prev.key + SEPARATOR + curr.key, values: arr }
}) || {}
_result = rowPaths.values || []
}
return _result
},
_combineColPaths(...arrays) {
return arrays.length ? arrays.reduce((prev, curr) => {
const arr = []
prev.forEach(_prevEl => {
curr.forEach(_currEl => {
arr.push(_prevEl + SEPARATOR + _currEl)
})
})
return arr
}) : arrays
},
_findCategory(keys = [], data = []) {
const _result = {}
data.forEach(item => {
keys.forEach(key => {
// Remove duplicates
_result[key] = _result[key] || []
_result[key].push(item[key])
_result[key] = [...new Set(_result[key])]
})
})
return _result
},
_reduceValue(data, key) {
if (!data.length) return 0
return data.reduce((sum, item) => { return sum + Number(item[key]) }, 0)
},
_filterData(conditions, data) {
return data.filter((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
}
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,375 @@
<template>
<div ref="chart" :style="chartStyle">ChartScatter</div>
</template>
<script>
import echarts from 'echarts'
import { convertPathToMap, SEPARATOR } from '@/utils/visual-chart'
export default {
name: 'ChartScatter',
props: {
data: {
type: Array,
required: true,
default: () => []
},
rows: {
type: Array,
required: true,
default: () => []
},
columns: {
type: Array,
required: true,
default: () => []
},
values: {
type: Array,
required: true,
default: () => []
},
chartType: {
type: String,
required: true
},
chartTheme: {
type: String,
require: true,
default: 'default'
},
chartOption: {
type: Object,
require: false,
default: () => ({})
},
chartStyle: {
type: Object,
require: false,
default: () => {
return {
height: '200px'
}
}
}
},
data() {
return {
localRows: [],
localColumns: [],
localValues: [],
localData: [],
// 连接符
connector: '-',
chart: null,
calcOption: {
xAxis: {
axisLine: {
lineStyle: {
color: 'rgba(0, 0, 0, 1)'
}
}
},
yAxis: {
axisLine: {
lineStyle: {
color: 'rgba(0, 0, 0, 1)'
}
}
},
tooltip: { trigger: 'item' }
},
calcData: {
legendData: [],
xAxisData: [],
seriesObj: {}
}
}
},
computed: {
watchAllProps() {
const { rows, columns, values, data } = this
return { rows, columns, values, data }
}
},
watch: {
watchAllProps() {
this.init()
this.mergeChartOption()
},
chartTheme() {
this.mergeChartTheme()
},
chartOption: {
handler(newValue, oldValue) {
this.mergeChartOption()
},
deep: true
}
},
mounted() {
this.renderChart()
this.$on('resized', this.handleResize)
window.addEventListener('resize', this.handleResize)
},
created() {
this.init()
},
beforeDestroy() {
if (this.chart) {
this.chart.dispose()
}
window.removeEventListener('resize', this.handleResize)
},
methods: {
init() {
if (this.rows.length || this.columns.length || this.values.length) {
this.handleDataClone()
this.setValuesToColAndRow()
this.handleCalcData()
} else {
console.warn('[Warn]: props.rows, props.columns, props.values at least one is not empty.')
}
},
// clone data
handleDataClone() {
this.localRows = JSON.parse(JSON.stringify(this.rows))
this.localColumns = JSON.parse(JSON.stringify(this.columns))
this.localValues = JSON.parse(JSON.stringify(this.values))
this.localData = Object.freeze(this.data)
},
// set the `values` attribute to rows and columns
setValuesToColAndRow() {
const rowKeys = this.localRows.map(({ key }) => key)
const columnKeys = this.localColumns.map(({ key }) => key)
const rowValues = this._findCategory(rowKeys, this.localData)
const columnValues = this._findCategory(columnKeys, this.localData)
this.localRows.forEach((row) => {
const { key, values } = row
this.$set(row, 'values', values || rowValues[key] || [])
})
this.localColumns.forEach((column) => {
const { key, values } = column
this.$set(column, 'values', values || columnValues[key] || [])
})
},
// 计算值
handleCalcData() {
if (!this.localRows.length || !this.localValues.length) return
const _rowPaths = this._combineRowPaths(
this.localData,
...this.localRows.map(({ key, values }) => { return { key, values } })
)
const _rowKeys = this.localRows.map(({ key }) => key)
const _colPaths = this._combineColPaths(
...this.localColumns.map(({ values }) => values)
)
const _colKeys = this.localColumns.map(({ key }) => key)
// 行对应的条件
const rowConditions = convertPathToMap(_rowPaths, _rowKeys)
// 列对应的条件
const colConditions = convertPathToMap(_colPaths, _colKeys)
// 针对没传入行或列的处理
!colConditions.length && colConditions.push({})
!rowConditions.length && rowConditions.push({})
const xAxisData = []
const legendData = []
const seriesObj = {}
rowConditions.forEach((rowCondition) => {
xAxisData.push(Object.values(rowCondition).join(this.connector))
})
colConditions.forEach((colCondition) => {
const seriesName = Object.values(colCondition).join(this.connector) || ''
legendData.push(seriesName)
seriesObj[seriesName] = {
name: seriesName,
type: this.chartType,
data: []
}
})
// 计算每个series数据
colConditions.forEach((colCondition, colConditionIndex) => {
const seriesName = Object.values(colCondition).join(this.connector) || ''
const seriesData = []
rowConditions.forEach((rowCondition, rowConditionIndex) => {
const seriesDataName = Object.values(rowCondition).join(this.connector)
const seriesDataValue = { name: '', value: [] }
seriesDataValue.name = seriesDataName
seriesDataValue.value.push(seriesDataName)
// 当前单元对应的条件
const conditions = Object.assign({}, rowCondition, colCondition)
// 通过当前单元对应的条件,过滤数据
const filterData = this._filterData(conditions, this.localData)
// 多个值,多条数据
this.localValues.forEach(({ key }) => {
const value = this._reduceValue(filterData, key)
seriesDataValue.value.push(value)
})
seriesData.push(seriesDataValue)
})
seriesObj[seriesName].data = seriesData
})
this.calcData.legendData = legendData
this.calcData.xAxisData = xAxisData
this.calcData.seriesObj = seriesObj
},
handleResize() {
if (this.chart) {
this.chart.resize()
}
},
renderChart() {
if (!this.$refs.chart) return
let option = Object.assign({}, this.chartOption, this.calcOption)
option.legend.data = this.calcData.legendData
option.xAxis.data = this.calcData.xAxisData
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
option.series = series
option.tooltip.formatter = (params) => {
let s = params.seriesName + ' ' + params.name + '</br>'
this.localValues.forEach(({ key }, index) => {
s += key + ' : ' + params.value[index + 1] + '<br>'
})
return s
}
setTimeout(() => {
if (!this.chart) {
if (this.chartTheme !== 'default') {
require('./themes/' + this.chartTheme + '.js')
}
this.chart = echarts.init(this.$refs.chart, this.chartTheme)
}
this.chart.clear()
this.chart.setOption(option)
}, 0)
},
mergeChartTheme() {
if (!this.$refs.chart) return
if (this.chart) {
// 使用刚指定的配置项和数据显示图表
let option = Object.assign({}, this.chartOption, this.calcOption)
option.legend.data = this.calcData.legendData
option.xAxis.data = this.calcData.xAxisData
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
option.series = series
option.tooltip.formatter = (params) => {
let s = params.seriesName + ' ' + params.name + '</br>'
this.localValues.forEach(({ key }, index) => {
s += key + ' : ' + params.value[index + 1] + '<br>'
})
return s
}
if (this.chartTheme !== 'default') {
require('./themes/' + this.chartTheme + '.js')
}
this.chart.dispose()
// 基于准备好的dom初始化echarts实例
this.chart = echarts.init(this.$refs.chart, this.chartTheme)
this.chart.setOption(option)
}
},
mergeChartOption() {
if (!this.$refs.chart) return
if (this.chart) {
let option = Object.assign({}, this.chartOption, this.calcOption)
option.legend.data = this.calcData.legendData
option.xAxis.data = this.calcData.xAxisData
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
option.series = series
option.tooltip.formatter = (params) => {
let s = params.seriesName + ' ' + params.name + '</br>'
this.localValues.forEach(({ key }, index) => {
s += key + ' : ' + params.value[index + 1] + '<br>'
})
return s
}
this.chart.clear()
this.chart.setOption(option, true)
}
},
_combineRowPaths(data, ...arrays) {
const len = arrays.length
let _result = []
if (len) {
const rowPaths = arrays.reduce((prev, curr) => {
const arr = []
prev.values.forEach(_prevEl => {
const prevKey = prev.key.split(SEPARATOR)
curr.values.forEach(_currEl => {
const currKey = curr.key
const conditions = {}
prevKey.forEach((key, i) => {
conditions[key] = _prevEl.split(SEPARATOR)[i]
})
conditions[currKey] = _currEl
// 判断数据里是否有该项
const filter = data.some((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
if (filter) {
arr.push(_prevEl + SEPARATOR + _currEl)
}
})
})
return { key: prev.key + SEPARATOR + curr.key, values: arr }
}) || {}
_result = rowPaths.values || []
}
return _result
},
_combineColPaths(...arrays) {
return arrays.length ? arrays.reduce((prev, curr) => {
const arr = []
prev.forEach(_prevEl => {
curr.forEach(_currEl => {
arr.push(_prevEl + SEPARATOR + _currEl)
})
})
return arr
}) : arrays
},
_findCategory(keys = [], data = []) {
const _result = {}
data.forEach(item => {
keys.forEach(key => {
// Remove duplicates
_result[key] = _result[key] || []
_result[key].push(item[key])
_result[key] = [...new Set(_result[key])]
})
})
return _result
},
_reduceValue(data, key) {
if (!data.length) return 0
return data.reduce((sum, item) => { return sum + Number(item[key]) }, 0)
},
_filterData(conditions, data) {
return data.filter((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
}
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,60 @@
<template>
<div ref="chart" :style="chartStyle">ChartSunburst</div>
</template>
<script>
export default {
name: 'ChartSunburst',
props: {
data: {
type: Array,
required: true,
default: () => []
},
rows: {
type: Array,
required: true,
default: () => []
},
columns: {
type: Array,
required: true,
default: () => []
},
values: {
type: Array,
required: true,
default: () => []
},
chartType: {
type: String,
required: true
},
chartTheme: {
type: String,
require: true
},
chartOption: {
type: Object,
require: false,
default: () => ({})
},
chartStyle: {
type: Object,
require: false,
default: () => {
return {
height: '200px'
}
}
}
},
created() {
console.log(this.data)
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,57 @@
<template>
<div ref="chart" :style="chartStyle" style="overflow: auto;">
<pivot-table
ref="pivottable"
:data="data"
:rows="rows"
:columns="columns"
:values="values"
/>
</div>
</template>
<script>
import PivotTable from '@/components/PivotTable'
export default {
name: 'ChartTable',
components: {
PivotTable
},
props: {
data: {
type: Array,
required: true,
default: () => []
},
rows: {
type: Array,
required: true,
default: () => []
},
columns: {
type: Array,
required: true,
default: () => []
},
values: {
type: Array,
required: true,
default: () => []
},
chartStyle: {
type: Object,
require: false,
default: () => {
return {
height: '200px'
}
}
}
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,60 @@
<template>
<div ref="chart" :style="chartStyle">ChartTree</div>
</template>
<script>
export default {
name: 'ChartTree',
props: {
data: {
type: Array,
required: true,
default: () => []
},
rows: {
type: Array,
required: true,
default: () => []
},
columns: {
type: Array,
required: true,
default: () => []
},
values: {
type: Array,
required: true,
default: () => []
},
chartType: {
type: String,
required: true
},
chartTheme: {
type: String,
require: true
},
chartOption: {
type: Object,
require: false,
default: () => ({})
},
chartStyle: {
type: Object,
require: false,
default: () => {
return {
height: '200px'
}
}
}
},
created() {
console.log(this.data)
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,344 @@
<template>
<div ref="chart" :style="chartStyle">ChartTreemap</div>
</template>
<script>
import echarts from 'echarts'
import { convertPathToMap, SEPARATOR } from '@/utils/visual-chart'
export default {
name: 'ChartTreemap',
props: {
data: {
type: Array,
required: true,
default: () => []
},
rows: {
type: Array,
required: true,
default: () => []
},
columns: {
type: Array,
required: true,
default: () => []
},
values: {
type: Array,
required: true,
default: () => []
},
chartType: {
type: String,
required: true
},
chartTheme: {
type: String,
require: true,
default: 'default'
},
chartOption: {
type: Object,
require: false,
default: () => ({})
},
chartStyle: {
type: Object,
require: false,
default: () => {
return {
height: '200px'
}
}
}
},
data() {
return {
localRows: [],
localColumns: [],
localValues: [],
localData: [],
// 连接符
connector: '-',
chart: null,
calcOption: {
tooltip: {
trigger: 'item',
formatter: '{b} : {c}'
}
},
calcData: {
seriesObj: {}
}
}
},
computed: {
watchAllProps() {
const { rows, columns, values, data } = this
return { rows, columns, values, data }
}
},
watch: {
watchAllProps() {
this.init()
this.mergeChartOption()
},
chartTheme() {
this.mergeChartTheme()
},
chartOption: {
handler(newValue, oldValue) {
this.mergeChartOption()
},
deep: true
}
},
mounted() {
this.renderChart()
this.$on('resized', this.handleResize)
window.addEventListener('resize', this.handleResize)
},
created() {
this.init()
},
beforeDestroy() {
if (this.chart) {
this.chart.dispose()
}
window.removeEventListener('resize', this.handleResize)
},
methods: {
init() {
if (this.rows.length || this.columns.length || this.values.length) {
this.handleDataClone()
this.setValuesToColAndRow()
this.handleCalcData()
} else {
console.warn('[Warn]: props.rows, props.columns, props.values at least one is not empty.')
}
},
// clone data
handleDataClone() {
this.localRows = JSON.parse(JSON.stringify(this.rows))
this.localColumns = JSON.parse(JSON.stringify(this.columns))
this.localValues = JSON.parse(JSON.stringify(this.values))
this.localData = Object.freeze(this.data)
},
// set the `values` attribute to rows and columns
setValuesToColAndRow() {
const rowKeys = this.localRows.map(({ key }) => key)
const columnKeys = this.localColumns.map(({ key }) => key)
const rowValues = this._findCategory(rowKeys, this.localData)
const columnValues = this._findCategory(columnKeys, this.localData)
this.localRows.forEach((row) => {
const { key, values } = row
this.$set(row, 'values', values || rowValues[key] || [])
})
this.localColumns.forEach((column) => {
const { key, values } = column
this.$set(column, 'values', values || columnValues[key] || [])
})
},
// 计算值
handleCalcData() {
if (!this.localRows.length || !this.localValues.length) return
const seriesData = this.recursion(0, {}, this.localRows, this.localValues, this.localData)
const seriesObj = {}
const seriesName = 'treemap'
seriesObj[seriesName] = {
name: seriesName,
type: this.chartType,
leafDepth: 1,
visibleMin: 1,
label: { position: 'insideTopLeft' },
data: seriesData
}
this.calcData.seriesObj = seriesObj
},
// 递归
recursion(depth, conditions = {}, rows = [], values = [], data = []) {
const _result = []
if (depth < rows.length) {
const row = rows[depth]
row.values.forEach((val) => {
conditions[row.key] = val
const filters = Object.keys(conditions)
.filter((key, index) => index <= depth)
.reduce((obj, key) => {
obj[key] = conditions[key]
return obj
}, {})
const filterData = data.filter((item) => {
let status = true
for (const key in filters) {
if (filters[key] !== item[key]) {
status = false
return
}
}
return status
})
if (filterData.length) {
if (depth === (rows.length - 1)) {
values.forEach(({ key }) => {
const value = this._reduceValue(filterData, key)
_result.push({
name: val,
value: value
})
})
} else {
_result.push({
name: val,
children: this.recursion(depth + 1, conditions, rows, values, filterData)
})
}
}
})
}
return _result
},
handleResize() {
if (this.chart) {
this.chart.resize()
}
},
renderChart() {
if (!this.$refs.chart) return
let option = Object.assign({}, this.chartOption, this.calcOption)
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
this.parseChartSeries(option, series, this.chartSeriesType)
option.series = series
setTimeout(() => {
if (!this.chart) {
if (this.chartTheme !== 'default') {
require('./themes/' + this.chartTheme + '.js')
}
this.chart = echarts.init(this.$refs.chart, this.chartTheme)
}
this.chart.clear()
this.chart.setOption(option)
}, 0)
},
mergeChartTheme() {
if (!this.$refs.chart) return
if (this.chart) {
// 使用刚指定的配置项和数据显示图表
let option = Object.assign({}, this.chartOption, this.calcOption)
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
this.parseChartSeries(option, series, this.chartSeriesType)
option.series = series
if (this.chartTheme !== 'default') {
require('./themes/' + this.chartTheme + '.js')
}
this.chart.dispose()
// 基于准备好的dom初始化echarts实例
this.chart = echarts.init(this.$refs.chart, this.chartTheme)
this.chart.setOption(option)
}
},
mergeChartOption() {
if (!this.$refs.chart) return
if (this.chart) {
let option = Object.assign({}, this.chartOption, this.calcOption)
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
this.parseChartSeries(option, series, this.chartSeriesType)
option.series = series
this.chart.clear()
this.chart.setOption(option, true)
}
},
parseChartSeries(option, series, type) {
series.forEach((item) => {
item.label.formatter = (params) => {
return params.name + '\n\nvalue : ' + params.value
}
})
},
_combineRowPaths(...arrays) {
const len = arrays.length
let _result = []
if (len) {
const rowPaths = arrays.reduce((prev, curr) => {
const arr = []
prev.values.forEach(_prevEl => {
const prevKey = prev.key.split(SEPARATOR)
curr.values.forEach(_currEl => {
const currKey = curr.key
const conditions = {}
prevKey.forEach((key, i) => {
conditions[key] = _prevEl.split(SEPARATOR)[i]
})
conditions[currKey] = _currEl
// 判断数据里是否有该项
const filter = this.localData.some((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
if (filter) {
arr.push(_prevEl + SEPARATOR + _currEl)
}
})
})
return { key: prev.key + SEPARATOR + curr.key, values: arr }
}) || {}
_result = rowPaths.values || []
}
return _result
},
_combineColPaths(...arrays) {
return arrays.length ? arrays.reduce((prev, curr) => {
const arr = []
prev.forEach(_prevEl => {
curr.forEach(_currEl => {
arr.push(_prevEl + SEPARATOR + _currEl)
})
})
return arr
}) : arrays
},
_findCategory(keys = [], data = []) {
const _result = {}
data.forEach(item => {
keys.forEach(key => {
// Remove duplicates
_result[key] = _result[key] || []
_result[key].push(item[key])
_result[key] = [...new Set(_result[key])]
})
})
return _result
},
_reduceValue(data, key) {
if (!data.length) return 0
return data.reduce((sum, item) => { return sum + Number(item[key]) }, 0)
},
_filterData(conditions, data) {
return data.filter((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
}
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,328 @@
<template>
<div ref="chart" :style="chartStyle">ChartWordcloud</div>
</template>
<script>
import echarts from 'echarts'
require('echarts-wordcloud')
import { convertPathToMap, SEPARATOR } from '@/utils/visual-chart'
export default {
name: 'ChartWordcloud',
props: {
data: {
type: Array,
required: true,
default: () => []
},
rows: {
type: Array,
required: true,
default: () => []
},
columns: {
type: Array,
required: true,
default: () => []
},
values: {
type: Array,
required: true,
default: () => []
},
chartType: {
type: String,
required: true
},
chartTheme: {
type: String,
require: true,
default: 'default'
},
chartOption: {
type: Object,
require: false,
default: () => ({})
},
chartStyle: {
type: Object,
require: false,
default: () => {
return {
height: '200px'
}
}
}
},
data() {
return {
localRows: [],
localColumns: [],
localValues: [],
localData: [],
// 连接符
connector: '-',
chart: null,
calcOption: {
tooltip: { trigger: 'item' }
},
calcData: {
seriesObj: {}
}
}
},
computed: {
watchAllProps() {
const { rows, columns, values, data } = this
return { rows, columns, values, data }
}
},
watch: {
watchAllProps() {
this.init()
this.mergeChartOption()
},
chartTheme() {
this.mergeChartTheme()
},
chartOption: {
handler(newValue, oldValue) {
this.mergeChartOption()
},
deep: true
}
},
mounted() {
this.renderChart()
this.$on('resized', this.handleResize)
window.addEventListener('resize', this.handleResize)
},
created() {
this.init()
},
beforeDestroy() {
if (this.chart) {
this.chart.dispose()
}
window.removeEventListener('resize', this.handleResize)
},
methods: {
init() {
if (this.rows.length || this.columns.length || this.values.length) {
this.handleDataClone()
this.setValuesToColAndRow()
this.handleCalcData()
} else {
console.warn('[Warn]: props.rows, props.columns, props.values at least one is not empty.')
}
},
// clone data
handleDataClone() {
this.localRows = JSON.parse(JSON.stringify(this.rows))
this.localColumns = JSON.parse(JSON.stringify(this.columns))
this.localValues = JSON.parse(JSON.stringify(this.values))
this.localData = Object.freeze(this.data)
},
// set the `values` attribute to rows and columns
setValuesToColAndRow() {
const rowKeys = this.localRows.map(({ key }) => key)
const columnKeys = this.localColumns.map(({ key }) => key)
const rowValues = this._findCategory(rowKeys, this.localData)
const columnValues = this._findCategory(columnKeys, this.localData)
this.localRows.forEach((row) => {
const { key, values } = row
this.$set(row, 'values', values || rowValues[key] || [])
})
this.localColumns.forEach((column) => {
const { key, values } = column
this.$set(column, 'values', values || columnValues[key] || [])
})
},
// 计算值
handleCalcData() {
if (!this.localRows.length || !this.localValues.length) return
const _rowPaths = this._combineRowPaths(
this.localData,
...this.localRows.map(({ key, values }) => { return { key, values } })
)
const _rowKeys = this.localRows.map(({ key }) => key)
const _colPaths = this._combineColPaths(
...this.localColumns.map(({ values }) => values)
)
const _colKeys = this.localColumns.map(({ key }) => key)
// 行对应的条件
const rowConditions = convertPathToMap(_rowPaths, _rowKeys)
// 列对应的条件
const colConditions = convertPathToMap(_colPaths, _colKeys)
// 针对没传入行或列的处理
!colConditions.length && colConditions.push({})
!rowConditions.length && rowConditions.push({})
const seriesObj = {}
colConditions.forEach((colCondition, colConditionIndex) => {
const isEmptyCol = !Object.keys(colCondition).length
this.localValues.forEach(({ key }, index) => {
const seriesName = isEmptyCol ? key : Object.values(colCondition).join(this.connector) + this.connector + key
seriesObj[seriesName] = {
name: seriesName,
type: this.chartType,
drawOutOfBound: true,
data: []
}
})
})
// 计算每个series数据
colConditions.forEach((colCondition, colConditionIndex) => {
const isEmptyCol = !Object.keys(colCondition).length
rowConditions.forEach((rowCondition, rowConditionIndex) => {
// 当前单元对应的条件
const conditions = Object.assign({}, rowCondition, colCondition)
// 通过当前单元对应的条件,过滤数据
const filterData = this._filterData(conditions, this.localData)
// 多个值,多条数据
this.localValues.forEach(({ key }) => {
const value = this._reduceValue(filterData, key)
const seriesName = isEmptyCol ? key : Object.values(colCondition).join(this.connector) + this.connector + key
seriesObj[seriesName].data.push(
{
name: Object.values(rowCondition).join(this.connector),
value: value
}
)
})
})
})
this.calcData.seriesObj = seriesObj
},
handleResize() {
if (this.chart) {
this.chart.resize()
}
},
renderChart() {
if (!this.$refs.chart) return
let option = Object.assign({}, this.chartOption, this.calcOption)
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
option.series = series
setTimeout(() => {
if (!this.chart) {
if (this.chartTheme !== 'default') {
require('./themes/' + this.chartTheme + '.js')
}
this.chart = echarts.init(this.$refs.chart, this.chartTheme)
}
this.chart.clear()
this.chart.setOption(option)
}, 0)
},
mergeChartTheme() {
if (!this.$refs.chart) return
if (this.chart) {
// 使用刚指定的配置项和数据显示图表
let option = Object.assign({}, this.chartOption, this.calcOption)
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
option.series = series
if (this.chartTheme !== 'default') {
require('./themes/' + this.chartTheme + '.js')
}
this.chart.dispose()
// 基于准备好的dom初始化echarts实例
this.chart = echarts.init(this.$refs.chart, this.chartTheme)
this.chart.setOption(option)
}
},
mergeChartOption() {
if (!this.$refs.chart) return
if (this.chart) {
let option = Object.assign({}, this.chartOption, this.calcOption)
option = JSON.parse(JSON.stringify(option))
const series = JSON.parse(JSON.stringify(Object.values(this.calcData.seriesObj)))
option.series = series
this.chart.clear()
this.chart.setOption(option, true)
}
},
_combineRowPaths(data, ...arrays) {
const len = arrays.length
let _result = []
if (len) {
const rowPaths = arrays.reduce((prev, curr) => {
const arr = []
prev.values.forEach(_prevEl => {
const prevKey = prev.key.split(SEPARATOR)
curr.values.forEach(_currEl => {
const currKey = curr.key
const conditions = {}
prevKey.forEach((key, i) => {
conditions[key] = _prevEl.split(SEPARATOR)[i]
})
conditions[currKey] = _currEl
// 判断数据里是否有该项
const filter = data.some((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
if (filter) {
arr.push(_prevEl + SEPARATOR + _currEl)
}
})
})
return { key: prev.key + SEPARATOR + curr.key, values: arr }
}) || {}
_result = rowPaths.values || []
}
return _result
},
_combineColPaths(...arrays) {
return arrays.length ? arrays.reduce((prev, curr) => {
const arr = []
prev.forEach(_prevEl => {
curr.forEach(_currEl => {
arr.push(_prevEl + SEPARATOR + _currEl)
})
})
return arr
}) : arrays
},
_findCategory(keys = [], data = []) {
const _result = {}
data.forEach(item => {
keys.forEach(key => {
// Remove duplicates
_result[key] = _result[key] || []
_result[key].push(item[key])
_result[key] = [...new Set(_result[key])]
})
})
return _result
},
_reduceValue(data, key) {
if (!data.length) return 0
return data.reduce((sum, item) => { return sum + Number(item[key]) }, 0)
},
_filterData(conditions, data) {
return data.filter((data) => {
let status = true
for (const key in conditions) {
if (conditions[key] !== data[key]) {
status = false
return
}
}
return status
})
}
}
}
</script>
<style lang="scss" scoped>
</style>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,445 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['exports', 'echarts'], factory)
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
// CommonJS
factory(exports, require('echarts'))
} else {
// Browser globals
factory({}, root.echarts)
}
}(this, function(exports, echarts) {
var log = function(msg) {
if (typeof console !== 'undefined') {
console && console.error && console.error(msg)
}
}
if (!echarts) {
log('ECharts is not Loaded')
return
}
echarts.registerTheme('chalk', {
'color': [
'#fc97af',
'#87f7cf',
'#f7f494',
'#72ccff',
'#f7c5a0',
'#d4a4eb',
'#d2f5a6',
'#76f2f2'
],
'backgroundColor': 'rgba(41,52,65,1)',
'textStyle': {},
'title': {
'textStyle': {
'color': '#ffffff'
},
'subtextStyle': {
'color': '#dddddd'
}
},
'line': {
'itemStyle': {
'borderWidth': '4'
},
'lineStyle': {
'width': '3'
},
'symbolSize': '0',
'symbol': 'circle',
'smooth': true
},
'radar': {
'itemStyle': {
'borderWidth': '4'
},
'lineStyle': {
'width': '3'
},
'symbolSize': '0',
'symbol': 'circle',
'smooth': true
},
'bar': {
'itemStyle': {
'barBorderWidth': 0,
'barBorderColor': '#ccc'
}
},
'pie': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'scatter': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'boxplot': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'parallel': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'sankey': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'funnel': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'gauge': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'candlestick': {
'itemStyle': {
'color': '#fc97af',
'color0': 'transparent',
'borderColor': '#fc97af',
'borderColor0': '#87f7cf',
'borderWidth': '2'
}
},
'graph': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
},
'lineStyle': {
'width': '1',
'color': '#ffffff'
},
'symbolSize': '0',
'symbol': 'circle',
'smooth': true,
'color': [
'#fc97af',
'#87f7cf',
'#f7f494',
'#72ccff',
'#f7c5a0',
'#d4a4eb',
'#d2f5a6',
'#76f2f2'
],
'label': {
'color': '#293441'
}
},
'map': {
'itemStyle': {
'normal': {
'areaColor': '#f3f3f3',
'borderColor': '#999999',
'borderWidth': 0.5
},
'emphasis': {
'areaColor': 'rgba(255,178,72,1)',
'borderColor': '#eb8146',
'borderWidth': 1
}
},
'label': {
'normal': {
'textStyle': {
'color': '#893448'
}
},
'emphasis': {
'textStyle': {
'color': 'rgb(137,52,72)'
}
}
}
},
'geo': {
'itemStyle': {
'normal': {
'areaColor': '#f3f3f3',
'borderColor': '#999999',
'borderWidth': 0.5
},
'emphasis': {
'areaColor': 'rgba(255,178,72,1)',
'borderColor': '#eb8146',
'borderWidth': 1
}
},
'label': {
'normal': {
'textStyle': {
'color': '#893448'
}
},
'emphasis': {
'textStyle': {
'color': 'rgb(137,52,72)'
}
}
}
},
'categoryAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#666666'
}
},
'axisTick': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#aaaaaa'
}
},
'splitLine': {
'show': false,
'lineStyle': {
'color': [
'#e6e6e6'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.05)',
'rgba(200,200,200,0.02)'
]
}
}
},
'valueAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#666666'
}
},
'axisTick': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#aaaaaa'
}
},
'splitLine': {
'show': false,
'lineStyle': {
'color': [
'#e6e6e6'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.05)',
'rgba(200,200,200,0.02)'
]
}
}
},
'logAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#666666'
}
},
'axisTick': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#aaaaaa'
}
},
'splitLine': {
'show': false,
'lineStyle': {
'color': [
'#e6e6e6'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.05)',
'rgba(200,200,200,0.02)'
]
}
}
},
'timeAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#666666'
}
},
'axisTick': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#aaaaaa'
}
},
'splitLine': {
'show': false,
'lineStyle': {
'color': [
'#e6e6e6'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.05)',
'rgba(200,200,200,0.02)'
]
}
}
},
'toolbox': {
'iconStyle': {
'normal': {
'borderColor': '#999999'
},
'emphasis': {
'borderColor': '#666666'
}
}
},
'legend': {
'textStyle': {
'color': '#999999'
}
},
'tooltip': {
'axisPointer': {
'lineStyle': {
'color': '#cccccc',
'width': 1
},
'crossStyle': {
'color': '#cccccc',
'width': 1
}
}
},
'timeline': {
'lineStyle': {
'color': '#87f7cf',
'width': 1
},
'itemStyle': {
'normal': {
'color': '#87f7cf',
'borderWidth': 1
},
'emphasis': {
'color': '#f7f494'
}
},
'controlStyle': {
'normal': {
'color': '#87f7cf',
'borderColor': '#87f7cf',
'borderWidth': 0.5
},
'emphasis': {
'color': '#87f7cf',
'borderColor': '#87f7cf',
'borderWidth': 0.5
}
},
'checkpointStyle': {
'color': '#fc97af',
'borderColor': 'rgba(252,151,175,0.3)'
},
'label': {
'normal': {
'textStyle': {
'color': '#87f7cf'
}
},
'emphasis': {
'textStyle': {
'color': '#87f7cf'
}
}
}
},
'visualMap': {
'color': [
'#fc97af',
'#87f7cf'
]
},
'dataZoom': {
'backgroundColor': 'rgba(255,255,255,0)',
'dataBackgroundColor': 'rgba(114,204,255,1)',
'fillerColor': 'rgba(114,204,255,0.2)',
'handleColor': '#72ccff',
'handleSize': '100%',
'textStyle': {
'color': '#333333'
}
},
'markPoint': {
'label': {
'color': '#293441'
},
'emphasis': {
'label': {
'color': '#293441'
}
}
}
})
}))

View File

@@ -0,0 +1,448 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['exports', 'echarts'], factory)
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
// CommonJS
factory(exports, require('echarts'))
} else {
// Browser globals
factory({}, root.echarts)
}
}(this, function(exports, echarts) {
var log = function(msg) {
if (typeof console !== 'undefined') {
console && console.error && console.error(msg)
}
}
if (!echarts) {
log('ECharts is not Loaded')
return
}
echarts.registerTheme('dark', {
'color': [
'#dd6b66',
'#759aa0',
'#e69d87',
'#8dc1a9',
'#ea7e53',
'#eedd78',
'#73a373',
'#73b9bc',
'#7289ab',
'#91ca8c',
'#f49f42'
],
'backgroundColor': 'rgba(51,51,51,1)',
'textStyle': {},
'title': {
'textStyle': {
'color': '#eeeeee'
},
'subtextStyle': {
'color': '#aaaaaa'
}
},
'line': {
'itemStyle': {
'borderWidth': 1
},
'lineStyle': {
'width': 2
},
'symbolSize': 4,
'symbol': 'circle',
'smooth': false
},
'radar': {
'itemStyle': {
'borderWidth': 1
},
'lineStyle': {
'width': 2
},
'symbolSize': 4,
'symbol': 'circle',
'smooth': false
},
'bar': {
'itemStyle': {
'barBorderWidth': 0,
'barBorderColor': '#ccc'
}
},
'pie': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'scatter': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'boxplot': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'parallel': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'sankey': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'funnel': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'gauge': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'candlestick': {
'itemStyle': {
'color': '#fd1050',
'color0': '#0cf49b',
'borderColor': '#fd1050',
'borderColor0': '#0cf49b',
'borderWidth': 1
}
},
'graph': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
},
'lineStyle': {
'width': 1,
'color': '#aaaaaa'
},
'symbolSize': 4,
'symbol': 'circle',
'smooth': false,
'color': [
'#dd6b66',
'#759aa0',
'#e69d87',
'#8dc1a9',
'#ea7e53',
'#eedd78',
'#73a373',
'#73b9bc',
'#7289ab',
'#91ca8c',
'#f49f42'
],
'label': {
'color': '#eeeeee'
}
},
'map': {
'itemStyle': {
'normal': {
'areaColor': '#eee',
'borderColor': '#444',
'borderWidth': 0.5
},
'emphasis': {
'areaColor': 'rgba(255,215,0,0.8)',
'borderColor': '#444',
'borderWidth': 1
}
},
'label': {
'normal': {
'textStyle': {
'color': '#000'
}
},
'emphasis': {
'textStyle': {
'color': 'rgb(100,0,0)'
}
}
}
},
'geo': {
'itemStyle': {
'normal': {
'areaColor': '#eee',
'borderColor': '#444',
'borderWidth': 0.5
},
'emphasis': {
'areaColor': 'rgba(255,215,0,0.8)',
'borderColor': '#444',
'borderWidth': 1
}
},
'label': {
'normal': {
'textStyle': {
'color': '#000'
}
},
'emphasis': {
'textStyle': {
'color': 'rgb(100,0,0)'
}
}
}
},
'categoryAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#eeeeee'
}
},
'axisTick': {
'show': true,
'lineStyle': {
'color': '#eeeeee'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#eeeeee'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#aaaaaa'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'#eeeeee'
]
}
}
},
'valueAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#eeeeee'
}
},
'axisTick': {
'show': true,
'lineStyle': {
'color': '#eeeeee'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#eeeeee'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#aaaaaa'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'#eeeeee'
]
}
}
},
'logAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#eeeeee'
}
},
'axisTick': {
'show': true,
'lineStyle': {
'color': '#eeeeee'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#eeeeee'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#aaaaaa'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'#eeeeee'
]
}
}
},
'timeAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#eeeeee'
}
},
'axisTick': {
'show': true,
'lineStyle': {
'color': '#eeeeee'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#eeeeee'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#aaaaaa'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'#eeeeee'
]
}
}
},
'toolbox': {
'iconStyle': {
'normal': {
'borderColor': '#999999'
},
'emphasis': {
'borderColor': '#666666'
}
}
},
'legend': {
'textStyle': {
'color': '#eeeeee'
}
},
'tooltip': {
'axisPointer': {
'lineStyle': {
'color': '#eeeeee',
'width': '1'
},
'crossStyle': {
'color': '#eeeeee',
'width': '1'
}
}
},
'timeline': {
'lineStyle': {
'color': '#eeeeee',
'width': 1
},
'itemStyle': {
'normal': {
'color': '#dd6b66',
'borderWidth': 1
},
'emphasis': {
'color': '#a9334c'
}
},
'controlStyle': {
'normal': {
'color': '#eeeeee',
'borderColor': '#eeeeee',
'borderWidth': 0.5
},
'emphasis': {
'color': '#eeeeee',
'borderColor': '#eeeeee',
'borderWidth': 0.5
}
},
'checkpointStyle': {
'color': '#e43c59',
'borderColor': 'rgba(194,53,49,0.5)'
},
'label': {
'normal': {
'textStyle': {
'color': '#eeeeee'
}
},
'emphasis': {
'textStyle': {
'color': '#eeeeee'
}
}
}
},
'visualMap': {
'color': [
'#bf444c',
'#d88273',
'#f6efa6'
]
},
'dataZoom': {
'backgroundColor': 'rgba(47,69,84,0)',
'dataBackgroundColor': 'rgba(255,255,255,0.3)',
'fillerColor': 'rgba(167,183,204,0.4)',
'handleColor': '#a7b7cc',
'handleSize': '100%',
'textStyle': {
'color': '#eeeeee'
}
},
'markPoint': {
'label': {
'color': '#eeeeee'
},
'emphasis': {
'label': {
'color': '#eeeeee'
}
}
}
})
}))

View File

@@ -0,0 +1,445 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['exports', 'echarts'], factory)
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
// CommonJS
factory(exports, require('echarts'))
} else {
// Browser globals
factory({}, root.echarts)
}
}(this, function(exports, echarts) {
var log = function(msg) {
if (typeof console !== 'undefined') {
console && console.error && console.error(msg)
}
}
if (!echarts) {
log('ECharts is not Loaded')
return
}
echarts.registerTheme('essos', {
'color': [
'#893448',
'#d95850',
'#eb8146',
'#ffb248',
'#f2d643',
'#ebdba4'
],
'backgroundColor': 'rgba(242,234,191,0.15)',
'textStyle': {},
'title': {
'textStyle': {
'color': '#893448'
},
'subtextStyle': {
'color': '#d95850'
}
},
'line': {
'itemStyle': {
'borderWidth': '2'
},
'lineStyle': {
'width': '2'
},
'symbolSize': '6',
'symbol': 'emptyCircle',
'smooth': true
},
'radar': {
'itemStyle': {
'borderWidth': '2'
},
'lineStyle': {
'width': '2'
},
'symbolSize': '6',
'symbol': 'emptyCircle',
'smooth': true
},
'bar': {
'itemStyle': {
'barBorderWidth': 0,
'barBorderColor': '#ccc'
}
},
'pie': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'scatter': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'boxplot': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'parallel': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'sankey': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'funnel': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'gauge': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'candlestick': {
'itemStyle': {
'color': '#eb8146',
'color0': 'transparent',
'borderColor': '#d95850',
'borderColor0': '#58c470',
'borderWidth': '2'
}
},
'graph': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
},
'lineStyle': {
'width': 1,
'color': '#aaaaaa'
},
'symbolSize': '6',
'symbol': 'emptyCircle',
'smooth': true,
'color': [
'#893448',
'#d95850',
'#eb8146',
'#ffb248',
'#f2d643',
'#ebdba4'
],
'label': {
'color': '#ffffff'
}
},
'map': {
'itemStyle': {
'normal': {
'areaColor': '#f3f3f3',
'borderColor': '#999999',
'borderWidth': 0.5
},
'emphasis': {
'areaColor': '#ffb248',
'borderColor': '#eb8146',
'borderWidth': 1
}
},
'label': {
'normal': {
'textStyle': {
'color': '#893448'
}
},
'emphasis': {
'textStyle': {
'color': '#893448'
}
}
}
},
'geo': {
'itemStyle': {
'normal': {
'areaColor': '#f3f3f3',
'borderColor': '#999999',
'borderWidth': 0.5
},
'emphasis': {
'areaColor': '#ffb248',
'borderColor': '#eb8146',
'borderWidth': 1
}
},
'label': {
'normal': {
'textStyle': {
'color': '#893448'
}
},
'emphasis': {
'textStyle': {
'color': '#893448'
}
}
}
},
'categoryAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#aaaaaa'
}
},
'axisTick': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#999999'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#e6e6e6'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.05)',
'rgba(200,200,200,0.02)'
]
}
}
},
'valueAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#aaaaaa'
}
},
'axisTick': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#999999'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#e6e6e6'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.05)',
'rgba(200,200,200,0.02)'
]
}
}
},
'logAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#aaaaaa'
}
},
'axisTick': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#999999'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#e6e6e6'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.05)',
'rgba(200,200,200,0.02)'
]
}
}
},
'timeAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#aaaaaa'
}
},
'axisTick': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#999999'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#e6e6e6'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.05)',
'rgba(200,200,200,0.02)'
]
}
}
},
'toolbox': {
'iconStyle': {
'normal': {
'borderColor': '#999999'
},
'emphasis': {
'borderColor': '#666666'
}
}
},
'legend': {
'textStyle': {
'color': '#999999'
}
},
'tooltip': {
'axisPointer': {
'lineStyle': {
'color': '#cccccc',
'width': 1
},
'crossStyle': {
'color': '#cccccc',
'width': 1
}
}
},
'timeline': {
'lineStyle': {
'color': '#893448',
'width': 1
},
'itemStyle': {
'normal': {
'color': '#893448',
'borderWidth': 1
},
'emphasis': {
'color': '#ffb248'
}
},
'controlStyle': {
'normal': {
'color': '#893448',
'borderColor': '#893448',
'borderWidth': 0.5
},
'emphasis': {
'color': '#893448',
'borderColor': '#893448',
'borderWidth': 0.5
}
},
'checkpointStyle': {
'color': '#eb8146',
'borderColor': 'rgba(255,178,72,0.41)'
},
'label': {
'normal': {
'textStyle': {
'color': '#893448'
}
},
'emphasis': {
'textStyle': {
'color': '#893448'
}
}
}
},
'visualMap': {
'color': [
'#893448',
'#d95850',
'#eb8146',
'#ffb248',
'#f2d643',
'rgb(247,238,173)'
]
},
'dataZoom': {
'backgroundColor': 'rgba(255,255,255,0)',
'dataBackgroundColor': 'rgba(255,178,72,0.5)',
'fillerColor': 'rgba(255,178,72,0.15)',
'handleColor': '#ffb248',
'handleSize': '100%',
'textStyle': {
'color': '#333333'
}
},
'markPoint': {
'label': {
'color': '#ffffff'
},
'emphasis': {
'label': {
'color': '#ffffff'
}
}
}
})
}))

View File

@@ -0,0 +1,459 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['exports', 'echarts'], factory)
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
// CommonJS
factory(exports, require('echarts'))
} else {
// Browser globals
factory({}, root.echarts)
}
}(this, function(exports, echarts) {
var log = function(msg) {
if (typeof console !== 'undefined') {
console && console.error && console.error(msg)
}
}
if (!echarts) {
log('ECharts is not Loaded')
return
}
echarts.registerTheme('infographic', {
'color': [
'#c1232b',
'#27727b',
'#fcce10',
'#e87c25',
'#b5c334',
'#fe8463',
'#9bca63',
'#fad860',
'#f3a43b',
'#60c0dd',
'#d7504b',
'#c6e579',
'#f4e001',
'#f0805a',
'#26c0c0'
],
'backgroundColor': 'rgba(0,0,0,0)',
'textStyle': {},
'title': {
'textStyle': {
'color': '#27727b'
},
'subtextStyle': {
'color': '#aaaaaa'
}
},
'line': {
'itemStyle': {
'borderWidth': 1
},
'lineStyle': {
'width': '3'
},
'symbolSize': '5',
'symbol': 'emptyCircle',
'smooth': false
},
'radar': {
'itemStyle': {
'borderWidth': 1
},
'lineStyle': {
'width': '3'
},
'symbolSize': '5',
'symbol': 'emptyCircle',
'smooth': false
},
'bar': {
'itemStyle': {
'barBorderWidth': 0,
'barBorderColor': '#ccc'
}
},
'pie': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'scatter': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'boxplot': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'parallel': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'sankey': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'funnel': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'gauge': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'candlestick': {
'itemStyle': {
'color': '#c1232b',
'color0': '#b5c334',
'borderColor': '#c1232b',
'borderColor0': '#b5c334',
'borderWidth': 1
}
},
'graph': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
},
'lineStyle': {
'width': 1,
'color': '#aaaaaa'
},
'symbolSize': '5',
'symbol': 'emptyCircle',
'smooth': false,
'color': [
'#c1232b',
'#27727b',
'#fcce10',
'#e87c25',
'#b5c334',
'#fe8463',
'#9bca63',
'#fad860',
'#f3a43b',
'#60c0dd',
'#d7504b',
'#c6e579',
'#f4e001',
'#f0805a',
'#26c0c0'
],
'label': {
'color': '#eeeeee'
}
},
'map': {
'itemStyle': {
'normal': {
'areaColor': '#dddddd',
'borderColor': '#eeeeee',
'borderWidth': 0.5
},
'emphasis': {
'areaColor': '#fe994e',
'borderColor': '#444',
'borderWidth': 1
}
},
'label': {
'normal': {
'textStyle': {
'color': '#c1232b'
}
},
'emphasis': {
'textStyle': {
'color': 'rgb(100,0,0)'
}
}
}
},
'geo': {
'itemStyle': {
'normal': {
'areaColor': '#dddddd',
'borderColor': '#eeeeee',
'borderWidth': 0.5
},
'emphasis': {
'areaColor': '#fe994e',
'borderColor': '#444',
'borderWidth': 1
}
},
'label': {
'normal': {
'textStyle': {
'color': '#c1232b'
}
},
'emphasis': {
'textStyle': {
'color': 'rgb(100,0,0)'
}
}
}
},
'categoryAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#27727b'
}
},
'axisTick': {
'show': true,
'lineStyle': {
'color': '#27727b'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#333'
}
},
'splitLine': {
'show': false,
'lineStyle': {
'color': [
'#ccc'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.3)',
'rgba(200,200,200,0.3)'
]
}
}
},
'valueAxis': {
'axisLine': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisTick': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#333'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#ccc'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.3)',
'rgba(200,200,200,0.3)'
]
}
}
},
'logAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#27727b'
}
},
'axisTick': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#333'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#ccc'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.3)',
'rgba(200,200,200,0.3)'
]
}
}
},
'timeAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#27727b'
}
},
'axisTick': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#333'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#ccc'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.3)',
'rgba(200,200,200,0.3)'
]
}
}
},
'toolbox': {
'iconStyle': {
'normal': {
'borderColor': '#c1232b'
},
'emphasis': {
'borderColor': '#e87c25'
}
}
},
'legend': {
'textStyle': {
'color': '#333333'
}
},
'tooltip': {
'axisPointer': {
'lineStyle': {
'color': '#27727b',
'width': 1
},
'crossStyle': {
'color': '#27727b',
'width': 1
}
}
},
'timeline': {
'lineStyle': {
'color': '#293c55',
'width': 1
},
'itemStyle': {
'normal': {
'color': '#27727b',
'borderWidth': 1
},
'emphasis': {
'color': '#72d4e0'
}
},
'controlStyle': {
'normal': {
'color': '#27727b',
'borderColor': '#27727b',
'borderWidth': 0.5
},
'emphasis': {
'color': '#27727b',
'borderColor': '#27727b',
'borderWidth': 0.5
}
},
'checkpointStyle': {
'color': '#c1232b',
'borderColor': 'rgba(194,53,49,0.5)'
},
'label': {
'normal': {
'textStyle': {
'color': '#293c55'
}
},
'emphasis': {
'textStyle': {
'color': '#293c55'
}
}
}
},
'visualMap': {
'color': [
'#c1232b',
'#fcce10'
]
},
'dataZoom': {
'backgroundColor': 'rgba(0,0,0,0)',
'dataBackgroundColor': 'rgba(181,195,52,0.3)',
'fillerColor': 'rgba(181,195,52,0.2)',
'handleColor': '#27727b',
'handleSize': '100%',
'textStyle': {
'color': '#999999'
}
},
'markPoint': {
'label': {
'color': '#eeeeee'
},
'emphasis': {
'label': {
'color': '#eeeeee'
}
}
}
})
}))

View File

@@ -0,0 +1,469 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['exports', 'echarts'], factory)
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
// CommonJS
factory(exports, require('echarts'))
} else {
// Browser globals
factory({}, root.echarts)
}
}(this, function(exports, echarts) {
var log = function(msg) {
if (typeof console !== 'undefined') {
console && console.error && console.error(msg)
}
}
if (!echarts) {
log('ECharts is not Loaded')
return
}
echarts.registerTheme('macarons', {
'color': [
'#2ec7c9',
'#b6a2de',
'#5ab1ef',
'#ffb980',
'#d87a80',
'#8d98b3',
'#e5cf0d',
'#97b552',
'#95706d',
'#dc69aa',
'#07a2a4',
'#9a7fd1',
'#588dd5',
'#f5994e',
'#c05050',
'#59678c',
'#c9ab00',
'#7eb00a',
'#6f5553',
'#c14089'
],
'backgroundColor': 'rgba(0,0,0,0)',
'textStyle': {},
'title': {
'textStyle': {
'color': '#008acd'
},
'subtextStyle': {
'color': '#aaaaaa'
}
},
'line': {
'itemStyle': {
'borderWidth': 1
},
'lineStyle': {
'width': 2
},
'symbolSize': 3,
'symbol': 'emptyCircle',
'smooth': true
},
'radar': {
'itemStyle': {
'borderWidth': 1
},
'lineStyle': {
'width': 2
},
'symbolSize': 3,
'symbol': 'emptyCircle',
'smooth': true
},
'bar': {
'itemStyle': {
'barBorderWidth': 0,
'barBorderColor': '#ccc'
}
},
'pie': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'scatter': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'boxplot': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'parallel': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'sankey': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'funnel': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'gauge': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'candlestick': {
'itemStyle': {
'color': '#d87a80',
'color0': '#2ec7c9',
'borderColor': '#d87a80',
'borderColor0': '#2ec7c9',
'borderWidth': 1
}
},
'graph': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
},
'lineStyle': {
'width': 1,
'color': '#aaaaaa'
},
'symbolSize': 3,
'symbol': 'emptyCircle',
'smooth': true,
'color': [
'#2ec7c9',
'#b6a2de',
'#5ab1ef',
'#ffb980',
'#d87a80',
'#8d98b3',
'#e5cf0d',
'#97b552',
'#95706d',
'#dc69aa',
'#07a2a4',
'#9a7fd1',
'#588dd5',
'#f5994e',
'#c05050',
'#59678c',
'#c9ab00',
'#7eb00a',
'#6f5553',
'#c14089'
],
'label': {
'color': '#eeeeee'
}
},
'map': {
'itemStyle': {
'normal': {
'areaColor': '#dddddd',
'borderColor': '#eeeeee',
'borderWidth': 0.5
},
'emphasis': {
'areaColor': 'rgba(254,153,78,1)',
'borderColor': '#444',
'borderWidth': 1
}
},
'label': {
'normal': {
'textStyle': {
'color': '#d87a80'
}
},
'emphasis': {
'textStyle': {
'color': 'rgb(100,0,0)'
}
}
}
},
'geo': {
'itemStyle': {
'normal': {
'areaColor': '#dddddd',
'borderColor': '#eeeeee',
'borderWidth': 0.5
},
'emphasis': {
'areaColor': 'rgba(254,153,78,1)',
'borderColor': '#444',
'borderWidth': 1
}
},
'label': {
'normal': {
'textStyle': {
'color': '#d87a80'
}
},
'emphasis': {
'textStyle': {
'color': 'rgb(100,0,0)'
}
}
}
},
'categoryAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#008acd'
}
},
'axisTick': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#333'
}
},
'splitLine': {
'show': false,
'lineStyle': {
'color': [
'#eee'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.3)',
'rgba(200,200,200,0.3)'
]
}
}
},
'valueAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#008acd'
}
},
'axisTick': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#333'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#eee'
]
}
},
'splitArea': {
'show': true,
'areaStyle': {
'color': [
'rgba(250,250,250,0.3)',
'rgba(200,200,200,0.3)'
]
}
}
},
'logAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#008acd'
}
},
'axisTick': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#333'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#eee'
]
}
},
'splitArea': {
'show': true,
'areaStyle': {
'color': [
'rgba(250,250,250,0.3)',
'rgba(200,200,200,0.3)'
]
}
}
},
'timeAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#008acd'
}
},
'axisTick': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#333'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#eee'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.3)',
'rgba(200,200,200,0.3)'
]
}
}
},
'toolbox': {
'iconStyle': {
'normal': {
'borderColor': '#2ec7c9'
},
'emphasis': {
'borderColor': '#18a4a6'
}
}
},
'legend': {
'textStyle': {
'color': '#333333'
}
},
'tooltip': {
'axisPointer': {
'lineStyle': {
'color': '#008acd',
'width': '1'
},
'crossStyle': {
'color': '#008acd',
'width': '1'
}
}
},
'timeline': {
'lineStyle': {
'color': '#008acd',
'width': 1
},
'itemStyle': {
'normal': {
'color': '#008acd',
'borderWidth': 1
},
'emphasis': {
'color': '#a9334c'
}
},
'controlStyle': {
'normal': {
'color': '#008acd',
'borderColor': '#008acd',
'borderWidth': 0.5
},
'emphasis': {
'color': '#008acd',
'borderColor': '#008acd',
'borderWidth': 0.5
}
},
'checkpointStyle': {
'color': '#2ec7c9',
'borderColor': 'rgba(46,199,201,0.4)'
},
'label': {
'normal': {
'textStyle': {
'color': '#008acd'
}
},
'emphasis': {
'textStyle': {
'color': '#008acd'
}
}
}
},
'visualMap': {
'color': [
'#5ab1ef',
'#e0ffff'
]
},
'dataZoom': {
'backgroundColor': 'rgba(47,69,84,0)',
'dataBackgroundColor': 'rgba(239,239,255,1)',
'fillerColor': 'rgba(182,162,222,0.2)',
'handleColor': '#008acd',
'handleSize': '100%',
'textStyle': {
'color': '#333333'
}
},
'markPoint': {
'label': {
'color': '#eeeeee'
},
'emphasis': {
'label': {
'color': '#eeeeee'
}
}
}
})
}))

View File

@@ -0,0 +1,446 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['exports', 'echarts'], factory)
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
// CommonJS
factory(exports, require('echarts'))
} else {
// Browser globals
factory({}, root.echarts)
}
}(this, function(exports, echarts) {
var log = function(msg) {
if (typeof console !== 'undefined') {
console && console.error && console.error(msg)
}
}
if (!echarts) {
log('ECharts is not Loaded')
return
}
echarts.registerTheme('purple-passion', {
'color': [
'#9b8bba',
'#e098c7',
'#8fd3e8',
'#71669e',
'#cc70af',
'#7cb4cc'
],
'backgroundColor': 'rgba(91,92,110,1)',
'textStyle': {},
'title': {
'textStyle': {
'color': '#ffffff'
},
'subtextStyle': {
'color': '#cccccc'
}
},
'line': {
'itemStyle': {
'borderWidth': '2'
},
'lineStyle': {
'width': '3'
},
'symbolSize': '7',
'symbol': 'circle',
'smooth': true
},
'radar': {
'itemStyle': {
'borderWidth': '2'
},
'lineStyle': {
'width': '3'
},
'symbolSize': '7',
'symbol': 'circle',
'smooth': true
},
'bar': {
'itemStyle': {
'barBorderWidth': 0,
'barBorderColor': '#ccc'
}
},
'pie': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'scatter': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'boxplot': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'parallel': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'sankey': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'funnel': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'gauge': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'candlestick': {
'itemStyle': {
'color': '#e098c7',
'color0': 'transparent',
'borderColor': '#e098c7',
'borderColor0': '#8fd3e8',
'borderWidth': '2'
}
},
'graph': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
},
'lineStyle': {
'width': 1,
'color': '#aaaaaa'
},
'symbolSize': '7',
'symbol': 'circle',
'smooth': true,
'color': [
'#9b8bba',
'#e098c7',
'#8fd3e8',
'#71669e',
'#cc70af',
'#7cb4cc'
],
'label': {
'color': '#eeeeee'
}
},
'map': {
'itemStyle': {
'normal': {
'areaColor': '#eee',
'borderColor': '#444',
'borderWidth': 0.5
},
'emphasis': {
'areaColor': '#e098c7',
'borderColor': '#444',
'borderWidth': 1
}
},
'label': {
'normal': {
'textStyle': {
'color': '#000'
}
},
'emphasis': {
'textStyle': {
'color': '#ffffff'
}
}
}
},
'geo': {
'itemStyle': {
'normal': {
'areaColor': '#eee',
'borderColor': '#444',
'borderWidth': 0.5
},
'emphasis': {
'areaColor': '#e098c7',
'borderColor': '#444',
'borderWidth': 1
}
},
'label': {
'normal': {
'textStyle': {
'color': '#000'
}
},
'emphasis': {
'textStyle': {
'color': '#ffffff'
}
}
}
},
'categoryAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#cccccc'
}
},
'axisTick': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#cccccc'
}
},
'splitLine': {
'show': false,
'lineStyle': {
'color': [
'#eeeeee',
'#333333'
]
}
},
'splitArea': {
'show': true,
'areaStyle': {
'color': [
'rgba(250,250,250,0.05)',
'rgba(200,200,200,0.02)'
]
}
}
},
'valueAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#cccccc'
}
},
'axisTick': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#cccccc'
}
},
'splitLine': {
'show': false,
'lineStyle': {
'color': [
'#eeeeee',
'#333333'
]
}
},
'splitArea': {
'show': true,
'areaStyle': {
'color': [
'rgba(250,250,250,0.05)',
'rgba(200,200,200,0.02)'
]
}
}
},
'logAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#cccccc'
}
},
'axisTick': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#cccccc'
}
},
'splitLine': {
'show': false,
'lineStyle': {
'color': [
'#eeeeee',
'#333333'
]
}
},
'splitArea': {
'show': true,
'areaStyle': {
'color': [
'rgba(250,250,250,0.05)',
'rgba(200,200,200,0.02)'
]
}
}
},
'timeAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#cccccc'
}
},
'axisTick': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#cccccc'
}
},
'splitLine': {
'show': false,
'lineStyle': {
'color': [
'#eeeeee',
'#333333'
]
}
},
'splitArea': {
'show': true,
'areaStyle': {
'color': [
'rgba(250,250,250,0.05)',
'rgba(200,200,200,0.02)'
]
}
}
},
'toolbox': {
'iconStyle': {
'normal': {
'borderColor': '#999999'
},
'emphasis': {
'borderColor': '#666666'
}
}
},
'legend': {
'textStyle': {
'color': '#cccccc'
}
},
'tooltip': {
'axisPointer': {
'lineStyle': {
'color': '#cccccc',
'width': 1
},
'crossStyle': {
'color': '#cccccc',
'width': 1
}
}
},
'timeline': {
'lineStyle': {
'color': '#8fd3e8',
'width': 1
},
'itemStyle': {
'normal': {
'color': '#8fd3e8',
'borderWidth': 1
},
'emphasis': {
'color': '#8fd3e8'
}
},
'controlStyle': {
'normal': {
'color': '#8fd3e8',
'borderColor': '#8fd3e8',
'borderWidth': 0.5
},
'emphasis': {
'color': '#8fd3e8',
'borderColor': '#8fd3e8',
'borderWidth': 0.5
}
},
'checkpointStyle': {
'color': '#8fd3e8',
'borderColor': 'rgba(138,124,168,0.37)'
},
'label': {
'normal': {
'textStyle': {
'color': '#8fd3e8'
}
},
'emphasis': {
'textStyle': {
'color': '#8fd3e8'
}
}
}
},
'visualMap': {
'color': [
'#8a7ca8',
'#e098c7',
'#cceffa'
]
},
'dataZoom': {
'backgroundColor': 'rgba(0,0,0,0)',
'dataBackgroundColor': 'rgba(255,255,255,0.3)',
'fillerColor': 'rgba(167,183,204,0.4)',
'handleColor': '#a7b7cc',
'handleSize': '100%',
'textStyle': {
'color': '#333333'
}
},
'markPoint': {
'label': {
'color': '#eeeeee'
},
'emphasis': {
'label': {
'color': '#eeeeee'
}
}
}
})
}))

View File

@@ -0,0 +1,469 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['exports', 'echarts'], factory)
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
// CommonJS
factory(exports, require('echarts'))
} else {
// Browser globals
factory({}, root.echarts)
}
}(this, function(exports, echarts) {
var log = function(msg) {
if (typeof console !== 'undefined') {
console && console.error && console.error(msg)
}
}
if (!echarts) {
log('ECharts is not Loaded')
return
}
echarts.registerTheme('roma', {
'color': [
'#e01f54',
'#001852',
'#f5e8c8',
'#b8d2c7',
'#c6b38e',
'#a4d8c2',
'#f3d999',
'#d3758f',
'#dcc392',
'#2e4783',
'#82b6e9',
'#ff6347',
'#a092f1',
'#0a915d',
'#eaf889',
'#6699FF',
'#ff6666',
'#3cb371',
'#d5b158',
'#38b6b6'
],
'backgroundColor': 'rgba(0,0,0,0)',
'textStyle': {},
'title': {
'textStyle': {
'color': '#333333'
},
'subtextStyle': {
'color': '#aaaaaa'
}
},
'line': {
'itemStyle': {
'borderWidth': 1
},
'lineStyle': {
'width': 2
},
'symbolSize': 4,
'symbol': 'emptyCircle',
'smooth': false
},
'radar': {
'itemStyle': {
'borderWidth': 1
},
'lineStyle': {
'width': 2
},
'symbolSize': 4,
'symbol': 'emptyCircle',
'smooth': false
},
'bar': {
'itemStyle': {
'barBorderWidth': 0,
'barBorderColor': '#ccc'
}
},
'pie': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'scatter': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'boxplot': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'parallel': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'sankey': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'funnel': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'gauge': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'candlestick': {
'itemStyle': {
'color': '#e01f54',
'color0': '#001852',
'borderColor': '#f5e8c8',
'borderColor0': '#b8d2c7',
'borderWidth': 1
}
},
'graph': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
},
'lineStyle': {
'width': 1,
'color': '#aaaaaa'
},
'symbolSize': 4,
'symbol': 'emptyCircle',
'smooth': false,
'color': [
'#e01f54',
'#001852',
'#f5e8c8',
'#b8d2c7',
'#c6b38e',
'#a4d8c2',
'#f3d999',
'#d3758f',
'#dcc392',
'#2e4783',
'#82b6e9',
'#ff6347',
'#a092f1',
'#0a915d',
'#eaf889',
'#6699FF',
'#ff6666',
'#3cb371',
'#d5b158',
'#38b6b6'
],
'label': {
'color': '#eeeeee'
}
},
'map': {
'itemStyle': {
'normal': {
'areaColor': '#eeeeee',
'borderColor': '#444444',
'borderWidth': 0.5
},
'emphasis': {
'areaColor': 'rgba(255,215,0,0.8)',
'borderColor': '#444',
'borderWidth': 1
}
},
'label': {
'normal': {
'textStyle': {
'color': '#000000'
}
},
'emphasis': {
'textStyle': {
'color': 'rgb(100,0,0)'
}
}
}
},
'geo': {
'itemStyle': {
'normal': {
'areaColor': '#eeeeee',
'borderColor': '#444444',
'borderWidth': 0.5
},
'emphasis': {
'areaColor': 'rgba(255,215,0,0.8)',
'borderColor': '#444',
'borderWidth': 1
}
},
'label': {
'normal': {
'textStyle': {
'color': '#000000'
}
},
'emphasis': {
'textStyle': {
'color': 'rgb(100,0,0)'
}
}
}
},
'categoryAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisTick': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#333'
}
},
'splitLine': {
'show': false,
'lineStyle': {
'color': [
'#ccc'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.3)',
'rgba(200,200,200,0.3)'
]
}
}
},
'valueAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisTick': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#333'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#ccc'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.3)',
'rgba(200,200,200,0.3)'
]
}
}
},
'logAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisTick': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#333'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#ccc'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.3)',
'rgba(200,200,200,0.3)'
]
}
}
},
'timeAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisTick': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#333'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#ccc'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.3)',
'rgba(200,200,200,0.3)'
]
}
}
},
'toolbox': {
'iconStyle': {
'normal': {
'borderColor': '#999999'
},
'emphasis': {
'borderColor': '#666666'
}
}
},
'legend': {
'textStyle': {
'color': '#333333'
}
},
'tooltip': {
'axisPointer': {
'lineStyle': {
'color': '#cccccc',
'width': 1
},
'crossStyle': {
'color': '#cccccc',
'width': 1
}
}
},
'timeline': {
'lineStyle': {
'color': '#293c55',
'width': 1
},
'itemStyle': {
'normal': {
'color': '#293c55',
'borderWidth': 1
},
'emphasis': {
'color': '#a9334c'
}
},
'controlStyle': {
'normal': {
'color': '#293c55',
'borderColor': '#293c55',
'borderWidth': 0.5
},
'emphasis': {
'color': '#293c55',
'borderColor': '#293c55',
'borderWidth': 0.5
}
},
'checkpointStyle': {
'color': '#e43c59',
'borderColor': 'rgba(194,53,49,0.5)'
},
'label': {
'normal': {
'textStyle': {
'color': '#293c55'
}
},
'emphasis': {
'textStyle': {
'color': '#293c55'
}
}
}
},
'visualMap': {
'color': [
'#e01f54',
'#e7dbc3'
]
},
'dataZoom': {
'backgroundColor': 'rgba(47,69,84,0)',
'dataBackgroundColor': 'rgba(47,69,84,0.3)',
'fillerColor': 'rgba(167,183,204,0.4)',
'handleColor': '#a7b7cc',
'handleSize': '100%',
'textStyle': {
'color': '#333333'
}
},
'markPoint': {
'label': {
'color': '#eeeeee'
},
'emphasis': {
'label': {
'color': '#eeeeee'
}
}
}
})
}))

View File

@@ -0,0 +1,445 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['exports', 'echarts'], factory)
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
// CommonJS
factory(exports, require('echarts'))
} else {
// Browser globals
factory({}, root.echarts)
}
}(this, function(exports, echarts) {
var log = function(msg) {
if (typeof console !== 'undefined') {
console && console.error && console.error(msg)
}
}
if (!echarts) {
log('ECharts is not Loaded')
return
}
echarts.registerTheme('shine', {
'color': [
'#c12e34',
'#e6b600',
'#0098d9',
'#2b821d',
'#005eaa',
'#339ca8',
'#cda819',
'#32a487'
],
'backgroundColor': 'rgba(0,0,0,0)',
'textStyle': {},
'title': {
'textStyle': {
'color': '#333333'
},
'subtextStyle': {
'color': '#aaaaaa'
}
},
'line': {
'itemStyle': {
'borderWidth': 1
},
'lineStyle': {
'width': 2
},
'symbolSize': 4,
'symbol': 'emptyCircle',
'smooth': false
},
'radar': {
'itemStyle': {
'borderWidth': 1
},
'lineStyle': {
'width': 2
},
'symbolSize': 4,
'symbol': 'emptyCircle',
'smooth': false
},
'bar': {
'itemStyle': {
'barBorderWidth': 0,
'barBorderColor': '#ccc'
}
},
'pie': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'scatter': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'boxplot': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'parallel': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'sankey': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'funnel': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'gauge': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'candlestick': {
'itemStyle': {
'color': '#c12e34',
'color0': '#2b821d',
'borderColor': '#c12e34',
'borderColor0': '#2b821d',
'borderWidth': 1
}
},
'graph': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
},
'lineStyle': {
'width': 1,
'color': '#aaaaaa'
},
'symbolSize': 4,
'symbol': 'emptyCircle',
'smooth': false,
'color': [
'#c12e34',
'#e6b600',
'#0098d9',
'#2b821d',
'#005eaa',
'#339ca8',
'#cda819',
'#32a487'
],
'label': {
'color': '#eeeeee'
}
},
'map': {
'itemStyle': {
'normal': {
'areaColor': '#ddd',
'borderColor': '#eee',
'borderWidth': 0.5
},
'emphasis': {
'areaColor': '#e6b600',
'borderColor': '#ddd',
'borderWidth': 1
}
},
'label': {
'normal': {
'textStyle': {
'color': '#c12e34'
}
},
'emphasis': {
'textStyle': {
'color': '#c12e34'
}
}
}
},
'geo': {
'itemStyle': {
'normal': {
'areaColor': '#ddd',
'borderColor': '#eee',
'borderWidth': 0.5
},
'emphasis': {
'areaColor': '#e6b600',
'borderColor': '#ddd',
'borderWidth': 1
}
},
'label': {
'normal': {
'textStyle': {
'color': '#c12e34'
}
},
'emphasis': {
'textStyle': {
'color': '#c12e34'
}
}
}
},
'categoryAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisTick': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#333'
}
},
'splitLine': {
'show': false,
'lineStyle': {
'color': [
'#ccc'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.3)',
'rgba(200,200,200,0.3)'
]
}
}
},
'valueAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisTick': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#333'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#ccc'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.3)',
'rgba(200,200,200,0.3)'
]
}
}
},
'logAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisTick': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#333'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#ccc'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.3)',
'rgba(200,200,200,0.3)'
]
}
}
},
'timeAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisTick': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#333'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#ccc'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.3)',
'rgba(200,200,200,0.3)'
]
}
}
},
'toolbox': {
'iconStyle': {
'normal': {
'borderColor': '#06467c'
},
'emphasis': {
'borderColor': '#4187c2'
}
}
},
'legend': {
'textStyle': {
'color': '#333333'
}
},
'tooltip': {
'axisPointer': {
'lineStyle': {
'color': '#cccccc',
'width': 1
},
'crossStyle': {
'color': '#cccccc',
'width': 1
}
}
},
'timeline': {
'lineStyle': {
'color': '#005eaa',
'width': 1
},
'itemStyle': {
'normal': {
'color': '#005eaa',
'borderWidth': 1
},
'emphasis': {
'color': '#005eaa'
}
},
'controlStyle': {
'normal': {
'color': '#005eaa',
'borderColor': '#005eaa',
'borderWidth': 0.5
},
'emphasis': {
'color': '#005eaa',
'borderColor': '#005eaa',
'borderWidth': 0.5
}
},
'checkpointStyle': {
'color': '#005eaa',
'borderColor': 'rgba(49,107,194,0.5)'
},
'label': {
'normal': {
'textStyle': {
'color': '#005eaa'
}
},
'emphasis': {
'textStyle': {
'color': '#005eaa'
}
}
}
},
'visualMap': {
'color': [
'#1790cf',
'#a2d4e6'
]
},
'dataZoom': {
'backgroundColor': 'rgba(47,69,84,0)',
'dataBackgroundColor': 'rgba(47,69,84,0.3)',
'fillerColor': 'rgba(167,183,204,0.4)',
'handleColor': '#a7b7cc',
'handleSize': '100%',
'textStyle': {
'color': '#333333'
}
},
'markPoint': {
'label': {
'color': '#eeeeee'
},
'emphasis': {
'label': {
'color': '#eeeeee'
}
}
}
})
}))

View File

@@ -0,0 +1,450 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['exports', 'echarts'], factory)
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
// CommonJS
factory(exports, require('echarts'))
} else {
// Browser globals
factory({}, root.echarts)
}
}(this, function(exports, echarts) {
var log = function(msg) {
if (typeof console !== 'undefined') {
console && console.error && console.error(msg)
}
}
if (!echarts) {
log('ECharts is not Loaded')
return
}
echarts.registerTheme('vintage', {
'color': [
'#d87c7c',
'#919e8b',
'#d7ab82',
'#6e7074',
'#61a0a8',
'#efa18d',
'#787464',
'#cc7e63',
'#724e58',
'#4b565b'
],
'backgroundColor': 'rgba(254,248,239,1)',
'textStyle': {},
'title': {
'textStyle': {
'color': '#333333'
},
'subtextStyle': {
'color': '#aaaaaa'
}
},
'line': {
'itemStyle': {
'borderWidth': 1
},
'lineStyle': {
'width': 2
},
'symbolSize': 4,
'symbol': 'emptyCircle',
'smooth': false
},
'radar': {
'itemStyle': {
'borderWidth': 1
},
'lineStyle': {
'width': 2
},
'symbolSize': 4,
'symbol': 'emptyCircle',
'smooth': false
},
'bar': {
'itemStyle': {
'barBorderWidth': 0,
'barBorderColor': '#ccc'
}
},
'pie': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'scatter': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'boxplot': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'parallel': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'sankey': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'funnel': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'gauge': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'candlestick': {
'itemStyle': {
'color': '#c23531',
'color0': '#314656',
'borderColor': '#c23531',
'borderColor0': '#314656',
'borderWidth': 1
}
},
'graph': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
},
'lineStyle': {
'width': 1,
'color': '#aaaaaa'
},
'symbolSize': 4,
'symbol': 'emptyCircle',
'smooth': false,
'color': [
'#d87c7c',
'#919e8b',
'#d7ab82',
'#6e7074',
'#61a0a8',
'#efa18d',
'#787464',
'#cc7e63',
'#724e58',
'#4b565b'
],
'label': {
'color': '#eeeeee'
}
},
'map': {
'itemStyle': {
'normal': {
'areaColor': '#eeeeee',
'borderColor': '#444444',
'borderWidth': 0.5
},
'emphasis': {
'areaColor': 'rgba(255,215,0,0.8)',
'borderColor': '#444444',
'borderWidth': 1
}
},
'label': {
'normal': {
'textStyle': {
'color': '#000000'
}
},
'emphasis': {
'textStyle': {
'color': 'rgb(100,0,0)'
}
}
}
},
'geo': {
'itemStyle': {
'normal': {
'areaColor': '#eeeeee',
'borderColor': '#444444',
'borderWidth': 0.5
},
'emphasis': {
'areaColor': 'rgba(255,215,0,0.8)',
'borderColor': '#444444',
'borderWidth': 1
}
},
'label': {
'normal': {
'textStyle': {
'color': '#000000'
}
},
'emphasis': {
'textStyle': {
'color': 'rgb(100,0,0)'
}
}
}
},
'categoryAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisTick': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#333'
}
},
'splitLine': {
'show': false,
'lineStyle': {
'color': [
'#ccc'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.3)',
'rgba(200,200,200,0.3)'
]
}
}
},
'valueAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisTick': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#333'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#ccc'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.3)',
'rgba(200,200,200,0.3)'
]
}
}
},
'logAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisTick': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#333'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#ccc'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.3)',
'rgba(200,200,200,0.3)'
]
}
}
},
'timeAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisTick': {
'show': true,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#333'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#ccc'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.3)',
'rgba(200,200,200,0.3)'
]
}
}
},
'toolbox': {
'iconStyle': {
'normal': {
'borderColor': '#999999'
},
'emphasis': {
'borderColor': '#666666'
}
}
},
'legend': {
'textStyle': {
'color': '#333333'
}
},
'tooltip': {
'axisPointer': {
'lineStyle': {
'color': '#cccccc',
'width': 1
},
'crossStyle': {
'color': '#cccccc',
'width': 1
}
}
},
'timeline': {
'lineStyle': {
'color': '#293c55',
'width': 1
},
'itemStyle': {
'normal': {
'color': '#293c55',
'borderWidth': 1
},
'emphasis': {
'color': '#a9334c'
}
},
'controlStyle': {
'normal': {
'color': '#293c55',
'borderColor': '#293c55',
'borderWidth': 0.5
},
'emphasis': {
'color': '#293c55',
'borderColor': '#293c55',
'borderWidth': 0.5
}
},
'checkpointStyle': {
'color': '#e43c59',
'borderColor': 'rgba(194,53,49,0.5)'
},
'label': {
'normal': {
'textStyle': {
'color': '#293c55'
}
},
'emphasis': {
'textStyle': {
'color': '#293c55'
}
}
}
},
'visualMap': {
'color': [
'#bf444c',
'#d88273',
'#f6efa6'
]
},
'dataZoom': {
'backgroundColor': 'rgba(47,69,84,0)',
'dataBackgroundColor': 'rgba(47,69,84,0.3)',
'fillerColor': 'rgba(167,183,204,0.4)',
'handleColor': '#a7b7cc',
'handleSize': '100%',
'textStyle': {
'color': '#333333'
}
},
'markPoint': {
'label': {
'color': '#eeeeee'
},
'emphasis': {
'label': {
'color': '#eeeeee'
}
}
}
})
}))

View File

@@ -0,0 +1,441 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['exports', 'echarts'], factory)
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
// CommonJS
factory(exports, require('echarts'))
} else {
// Browser globals
factory({}, root.echarts)
}
}(this, function(exports, echarts) {
var log = function(msg) {
if (typeof console !== 'undefined') {
console && console.error && console.error(msg)
}
}
if (!echarts) {
log('ECharts is not Loaded')
return
}
echarts.registerTheme('walden', {
'color': [
'#3fb1e3',
'#6be6c1',
'#626c91',
'#a0a7e6',
'#c4ebad',
'#96dee8'
],
'backgroundColor': 'rgba(252,252,252,0)',
'textStyle': {},
'title': {
'textStyle': {
'color': '#666666'
},
'subtextStyle': {
'color': '#999999'
}
},
'line': {
'itemStyle': {
'borderWidth': '2'
},
'lineStyle': {
'width': '3'
},
'symbolSize': '8',
'symbol': 'emptyCircle',
'smooth': false
},
'radar': {
'itemStyle': {
'borderWidth': '2'
},
'lineStyle': {
'width': '3'
},
'symbolSize': '8',
'symbol': 'emptyCircle',
'smooth': false
},
'bar': {
'itemStyle': {
'barBorderWidth': 0,
'barBorderColor': '#ccc'
}
},
'pie': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'scatter': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'boxplot': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'parallel': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'sankey': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'funnel': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'gauge': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'candlestick': {
'itemStyle': {
'color': '#e6a0d2',
'color0': 'transparent',
'borderColor': '#e6a0d2',
'borderColor0': '#3fb1e3',
'borderWidth': '2'
}
},
'graph': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
},
'lineStyle': {
'width': '1',
'color': '#cccccc'
},
'symbolSize': '8',
'symbol': 'emptyCircle',
'smooth': false,
'color': [
'#3fb1e3',
'#6be6c1',
'#626c91',
'#a0a7e6',
'#c4ebad',
'#96dee8'
],
'label': {
'color': '#ffffff'
}
},
'map': {
'itemStyle': {
'normal': {
'areaColor': '#eeeeee',
'borderColor': '#aaaaaa',
'borderWidth': 0.5
},
'emphasis': {
'areaColor': 'rgba(63,177,227,0.25)',
'borderColor': '#3fb1e3',
'borderWidth': 1
}
},
'label': {
'normal': {
'textStyle': {
'color': '#ffffff'
}
},
'emphasis': {
'textStyle': {
'color': '#3fb1e3'
}
}
}
},
'geo': {
'itemStyle': {
'normal': {
'areaColor': '#eeeeee',
'borderColor': '#aaaaaa',
'borderWidth': 0.5
},
'emphasis': {
'areaColor': 'rgba(63,177,227,0.25)',
'borderColor': '#3fb1e3',
'borderWidth': 1
}
},
'label': {
'normal': {
'textStyle': {
'color': '#ffffff'
}
},
'emphasis': {
'textStyle': {
'color': '#3fb1e3'
}
}
}
},
'categoryAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#cccccc'
}
},
'axisTick': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#999999'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#eeeeee'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.05)',
'rgba(200,200,200,0.02)'
]
}
}
},
'valueAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#cccccc'
}
},
'axisTick': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#999999'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#eeeeee'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.05)',
'rgba(200,200,200,0.02)'
]
}
}
},
'logAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#cccccc'
}
},
'axisTick': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#999999'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#eeeeee'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.05)',
'rgba(200,200,200,0.02)'
]
}
}
},
'timeAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#cccccc'
}
},
'axisTick': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#999999'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#eeeeee'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.05)',
'rgba(200,200,200,0.02)'
]
}
}
},
'toolbox': {
'iconStyle': {
'normal': {
'borderColor': '#999999'
},
'emphasis': {
'borderColor': '#666666'
}
}
},
'legend': {
'textStyle': {
'color': '#999999'
}
},
'tooltip': {
'axisPointer': {
'lineStyle': {
'color': '#cccccc',
'width': 1
},
'crossStyle': {
'color': '#cccccc',
'width': 1
}
}
},
'timeline': {
'lineStyle': {
'color': '#626c91',
'width': 1
},
'itemStyle': {
'normal': {
'color': '#626c91',
'borderWidth': 1
},
'emphasis': {
'color': '#626c91'
}
},
'controlStyle': {
'normal': {
'color': '#626c91',
'borderColor': '#626c91',
'borderWidth': 0.5
},
'emphasis': {
'color': '#626c91',
'borderColor': '#626c91',
'borderWidth': 0.5
}
},
'checkpointStyle': {
'color': '#3fb1e3',
'borderColor': 'rgba(63,177,227,0.15)'
},
'label': {
'normal': {
'textStyle': {
'color': '#626c91'
}
},
'emphasis': {
'textStyle': {
'color': '#626c91'
}
}
}
},
'visualMap': {
'color': [
'#2a99c9',
'#afe8ff'
]
},
'dataZoom': {
'backgroundColor': 'rgba(255,255,255,0)',
'dataBackgroundColor': 'rgba(222,222,222,1)',
'fillerColor': 'rgba(114,230,212,0.25)',
'handleColor': '#cccccc',
'handleSize': '100%',
'textStyle': {
'color': '#999999'
}
},
'markPoint': {
'label': {
'color': '#ffffff'
},
'emphasis': {
'label': {
'color': '#ffffff'
}
}
}
})
}))

View File

@@ -0,0 +1,442 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['exports', 'echarts'], factory)
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
// CommonJS
factory(exports, require('echarts'))
} else {
// Browser globals
factory({}, root.echarts)
}
}(this, function(exports, echarts) {
var log = function(msg) {
if (typeof console !== 'undefined') {
console && console.error && console.error(msg)
}
}
if (!echarts) {
log('ECharts is not Loaded')
return
}
echarts.registerTheme('westeros', {
'color': [
'#516b91',
'#59c4e6',
'#edafda',
'#93b7e3',
'#a5e7f0',
'#cbb0e3'
],
'backgroundColor': 'rgba(0,0,0,0)',
'textStyle': {},
'title': {
'textStyle': {
'color': '#516b91'
},
'subtextStyle': {
'color': '#93b7e3'
}
},
'line': {
'itemStyle': {
'borderWidth': '2'
},
'lineStyle': {
'width': '2'
},
'symbolSize': '6',
'symbol': 'emptyCircle',
'smooth': true
},
'radar': {
'itemStyle': {
'borderWidth': '2'
},
'lineStyle': {
'width': '2'
},
'symbolSize': '6',
'symbol': 'emptyCircle',
'smooth': true
},
'bar': {
'itemStyle': {
'barBorderWidth': 0,
'barBorderColor': '#ccc'
}
},
'pie': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'scatter': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'boxplot': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'parallel': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'sankey': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'funnel': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'gauge': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'candlestick': {
'itemStyle': {
'color': '#edafda',
'color0': 'transparent',
'borderColor': '#d680bc',
'borderColor0': '#8fd3e8',
'borderWidth': '2'
}
},
'graph': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
},
'lineStyle': {
'width': 1,
'color': '#aaa'
},
'symbolSize': '6',
'symbol': 'emptyCircle',
'smooth': true,
'color': [
'#516b91',
'#59c4e6',
'#edafda',
'#93b7e3',
'#a5e7f0',
'#cbb0e3'
],
'label': {
'color': '#eee'
}
},
'map': {
'itemStyle': {
'normal': {
'areaColor': '#f3f3f3',
'borderColor': '#516b91',
'borderWidth': 0.5
},
'emphasis': {
'areaColor': '#a5e7f0',
'borderColor': '#516b91',
'borderWidth': 1
}
},
'label': {
'normal': {
'textStyle': {
'color': '#000'
}
},
'emphasis': {
'textStyle': {
'color': '#516b91'
}
}
}
},
'geo': {
'itemStyle': {
'normal': {
'areaColor': '#f3f3f3',
'borderColor': '#516b91',
'borderWidth': 0.5
},
'emphasis': {
'areaColor': '#a5e7f0',
'borderColor': '#516b91',
'borderWidth': 1
}
},
'label': {
'normal': {
'textStyle': {
'color': '#000'
}
},
'emphasis': {
'textStyle': {
'color': '#516b91'
}
}
}
},
'categoryAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#cccccc'
}
},
'axisTick': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#999999'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#eeeeee'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.05)',
'rgba(200,200,200,0.02)'
]
}
}
},
'valueAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#cccccc'
}
},
'axisTick': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#999999'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#eeeeee'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.05)',
'rgba(200,200,200,0.02)'
]
}
}
},
'logAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#cccccc'
}
},
'axisTick': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#999999'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#eeeeee'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.05)',
'rgba(200,200,200,0.02)'
]
}
}
},
'timeAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#cccccc'
}
},
'axisTick': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#999999'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#eeeeee'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.05)',
'rgba(200,200,200,0.02)'
]
}
}
},
'toolbox': {
'iconStyle': {
'normal': {
'borderColor': '#999999'
},
'emphasis': {
'borderColor': '#666666'
}
}
},
'legend': {
'textStyle': {
'color': '#999999'
}
},
'tooltip': {
'axisPointer': {
'lineStyle': {
'color': '#cccccc',
'width': 1
},
'crossStyle': {
'color': '#cccccc',
'width': 1
}
}
},
'timeline': {
'lineStyle': {
'color': '#8fd3e8',
'width': 1
},
'itemStyle': {
'normal': {
'color': '#8fd3e8',
'borderWidth': 1
},
'emphasis': {
'color': '#8fd3e8'
}
},
'controlStyle': {
'normal': {
'color': '#8fd3e8',
'borderColor': '#8fd3e8',
'borderWidth': 0.5
},
'emphasis': {
'color': '#8fd3e8',
'borderColor': '#8fd3e8',
'borderWidth': 0.5
}
},
'checkpointStyle': {
'color': '#8fd3e8',
'borderColor': 'rgba(138,124,168,0.37)'
},
'label': {
'normal': {
'textStyle': {
'color': '#8fd3e8'
}
},
'emphasis': {
'textStyle': {
'color': '#8fd3e8'
}
}
}
},
'visualMap': {
'color': [
'#516b91',
'#59c4e6',
'#a5e7f0'
]
},
'dataZoom': {
'backgroundColor': 'rgba(0,0,0,0)',
'dataBackgroundColor': 'rgba(255,255,255,0.3)',
'fillerColor': 'rgba(167,183,204,0.4)',
'handleColor': '#a7b7cc',
'handleSize': '100%',
'textStyle': {
'color': '#333333'
}
},
'markPoint': {
'label': {
'color': '#eee'
},
'emphasis': {
'label': {
'color': '#eee'
}
}
}
})
}))

View File

@@ -0,0 +1,442 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['exports', 'echarts'], factory)
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
// CommonJS
factory(exports, require('echarts'))
} else {
// Browser globals
factory({}, root.echarts)
}
}(this, function(exports, echarts) {
var log = function(msg) {
if (typeof console !== 'undefined') {
console && console.error && console.error(msg)
}
}
if (!echarts) {
log('ECharts is not Loaded')
return
}
echarts.registerTheme('wonderland', {
'color': [
'#4ea397',
'#22c3aa',
'#7bd9a5',
'#d0648a',
'#f58db2',
'#f2b3c9'
],
'backgroundColor': 'rgba(255,255,255,0)',
'textStyle': {},
'title': {
'textStyle': {
'color': '#666666'
},
'subtextStyle': {
'color': '#999999'
}
},
'line': {
'itemStyle': {
'borderWidth': '2'
},
'lineStyle': {
'width': '3'
},
'symbolSize': '8',
'symbol': 'emptyCircle',
'smooth': false
},
'radar': {
'itemStyle': {
'borderWidth': '2'
},
'lineStyle': {
'width': '3'
},
'symbolSize': '8',
'symbol': 'emptyCircle',
'smooth': false
},
'bar': {
'itemStyle': {
'barBorderWidth': 0,
'barBorderColor': '#ccc'
}
},
'pie': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'scatter': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'boxplot': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'parallel': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'sankey': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'funnel': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'gauge': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
}
},
'candlestick': {
'itemStyle': {
'color': '#d0648a',
'color0': 'transparent',
'borderColor': '#d0648a',
'borderColor0': '#22c3aa',
'borderWidth': '1'
}
},
'graph': {
'itemStyle': {
'borderWidth': 0,
'borderColor': '#ccc'
},
'lineStyle': {
'width': '1',
'color': '#cccccc'
},
'symbolSize': '8',
'symbol': 'emptyCircle',
'smooth': false,
'color': [
'#4ea397',
'#22c3aa',
'#7bd9a5',
'#d0648a',
'#f58db2',
'#f2b3c9'
],
'label': {
'color': '#ffffff'
}
},
'map': {
'itemStyle': {
'normal': {
'areaColor': '#eeeeee',
'borderColor': '#999999',
'borderWidth': 0.5
},
'emphasis': {
'areaColor': 'rgba(34,195,170,0.25)',
'borderColor': '#22c3aa',
'borderWidth': 1
}
},
'label': {
'normal': {
'textStyle': {
'color': '#28544e'
}
},
'emphasis': {
'textStyle': {
'color': '#349e8e'
}
}
}
},
'geo': {
'itemStyle': {
'normal': {
'areaColor': '#eeeeee',
'borderColor': '#999999',
'borderWidth': 0.5
},
'emphasis': {
'areaColor': 'rgba(34,195,170,0.25)',
'borderColor': '#22c3aa',
'borderWidth': 1
}
},
'label': {
'normal': {
'textStyle': {
'color': '#28544e'
}
},
'emphasis': {
'textStyle': {
'color': '#349e8e'
}
}
}
},
'categoryAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#cccccc'
}
},
'axisTick': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#999999'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#eeeeee'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.05)',
'rgba(200,200,200,0.02)'
]
}
}
},
'valueAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#cccccc'
}
},
'axisTick': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#999999'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#eeeeee'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.05)',
'rgba(200,200,200,0.02)'
]
}
}
},
'logAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#cccccc'
}
},
'axisTick': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#999999'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#eeeeee'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.05)',
'rgba(200,200,200,0.02)'
]
}
}
},
'timeAxis': {
'axisLine': {
'show': true,
'lineStyle': {
'color': '#cccccc'
}
},
'axisTick': {
'show': false,
'lineStyle': {
'color': '#333'
}
},
'axisLabel': {
'show': true,
'textStyle': {
'color': '#999999'
}
},
'splitLine': {
'show': true,
'lineStyle': {
'color': [
'#eeeeee'
]
}
},
'splitArea': {
'show': false,
'areaStyle': {
'color': [
'rgba(250,250,250,0.05)',
'rgba(200,200,200,0.02)'
]
}
}
},
'toolbox': {
'iconStyle': {
'normal': {
'borderColor': '#999999'
},
'emphasis': {
'borderColor': '#666666'
}
}
},
'legend': {
'textStyle': {
'color': '#999999'
}
},
'tooltip': {
'axisPointer': {
'lineStyle': {
'color': '#cccccc',
'width': 1
},
'crossStyle': {
'color': '#cccccc',
'width': 1
}
}
},
'timeline': {
'lineStyle': {
'color': '#4ea397',
'width': 1
},
'itemStyle': {
'normal': {
'color': '#4ea397',
'borderWidth': 1
},
'emphasis': {
'color': '#4ea397'
}
},
'controlStyle': {
'normal': {
'color': '#4ea397',
'borderColor': '#4ea397',
'borderWidth': 0.5
},
'emphasis': {
'color': '#4ea397',
'borderColor': '#4ea397',
'borderWidth': 0.5
}
},
'checkpointStyle': {
'color': '#4ea397',
'borderColor': 'rgba(60,235,210,0.3)'
},
'label': {
'normal': {
'textStyle': {
'color': '#4ea397'
}
},
'emphasis': {
'textStyle': {
'color': '#4ea397'
}
}
}
},
'visualMap': {
'color': [
'#d0648a',
'#22c3aa',
'#adfff1'
]
},
'dataZoom': {
'backgroundColor': 'rgba(255,255,255,0)',
'dataBackgroundColor': 'rgba(222,222,222,1)',
'fillerColor': 'rgba(114,230,212,0.25)',
'handleColor': '#cccccc',
'handleSize': '100%',
'textStyle': {
'color': '#999999'
}
},
'markPoint': {
'label': {
'color': '#ffffff'
},
'emphasis': {
'label': {
'color': '#ffffff'
}
}
}
})
}))

View File

@@ -0,0 +1,33 @@
<template>
<div class="app-container">
<transition name="el-zoom-in-center">
<data-chart-list v-if="options.showList" @showCard="showCard" />
</transition>
</div>
</template>
<script>
import DataChartList from './DataChartList'
export default {
name: 'DataChart',
components: { DataChartList },
data() {
return {
options: {
data: {},
showList: true
}
}
},
methods: {
showCard(data) {
Object.assign(this.options, data)
}
}
}
</script>
<style lang="scss" scoped>
</style>