欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

angular4中如何引入echarts

這篇文章將為大家詳細(xì)講解有關(guān)angular4中如何引入echarts,小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。

創(chuàng)新互聯(lián)是一家集網(wǎng)站建設(shè),華亭企業(yè)網(wǎng)站建設(shè),華亭品牌網(wǎng)站建設(shè),網(wǎng)站定制,華亭網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營(yíng)銷,網(wǎng)絡(luò)優(yōu)化,華亭網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競(jìng)爭(zhēng)力。可充分滿足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶成長(zhǎng)自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。

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)盟廣告', '視頻廣告', '直接訪問', '搜索引擎']
    },
    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: '直接訪問',
        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} <br/>{b}: {c} (easwika%)"
    },
    legend: {
      orient: 'vertical',
      x: 'left',
      data: ['直達(dá)', '營(yíng)銷廣告', '搜索引擎', '郵件營(yíng)銷', '聯(lián)盟廣告', '視頻廣告', '百度', '谷歌', '必應(yīng)', '其他']
    },
    series: [
      {
        name: '訪問來(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: '訪問來(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: '懶貓今日訪問量'
    },
    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: "懶貓今日訪問量",
      type: 'value'
    }],
    series: [{
      name: '今日訪問次數(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: '{b}',
            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: '{b}',
            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>

關(guān)于angular4中如何引入echarts就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到。

網(wǎng)頁(yè)標(biāo)題:angular4中如何引入echarts
文章路徑:http://chinadenli.net/article40/jijoho.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計(jì)網(wǎng)站內(nèi)鏈外貿(mào)建站微信公眾號(hào)服務(wù)器托管網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都網(wǎng)頁(yè)設(shè)計(jì)公司