最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Vue+Antv?F2實(shí)現(xiàn)層疊柱狀圖

 更新時(shí)間:2022年04月07日 11:07:23   作者:weixin_38673922  
這篇文章主要為大家詳細(xì)介紹了Vue+Antv?F2實(shí)現(xiàn)層疊柱狀圖,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了Vue+ Antv F2實(shí)現(xiàn)層疊柱狀圖的具體代碼,供大家參考,具體內(nèi)容如下

一、 創(chuàng)建canvas標(biāo)簽

<canvas id="caseChart" style="width: 100%;height: 230px;"></canvas>

二、 編寫圖表繪制代碼

methods:{
?? ? ? ?//獲取專利案件Chart圖標(biāo)信息
?? ? ? ?getCaseChartData(){
?? ? ? ??? ?var _this = this;
?? ? ? ??? ?var params = {
?? ? ? ??? ??? ?dataType:_this.caseDataType,
?? ??? ??? ??? ?beginDate:'',
?? ??? ??? ??? ?endDate:_this.endDate
?? ? ? ??? ?}?? ??? ? ? ??? ?
?? ? ? ??? ?_this.$http.get('/api/patent/StatisticsPatentChartAmount',{params:params})
?? ? ? ??? ?.then(res =>{
?? ? ? ??? ??? ?if(res.status == 200){
?? ? ? ??? ??? ??? ?for(var i = 0; i < res.data.length; i++){
?? ? ? ??? ??? ??? ??? ?if(res.data[i].dataType == "monthPatent"){res.data[i].dataType = '新立案'}
?? ? ? ??? ??? ??? ??? ?else if(res.data[i].dataType == "applyPatent"){res.data[i].dataType = '新申請(qǐng)'}
?? ? ? ??? ??? ??? ??? ?else if(res.data[i].dataType == "PCTPatent"){res.data[i].dataType = 'PCT國(guó)際'}
?? ? ? ??? ??? ??? ??? ?else if(res.data[i].dataType == "otherPatent"){res.data[i].dataType = '其他案件'}
?? ? ? ??? ??? ??? ??? ?else {}
?? ? ? ??? ??? ??? ??? ?res.data[i].date = res.data[i].date+"-01" + " 00:00:00"
?? ? ? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?_this.caseData = res.data;
?? ??? ??? ??? ??? ?_this.$options.methods.caseChart.bind(this)();
?? ? ? ??? ??? ?}else{
?? ? ? ??? ??? ??? ?
?? ? ? ??? ??? ?}
?? ??? ??? ?})
?? ? ? ??? ?.catch(error =>{
?? ??? ??? ?})?? ??? ??? ? ? ??? ?
?? ? ? ?},
?? ?
?? ??? ?caseChart(){
?? ??? ??? ?var _this = this;

?? ??? ??? ?//創(chuàng)建 Chart 對(duì)象
?? ??? ??? ?_this.casechart = new this.$F2.Chart({?? ??? ??? ?
?? ??? ??? ? ?id: 'caseChart',
?? ??? ??? ? ?pixelRatio: window.devicePixelRatio,?? ??? ??? ?//指定分辨率
?? ??? ??? ?});

?? ??? ??? ?//source 載入數(shù)據(jù)
?? ??? ??? ?_this.casechart.source(JSON.parse(JSON.stringify(this.caseData)), {?? ?
?? ??? ??? ? ?date: {?? ?//x軸
?? ??? ??? ? ? ?type: 'timeCat',
?? ??? ??? ? ? ?tickCount: 6,
?? ?//?? ??? ??? ?range: [ 0.1, 0.9 ],
?? ??? ??? ? ? ?mask:'YY-MM',
?? ??? ??? ? ?},
//?? ??? ??? ? ?amount: {?? ?
//?? ??? ??? ? ?}
?? ??? ??? ?});
?? ??? ??? ?_this.casechart.tooltip({
?? ??? ??? ? ?custom: true, // 自定義 tooltip 內(nèi)容框
?? ??? ??? ? ?onChange: function onChange(obj) {
?? ??? ??? ? ? ?const legend = _this.casechart.get('legendController').legends.top[0];
?? ??? ??? ? ? ?const tooltipItems = obj.items;
?? ??? ??? ? ? ?const legendItems = legend.items;
?? ??? ??? ? ? ?const map = {};
?? ??? ??? ? ? ?legendItems.forEach(function(item) {
?? ??? ??? ? ? ? ?map[item.name] = item;
?? ??? ??? ? ? ?});
?? ??? ??? ? ? ?tooltipItems.forEach(function(item) {
?? ??? ??? ? ? ? ?const name = item.name;
?? ??? ??? ? ? ? ?const value = item.value;
?? ??? ??? ? ? ? ?if (map[name]) {
?? ??? ??? ? ? ? ? ?map[name].value = value;
?? ??? ??? ? ? ? ?}
?? ??? ??? ? ? ?});
?? ?//?? ??? ??? ?legend.setItems(_.values(map));
?? ??? ??? ? ?},
?? ??? ??? ? ?onHide: function onHide() {
?? ??? ??? ? ? ?const legend = _this.casechart.get('legendController').legends.top[0];
?? ??? ??? ? ? ?legend.setItems(_this.casechart.getLegendItems().country);
?? ??? ??? ? ?}
?? ??? ??? ?});?? ?
?? ??? ??? ?
?? ??? ??? ?var barWidth = 16 * (window.innerWidth / 375);
?? ??? ??? ?
?? ??? ??? ?//創(chuàng)建圖形語(yǔ)法,繪制圖,由 date 和 amount 兩個(gè)屬性決定圖形位置,date 映射至 x 軸,amount 映射至 y 軸
?? ??? ??? ?_this.casechart.interval()?? ??? ??? ?
?? ??? ??? ? ?.position('date*amount')
?? ??? ??? ? ?.color('dataType')
?? ??? ??? ? ?.adjust('stack')
?? ??? ??? ? ?.size(barWidth)

?? ??? ??? ?//渲染圖表
?? ??? ??? ?_this.casechart.render();?? ??? ??? ??? ?
?? ??? ?}
?? ?},
?? ?mounted() {
?? ??? ?var v = this;
?? ??? ?this.$nextTick(() => {
?? ??? ??? ?v.caseChart();
?? ??? ?});
?? ?},

三、展示效果

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論

堆龙德庆县| 菏泽市| 疏附县| 岳普湖县| 曲水县| 安阳市| 凤庆县| 巴彦淖尔市| 汾阳市| 林口县| 南和县| 肥东县| 任丘市| 涟源市| 公主岭市| 宝山区| 抚松县| 宜兰市| 秦皇岛市| 扎赉特旗| SHOW| 综艺| 汝州市| 阳城县| 油尖旺区| 林周县| 舟山市| 广南县| 抚州市| 霸州市| 苍山县| 临夏市| 呼图壁县| 邵东县| 潞城市| 丹江口市| 喀喇| 新昌县| 郴州市| 类乌齐县| 茌平县|