scatter.vue 1.76 KB
<!-- 性别统计 -->
<template>
    <div>
        <!-- 顶部区域 S-->
        <div class="ipage_top">
            <div class="tit"><img :src="bindIcon('caigou1')"/>{{title||chartData.title}}</div>
        </div>
        <div class="ichart">
            <scatter-chart ref="chart" :cdata="chartData" tval="scatter"></scatter-chart>
        </div>
    </div>
</template>

<script>
import mixin from './mixin';
import mallData from '@/components/Echarts/data';
import _ from 'underscore';
/**********************************************************/
const chartsConfig = {
    default:{ //默认
        otherConf:{
            
        }
    }
};
/*******************************************************/
export default {
    mixins: [mixin],
    data() {
        return {
            configObj:{}
        }
    },
    created() {
        
    },
    methods: {
        getChartsConfig(){
            return chartsConfig;
        },
        loadChartData(params){
            this.chartId = this.getChartId(this.ckey);
            if(this.chartId){
               this.ajaxModuleData().then(data=>{
                  this.setChartData(data);
               });
            }
        },
        setChartData(data){
            let sdata = [];
            let xAxis = [];
            data.series.forEach(item=>{
                let it = item.data[0];
                xAxis.push(it.ageMid);
                sdata.push([it.ageMid,it.genderRatio,it.personCustom,item.name]);
            })
            let chartData = {title:data.title,series:[{name:data.title,data:sdata}],xaxis:{data:_.sortBy(_.uniq(xAxis))}};
            this.chartData = Object.assign({},chartData,{
                otherConf:this.configObj.otherConf||{}
            });
        }
    }
}
</script>

<style  lang="less">

</style>