Commit 2f196a23 by 匡雅琴

样式调整

1 parent 94c9e556
......@@ -16,7 +16,7 @@
</div>
</div>
<div class="container">
<BarChart domId="analyseChart" :revese="true" boxHeight="14.54vh" :analysisList="analysisList"></BarChart>
<BarChart domId="analyseChart" :revese="true" boxHeight="14.54vh" :analysisList="analysisList" :colorList="colorList"></BarChart>
</div>
</div>
</template>
......@@ -31,7 +31,8 @@ export default {
data() {
return {
analysisList: {},
isShow: true
isShow: true,
colorList: ['#5C56FF', '#22D8FF']
}
},
mounted() {
......
......@@ -5,7 +5,7 @@
<span>区域分布</span>
</div>
<div class="container">
<BarChart domId="areaChart" :analysisList="areaList"></BarChart>
<BarChart domId="areaChart" :analysisList="areaList" :colorList="colorList"></BarChart>
</div>
</div>
</template>
......@@ -17,7 +17,9 @@ export default {
BarChart
},
data() {
return {}
return {
colorList: ['#22D8FF', '#223FA9', '#071735']
}
},
props: {
areaList: {
......
......@@ -50,6 +50,9 @@ export default {
type: Number,
default: 0
},
colorList: {
type: Array
},
tooltipFormatterObj: {
type: Array,
default: () => {
......@@ -103,13 +106,13 @@ export default {
watch: {
analysisList: {
handler() {
const { rotate, analysisList } = this
const { rotate, analysisList, colorList } = this
const obj = {
rotate,
analysisList,
ValueAnalysis
}
this.lineOptions = this.revese ? getBarReverseOptions(obj) : getBarOptions(obj)
this.lineOptions = this.revese ? getBarReverseOptions(obj, colorList) : getBarOptions(obj, colorList)
this.chartBindEvent()
},
deep: true
......
......@@ -5,7 +5,7 @@
<span>品牌分布</span>
</div>
<div class="container">
<BarChart domId="brandChart" :rotate="30" :analysisList="brandList"></BarChart>
<BarChart domId="brandChart" :rotate="30" :analysisList="brandList" :colorList="colorList"></BarChart>
</div>
</div>
</template>
......@@ -17,7 +17,9 @@ export default {
BarChart
},
data() {
return {}
return {
colorList: ['#2AD191', '#0E958D', '#071735']
}
},
props: {
brandList: {
......
......@@ -6,11 +6,11 @@
* @FilePath: \dj-data-view\src\components\barOptions.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import * as echarts from 'echarts'
import utils from '../../../utils/util'
function getBarOptions(obj) {
function getBarOptions(obj, colorList) {
const { analysisList, rotate } = obj
const num = analysisList.map(item => item.ratio * 100)
console.log(num)
const name = analysisList.map(item => item.name)
var options = {
xAxis: {
......@@ -56,8 +56,28 @@ function getBarOptions(obj) {
{
type: 'bar',
symbol: 'circle',
backgroundStyle: {
color: '#6578FF'
// backgroundStyle: {
// color: '#6578FF'
// },
itemStyle: {
barBorderRadius: [2, 2, 0, 0], // 柱体圆角
color: function(params) {
// var colorItem = []
return new echarts.graphic.LinearGradient(
0, 0, 0, 1, [{ // 代表渐变色从正上方开始
offset: 0, // offset范围是0~1,用于表示位置,0是指0%处的颜色
color: colorList[0]
}, // 柱图渐变色
{
offset: 0.5, // 指100%处的颜色
color: colorList[1]
},
{
offset: 1, // 指100%处的颜色
color: colorList[2]
}]
)
}
},
barWidth: '35%',
data: num
......@@ -66,7 +86,7 @@ function getBarOptions(obj) {
}
return options
}
function getBarReverseOptions(obj) {
function getBarReverseOptions(obj, colorList) {
const { analysisList, ValueAnalysis } = obj
// const value = Object.values(analysisList)
const entries = Object.entries(analysisList)
......@@ -151,6 +171,20 @@ function getBarReverseOptions(obj) {
lineHeight: 16
}
}
},
barBorderRadius: [2, 2, 0, 0], // 柱体圆角
color: function(params) {
// var colorItem = []
return new echarts.graphic.LinearGradient(
0, 0, 0, 1, [{ // 代表渐变色从正上方开始
offset: 0, // offset范围是0~1,用于表示位置,0是指0%处的颜色
color: colorList[0]
}, // 柱图渐变色
{
offset: 1, // 指100%处的颜色
color: colorList[1]
}]
)
}
},
data: value.map(item => item.value)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!