vue中使用echarts改變Y軸數(shù)值

重要的是這一句 :

在setOption里面加上


????????yAxis:?{

??????????type:?"value",

??????????name:?"銷量",

??????????min:?0,

??????????//總數(shù)

??????????max:?3000,

??????????//間隔數(shù)量

??????????interval:?500,

??????????axisLabel:?{

????????????formatter:?"{value}千克",

??????????},

??????????//???splitLine:?{?show:?true?},?//去除網(wǎng)格線

??????????splitArea:?{?show:?true?},?//保留網(wǎng)格區(qū)域

??????????splitLine:?{

????????????show:?true,

????????????lineStyle:?{

??????????????//使用深淺的間隔色

??????????????color:?["red"],?//設(shè)置顏色

????????????},

??????????},

????????},

完整代碼? Hello.vue

<template>

??<div

????id="myChart"

????:style="{?width:?'500px',?height:?'300px',?margin:?'auto'?}"

??></div>

</template>

<script>

export?default?{

??name:?"hello",

??data()?{

????return?{

??????msg:?"Welcome?to?Your?Vue.js?App",

????};

??},

??created()?{

??????this.$emit('handleclick');

??},

??mounted()?{

????this.drawLine();

??},

??methods:?{

????drawLine()?{

??????//?基于準(zhǔn)備好的dom,初始化echarts實(shí)例

??????let?myChart?=?this.$echarts.init(document.getElementById("myChart"));

??????//?繪制圖表

??????myChart.setOption({

????????title:?{

??????????text:?"二級(jí)部門需求表(單位:個(gè))",

??????????subtext:?"From?ExcelHome",

??????????//???sublink:?"http://e.weibo.com/1341556070/AjQH99che",

????????},

????????tooltip:?{

??????????trigger:?"axis",

??????????axisPointer:?{

????????????//?坐標(biāo)軸指示器,坐標(biāo)軸觸發(fā)有效

????????????type:?"shadow",?//?默認(rèn)為直線,可選為:'line'?|?'shadow'

??????????},

??????????formatter:?function?(params)?{

????????????var?tar?=?params[1];

????????????return?tar.name?+?"<br/>"?+?tar.seriesName?+?"?:?"?+?tar.value;

??????????},

????????},

????????grid:?{

??????????left:?"3%",

??????????right:?"4%",

??????????bottom:?"3%",

??????????containLabel:?true,

????????},

????????xAxis:?{

??????????type:?"category",

??????????splitLine:?{?show:?false?},

??????????data:?["總需求",?"房租",?"水電費(fèi)",?"交通費(fèi)",?"伙食費(fèi)",?"日用品數(shù)"],

????????},

????????yAxis:?{

??????????type:?"value",

??????????name:?"銷量",

??????????min:?0,

??????????//總數(shù)

??????????max:?3000,

??????????//間隔數(shù)量

??????????interval:?500,

??????????axisLabel:?{

????????????formatter:?"{value}千克",

??????????},

??????????//???splitLine:?{?show:?true?},?//去除網(wǎng)格線

??????????splitArea:?{?show:?true?},?//保留網(wǎng)格區(qū)域

??????????splitLine:?{

????????????show:?true,

????????????lineStyle:?{

??????????????//使用深淺的間隔色

??????????????color:?["red"],?//設(shè)置顏色

????????????},

??????????},

????????},

????????series:?[

??????????{

????????????name:?"輔助",

????????????type:?"bar",

????????????stack:?"總量",

????????????itemStyle:?{

??????????????barBorderColor:?"rgba(0,0,0,0)",

??????????????color:?"rgba(0,0,0,0)",

????????????},

????????????emphasis:?{

??????????????itemStyle:?{

????????????????barBorderColor:?"rgba(0,0,0,0)",

????????????????color:?"rgba(0,0,0,0)",

??????????????},

????????????},

????????????data:?[0,?1700,?1400,?1200,?300,?0],

??????????},

??????????{

????????????name:?"生活費(fèi)",

????????????type:?"bar",

????????????stack:?"總量",

????????????label:?{

??????????????show:?true,

??????????????position:?"inside",

????????????},

????????????data:?[2900,?1200,?300,?200,?900,?300],

??????????},

????????],

??????});

????},

??},

};

</script>

<style>

</style>

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容