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

angular4中引入echarts的方法示例

 更新時(shí)間:2019年01月29日 08:28:38   作者:Zitming  
這篇文章主要介紹了angular4中引入echarts的方法示例,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧

1.安裝ngx-echarts

npm install echarts --save
npm install ngx-echarts --save

2.在項(xiàng)目中引入echarts

//angular-cli.json文件

{
  "apps": [{
    "scripts":[
      "../node_modules/echarts/dist/echarts.min.js",
      "../node_modules/echarts/map/js/china.js",
      "../node_modules/echarts/dist/extension/bmap.js"
    ]
  }]
}

3.使用 在你真正需要使用echarts指令的module中import NgxEchartsModule

echarts.module.ts

import { NgModule } from '@angular/core';
import { EchartsComponent } from './echarts/echarts.component';
import { NgxEchartsModule } from 'ngx-echarts';

@NgModule({
 imports: [
  NgxEchartsModule 
 ],
 declarations: [EchartsComponent],
})
export class EchartsModule { }

echarts.component.ts

import { Component, OnInit } from '@angular/core';

@Component({
 selector: 'app-echarts',
 templateUrl: './echarts.component.html',
 styleUrls: ['./echarts.component.scss']
})
export class EchartsComponent implements OnInit {
 showloading:boolean = true;

 constructor() { 
  
  setTimeout(()=> {
   this.showloading = false;
  }, 3000);
 }

 ngOnInit() {
 }

 chartOption = {
  title: {
   text: '堆疊區(qū)域圖'
  },
  tooltip: {
   trigger: 'axis'
  },
  legend: {
   data: ['郵件營(yíng)銷', '聯(lián)盟廣告', '視頻廣告', '直接訪問(wèn)', '搜索引擎']
  },
  toolbox: {
   feature: {
    saveAsImage: {}
   }
  },
  grid: {
   left: '3%',
   right: '4%',
   bottom: '3%',
   containLabel: true
  },
  xAxis: [
   {
    type: 'category',
    boundaryGap: false,
    data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
   }
  ],
  yAxis: [
   {
    type: 'value'
   }
  ],
  series: [
   {
    name: '郵件營(yíng)銷',
    type: 'line',
    stack: '總量',
    areaStyle: { normal: {} },
    data: [120, 132, 101, 134, 90, 230, 210]
   },
   {
    name: '聯(lián)盟廣告',
    type: 'line',
    stack: '總量',
    areaStyle: { normal: {} },
    data: [220, 182, 191, 234, 290, 330, 310]
   },
   {
    name: '視頻廣告',
    type: 'line',
    stack: '總量',
    areaStyle: { normal: {} },
    data: [150, 232, 201, 154, 190, 330, 410]
   },
   {
    name: '直接訪問(wèn)',
    type: 'line',
    stack: '總量',
    areaStyle: { normal: {} },
    data: [320, 332, 301, 334, 390, 330, 320]
   },
   {
    name: '搜索引擎',
    type: 'line',
    stack: '總量',
    label: {
     normal: {
      show: true,
      position: 'top'
     }
    },
    areaStyle: { normal: {} },
    data: [820, 932, 901, 934, 1290, 1330, 1320]
   }
  ]
 }

 Baroptions = {
  tooltip: {
   trigger: 'item',
   formatter: "{a} 
: {c} (wppm3vysvbp%)"
  },
  legend: {
   orient: 'vertical',
   x: 'left',
   data: ['直達(dá)', '營(yíng)銷廣告', '搜索引擎', '郵件營(yíng)銷', '聯(lián)盟廣告', '視頻廣告', '百度', '谷歌', '必應(yīng)', '其他']
  },
  series: [
   {
    name: '訪問(wèn)來(lái)源',
    type: 'pie',
    selectedMode: 'single',
    radius: [0, '30%'],

    label: {
     normal: {
      position: 'inner'
     }
    },
    labelLine: {
     normal: {
      show: false
     }
    },
    data: [
     { value: 335, name: '直達(dá)', selected: true },
     { value: 679, name: '營(yíng)銷廣告' },
     { value: 1548, name: '搜索引擎' }
    ]
   },
   {
    name: '訪問(wèn)來(lái)源',
    type: 'pie',
    radius: ['40%', '55%'],

    data: [
     { value: 335, name: '直達(dá)' },
     { value: 310, name: '郵件營(yíng)銷' },
     { value: 234, name: '聯(lián)盟廣告' },
     { value: 135, name: '視頻廣告' },
     { value: 1048, name: '百度' },
     { value: 251, name: '谷歌' },
     { value: 147, name: '必應(yīng)' },
     { value: 102, name: '其他' }
    ]
   }
  ]
 }


 linkoption = {
  title: {
   text: '懶貓今日訪問(wèn)量'
  },
  color: ['#3398DB'],
  //氣泡提示框,常用于展現(xiàn)更詳細(xì)的數(shù)據(jù)
  tooltip: {
   trigger: 'axis',
   axisPointer: { // 坐標(biāo)軸指示器,坐標(biāo)軸觸發(fā)有效
    type: 'shadow' // 默認(rèn)為直線,可選為:'line' | 'shadow'
   }
  },
  toolbox: {
   show: true,
   feature: {
    //顯示縮放按鈕
    dataZoom: {
     show: true
    },
    //顯示折線和塊狀圖之間的切換
    magicType: {
     show: true,
     type: ['bar', 'line']
    },
    //顯示是否還原
    restore: {
     show: true
    },
    //是否顯示圖片
    saveAsImage: {
     show: true
    }
   }
  },
  grid: {
   left: '3%',
   right: '4%',
   bottom: '3%',
   containLabel: true
  },
  xAxis: [{
   type: 'category',
   data: [21231,1212,21231,3213],
   axisTick: {
    alignWithLabel: true
   },
   axisLabel: {
    interval: 0,
    rotate: 20
   },
  }],
  yAxis: [{
   name: "懶貓今日訪問(wèn)量",
   type: 'value'
  }],
  series: [{
   name: '今日訪問(wèn)次數(shù)',
   type: 'bar',
   barWidth: '60%',
   label: {
    normal: {
     show: true
    }
   },
   data:[21231,1212,21231,3213]
  }]
 }


 datamapvalue = [
    {name: '海門', value: [121.15,31.89,9]},
    {name: '鄂爾多斯', value: [109.781327,39.608266,12]},
    {name: '招遠(yuǎn)', value: [120.38,37.35,12]},
    {name: '舟山', value: [122.207216,29.985295,12]},
    {name: '齊齊哈爾', value: [123.97,47.33,14]},
    {name: '鹽城', value: [120.13,33.38,15]},
    {name: '赤峰', value: [118.87,42.28,16]},
    {name: '青島', value: [120.33,36.07,18]},
    {name: '山', value: [121.52,36.89,18]},
    {name: '金昌', value: [102.188043,38.520089,19]}
  ];


 mapoption = {
  backgroundColor: '#404a59',
  title: {
   text: '全國(guó)主要城市空氣質(zhì)量',
   subtext: 'data from PM25.in',
   sublink: 'http://www.pm25.in',
   left: 'center',
   textStyle: {
    color: '#fff'
   }
  },
  tooltip: {
   trigger: 'item'
  },
  legend: {
   orient: 'vertical',
   y: 'bottom',
   x: 'right',
   data: ['pm2.5'],
   textStyle: {
    color: '#fff'
   }
  },
  geo: {
   map: 'china',
   label: {
    emphasis: {
     show: false
    }
   },
   roam: true,
   itemStyle: {
    normal: {
     areaColor: '#323c48',
     borderColor: '#111'
    },
    emphasis: {
     areaColor: '#2a333d'
    }
   }
  },
  series: [
   {
    name: 'pm2.5',
    type: 'scatter',
    coordinateSystem: 'geo',
    data: this.datamapvalue,
    symbolSize: function (val) {
     return val[2] / 10;
    },
    label: {
     normal: {
      formatter: '',
      position: 'right',
      show: false
     },
     emphasis: {
      show: true
     }
    },
    itemStyle: {
     normal: {
      color: '#ddb926'
     }
    }
   },
   {
    name: 'Top 5',
    type: 'effectScatter',
    coordinateSystem: 'geo',
    data: this.datamapvalue,
    symbolSize: function (val) {
     return val[2] / 10;
    },
    showEffectOn: 'render',
    rippleEffect: {
     brushType: 'stroke'
    },
    hoverAnimation: true,
    label: {
     normal: {
      formatter: '',
      position: 'right',
      show: true
     }
    },
    itemStyle: {
     normal: {
      color: '#f4e925',
      shadowBlur: 10,
      shadowColor: '#333'
     }
    },
    zlevel: 1
   }
  ]
 }

}

echarts.component.html

<div echarts [options] = "chartOption" [loading]="showloading" class="demo-chart"></div>
  <div echarts [options] = "Baroptions" [loading]="showloading" class="demo-chart"></div>
  <div echarts [options] = "linkoption" [loading]="showloading" class="demo-chart"></div>
  <div echarts [options] = "mapoption" [loading]="showloading" class="demo-chart"></div>

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

相關(guān)文章

  • AngularJS刪除路由中的#符號(hào)的方法

    AngularJS刪除路由中的#符號(hào)的方法

    這篇文章主要介紹了AngularJS刪除路由中的#符號(hào)的方法的相關(guān)資料,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下
    2016-09-09
  • 詳解AngularJS 模塊化

    詳解AngularJS 模塊化

    本篇文章主要介紹了詳解AngularJS 模塊化,模塊用于單獨(dú)的邏輯表示服務(wù),控制器,應(yīng)用程序等,并保持代碼的整潔。有興趣的可以了解一下
    2017-06-06
  • Angular4實(shí)現(xiàn)圖片上傳預(yù)覽路徑不安全的問(wèn)題解決

    Angular4實(shí)現(xiàn)圖片上傳預(yù)覽路徑不安全的問(wèn)題解決

    這篇文章主要給大家介紹了關(guān)于Angular4實(shí)現(xiàn)圖片上傳預(yù)覽路徑不安全問(wèn)題的解決方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧。
    2017-12-12
  • Angular?Tree?Shaking優(yōu)化機(jī)制原理詳解

    Angular?Tree?Shaking優(yōu)化機(jī)制原理詳解

    這篇文章主要為大家介紹了Angular?Tree?Shaking優(yōu)化機(jī)制原理詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-10-10
  • AngularJs bootstrap搭載前臺(tái)框架——基礎(chǔ)頁(yè)面

    AngularJs bootstrap搭載前臺(tái)框架——基礎(chǔ)頁(yè)面

    本文主要介紹AngularJs bootstrap搭載前臺(tái)框架基礎(chǔ)頁(yè)面的建設(shè),這里整理餓了相關(guān)資料及實(shí)現(xiàn)實(shí)例代碼,有興趣的小伙伴可以參考下
    2016-09-09
  • AngularJS 文件上傳控件 ng-file-upload詳解

    AngularJS 文件上傳控件 ng-file-upload詳解

    這篇文章主要介紹了AngularJS 文件上傳控件 ng-file-upload詳解,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-01-01
  • Angular5升級(jí)RxJS到5.5.3報(bào)錯(cuò):EmptyError: no elements in sequence的解決方法

    Angular5升級(jí)RxJS到5.5.3報(bào)錯(cuò):EmptyError: no elements in sequence的解

    這篇文章主要給大家介紹了關(guān)于Angular5升級(jí)RxJS到5.5.3報(bào)錯(cuò):EmptyError: no elements in sequence的解決方法,文中介紹了兩個(gè)解決方法,大家可以選擇使用,需要的朋友可以參考借鑒,下面來(lái)一起看看吧。
    2018-04-04
  • Angular.js前臺(tái)傳list數(shù)組由后臺(tái)spring MVC接收數(shù)組示例代碼

    Angular.js前臺(tái)傳list數(shù)組由后臺(tái)spring MVC接收數(shù)組示例代碼

    這篇文章主要給大家介紹了關(guān)于Angular.js前臺(tái)傳list數(shù)組之后,由后臺(tái)spring MVC接收數(shù)組的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面跟著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧。
    2017-07-07
  • AngularJS實(shí)現(xiàn)圖片上傳和預(yù)覽功能的方法分析

    AngularJS實(shí)現(xiàn)圖片上傳和預(yù)覽功能的方法分析

    這篇文章主要介紹了AngularJS實(shí)現(xiàn)圖片上傳和預(yù)覽功能的方法,結(jié)合HTML5實(shí)例形式對(duì)比分析了AngularJS圖片上傳的相關(guān)操作技巧與注意事項(xiàng),需要的朋友可以參考下
    2017-11-11
  • Angular組件庫(kù)ng-zorro-antd實(shí)現(xiàn)radio單選框選擇

    Angular組件庫(kù)ng-zorro-antd實(shí)現(xiàn)radio單選框選擇

    這篇文章主要為大家介紹了Angular組件庫(kù)ng-zorro-antd實(shí)現(xiàn)radio單選框取消選擇實(shí)現(xiàn)問(wèn)題解決,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-05-05

最新評(píng)論

洛宁县| 阿坝| 定西市| 苍溪县| 绍兴县| 平遥县| 尖扎县| 宁城县| 墨脱县| 安阳县| 沿河| 棋牌| 安溪县| 广昌县| 屏山县| 云林县| 娱乐| 宝坻区| 灯塔市| 逊克县| 如皋市| 涟源市| 衡东县| 河南省| 大安市| 宿迁市| 尼玛县| 潼关县| 革吉县| 揭阳市| 桐柏县| 开化县| 赞皇县| 平果县| 嘉祥县| 蚌埠市| 油尖旺区| 五台县| 图木舒克市| 遵义市| 镇沅|