echart 프로필동력 노드 자바 대학 정리
                                            
 22324 단어  echart
                    
다음은 ECharts 의 다운로드 링크 입 니 다.주의해 야 할 것 은 ECharts 내부 도 다른 플러그 인 에 의존 하 는 ZRender 라 고 합 니 다.물론 대부분의 도표 에 있어 ZRender 가 필요 하지 않 지만 지도 컨트롤 과 다른 복잡 한 표현 컨트롤 에 있어 ZRender 가 필요 합 니 다.원 하지 않 는 문제 가 발생 하지 않도록 ECharts 를 다운로드 할 때 ZRender 도 다운로드 하 는 것 을 권장 합 니 다.
ECharts 다운로드 주소: http://echarts.baidu.com/
ZRender 다운로드 주소:http://ecomfe.github.io/zrender/index.html
다운로드 후 각자 의 파일 디 렉 터 리 압축 풀기 구 조 는 다음 과 같 습 니 다.
ECharts:
 
      ZRender:
 
 2. 플러그 인의 인용
우선,웹 프로그램 을 새로 만 든 다음 에 방금 다운로드 한 파일 을 추가 합 니 다.구체 적 인 디 렉 터 리 구 조 는 다음 과 같 습 니 다.
 
 여기에 다음 과 같은 몇 가지 설명 이 필요 하 다.
 
 2)다른 부분 은 zrender 라 는 폴 더 입 니 다.이 폴 더 의 이름 은 zrender 여야 합 니 다.echarts 의 js 파일 에서 zrender 에 대한 인용 은 모두 zrender 를 루트 디 렉 터 리 로 하기 때 문 입 니 다.zrender 폴 더 의 내용 은 1.zrender 파일 디 렉 터 리 에 있 는 src 폴 더 의 내용 입 니 다.다음 과 같 습 니 다.
 
 3. 페이지 에서 의 구체 적 인 사용
위의 절차 에 따라 설정 한 후에 우 리 는 페이지 에서 인용 할 수 있 습 니 다.여 기 는 지도 컨트롤 의 사용 방식 을 보 여 주 는 것 입 니 다.왜냐하면 지도의 인용 은 다른 기본 도형 의 인용 과 다 르 기 때 문 입 니 다.다른 도형 의 표현 도 간단 한 프레젠테이션 을 할 것 이다.
MapChart
우선 2 의 echarts 폴 더 와 같은 디 렉 터 리(즉,Modules 폴 더)에 aspx 페이지 나 html 페이지 를 추가 합 니 다.주의해 야 할 것 은 aspx 페이지 에서 echarts 를 사용 할 때 렌 더 링 할 div 를 form 태그 밖 에 두 어야 합 니 다.그렇지 않 으 면 도형 이 표시 되 지 않 습 니 다.
헤드 탭 에 echarts 에 대한 인용 을 다음 과 같이 추가 합 니 다.
<head runat="server"> 
  <title></title> 
  <script src="echarts/esl.js" type="text/javascript"></script> 
</head> 
<body> 
 
<div id="main"style="height:500px;border:1px solid #ccc;padding:10px;"></div> 
 
…………… 
 
…………… 
 
</body> 
 <script type="text/javascript"> 
 
    //        echarts   ,       map     ,      map        ,               。 
        echarts     echarts-map  ,             echarts     echarts  。 
 
    require.config({ 
 
      paths: { 
 
        echarts:'./echarts/echarts', 
 
        'echarts/chart/map':'./echarts/echarts-map' 
 
      } 
 
    }); 
 
   //    echarts,        ,                  
 
    require( 
 
    [ 
 
      'echarts', 
 
      'echarts/chart/map' 
 
    ], 
 
    function (ec) { 
 
      varmyChart=ecinit(documentgetElementById('main')); 
 
      //option          ,          ,                     
 
option= { 
 
        title: { 
 
          text:'iphone  ', 
 
          subtext:'    ', 
 
          x:'center' 
 
        }, 
 
        tooltip: { 
 
          trigger:'item' 
 
        }, 
 
        legend: { 
 
          orient:'vertical', 
 
          x:'left', 
 
          data: ['iphone3','iphone4','iphone5'] 
 
        }, 
 
        dataRange: { 
 
          min:0, 
 
          max:2500, 
 
          text: [' ',' '],      
 
          calculable:true, 
 
          textStyle: { 
 
            color:'orange' 
 
          } 
 
        }, 
 
        toolbox: { 
 
          show:true, 
 
          orient:'vertical', 
 
          x:'right', 
 
          y:'center', 
 
          feature: { 
 
            mark:true, 
 
            dataView: { readOnly:false }, 
 
            restore:true, 
 
            saveAsImage:true 
 
          } 
 
        }, 
 
        series: [ 
 
    { 
 
      name:'iphone3', 
 
      type:'map', 
 
      mapType:'china', 
 
      selectedMode: 'single', 
 
      itemStyle: { 
 
        normal: { label: { show:true },color:'#ffd700' },// for legend 
 
        emphasis: { label: { show:true} } 
 
      }, 
 
      data: [ 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'   ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'   ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) } 
 
      ] 
 
    }, 
 
    { 
 
      name:'iphone4', 
 
      type:'map', 
 
      mapType:'china', 
 
      selectedMode: 'single', 
 
      itemStyle: { 
 
        normal: { label: { show:true },color:'#ff8c00' },// for legend 
 
        emphasis: { label: { show:true} } 
 
      }, 
 
      data: [ 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'   ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
        { name:'  ',value:Math.round(Math.random() *1000) } 
 
      ] 
 
    }, 
 
    { 
 
      name:'iphone5', 
 
      type:'map', 
 
      mapType:'china', 
 
      selectedMode: 'single', 
 
      itemStyle: { 
 
        normal: { label: { show:true },color:'#da70d6' },// for legend 
 
        emphasis: { label: { show:true} } 
 
      }, 
 
      data: [ 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) }, 
 
        { name:'  ',value:Math.round(Math.random() *1000) } 
 
      ] 
 
    } 
  ] 
      }; 
       //                   ,             ,            ,            。 
       //        ,                   ,    series          selectedMode  ,        'single'   ,     
  varecConfig= require('echarts/config'); 
      myChart.on(ecConfig.EVENT.MAP_SELECTED,function (param) { 
        varselected=param.selected; 
        varmapSeries=option.series[0]; 
        vardata= []; 
        varlegendData= []; 
        varname; 
        for (varp=0,len=mapSeries.data.length; p<len; p++) { 
          name=mapSeries.data[p].name; 
          mapSeries.data[p].selected=selected[name]; 
          if (selected[name]) { 
            alert(name); //              ,        ,        ,               
 
          } 
        } 
      });         
      myChart.setOption(option); 
    } 
  ); 
  </script> 
 
  LineChart
지도 도 표를 제외 한 다른 아이콘 의 사용 방식 은 많 지 않다.사실 다른 도표 와 지도 도표 의 차 이 는 설정 파일 에 대한 인용 에 있다.여 기 는 접 는 선 그림 의 예 만 들 고 다른 예 는 모두 같다.
<scripttype="text/javascript"> 
 
    require.config({ 
 
      paths: { 
 
        echarts:'./echarts/echarts', 
 
        'echarts/chart/bar':'./echarts/echarts',//          mapchart        echarts-map  , 
              echarts,               
 
        'echarts/chart/line':'./echarts/echarts' 
 
      } 
 
    }); 
 
    require( 
 
    [ 
 
      'echarts', 
 
      'echarts/chart/bar', 
 
      'echarts/chart/line' 
 
    ], 
 
    function (ec) { 
 
      varmyChart=ecinit(documentgetElementById('main')); 
 
      option= { 
 
        tooltip: { 
 
          trigger:'axis' 
 
        }, 
 
        legend: { 
 
          data: ['    ','    ','    ','   ','    '] 
 
        }, 
 
        toolbox: { 
 
          show:true, 
 
          feature: { 
 
            mark:true, 
 
            dataView: { readOnly:false }, 
 
            magicType: ['line','bar'], 
 
            restore:true, 
 
            saveAsImage:true 
 
          } 
 
        }, 
 
        calculable:true, 
 
        xAxis: [ 
 
    { 
 
      type:'category', 
 
      boundaryGap:false, 
 
      data: ['  ','  ','  ','  ','  ','  ','  '] 
 
    } 
 
  ], 
 
        yAxis: [ 
 
    { 
 
      type:'value', 
 
      splitArea: { show:true } 
 
    } 
 
  ], 
 
        series: [ 
 
    { 
 
      name:'    ', 
 
      type:'line', 
 
      stack:'  ', 
 
      data: [120,132,101,134,90,230,210] 
 
    }, 
 
    { 
 
      name:'    ', 
 
      type:'line', 
 
      stack:'  ', 
 
      data: [220,182,191,234,290,330,310] 
 
    }, 
 
    { 
 
      name:'    ', 
 
      type:'line', 
 
      stack:'  ', 
 
      data: [150,232,201,154,190,330,410] 
 
    }, 
 
    { 
 
      name:'    ', 
 
      type:'line', 
 
      stack:'  ', 
 
      data: [320,332,301,334,390,330,320] 
 
    }, 
 
    { 
 
      name:'    ', 
 
      type:'line', 
 
      stack:'  ', 
 
      data: [820,932,901,934,1290,1330,1320] 
 
    } 
 
  ] 
 
      };           
 
  
 
      myChart.setOption(option); 
 
    } 
 
  ); 
 
  </script> 
 
  
 
  
 
  <divid="main1"style="height:500px;border:1px solid #ccc;padding:10px;"></div>   
 
  <scripttype="text/javascript"> 
 
    require.config({ 
 
      paths: { 
 
        echarts:'./echarts/echarts', 
 
        'echarts/chart/bar':'./echarts/echarts', 
 
        'echarts/chart/line':'./echarts/echarts' 
 
      } 
 
    }); 
 
    require( 
 
    [ 
 
      'echarts', 
 
      'echarts/chart/bar', 
 
      'echarts/chart/line' 
 
    ], 
 
    function (ec) { 
 
      varmyChart=ecinit(documentgetElementById('main1')); 
 
      option= { 
 
        title: { 
 
          text:'        ', 
 
          subtext:'    ' 
 
        }, 
 
        tooltip: { 
 
          trigger:'axis' 
 
        }, 
 
        legend: { 
 
          data: ['    '    '] 
 
        }, 
 
        toolbox: { 
 
          show:true, 
 
          feature: { 
 
            mark:true, 
 
            dataView: { readOnly:false }, 
 
            magicType: ['line','bar'], 
 
            restore:true, 
 
            saveAsImage:true 
 
          } 
 
        }, 
 
        calculable:true, 
 
        xAxis: [ 
 
    { 
 
      type:'category', 
 
      boundaryGap:false, 
 
      data: ['  ','  ','  ','  ','  ','  ','  '] 
 
    } 
 
  ], 
 
        yAxis: [ 
 
    { 
 
      type:'value', 
 
      axisLabel: { 
 
        formatter:'{value} ' 
 
      }, 
 
      splitArea: { show:true } 
 
    } 
 
  ], 
 
        series: [ 
 
    { 
 
      name:'    ', 
 
      type:'line', 
 
      itemStyle: { 
 
        normal: { 
 
          lineStyle: { 
 
            shadowColor:'rgba(0,0,0,4)' 
 
          } 
 
        } 
 
      }, 
 
      data: [11,11,15,13,12,13,10] 
 
    }, 
 
    { 
 
      name:'    ', 
 
      type:'line', 
 
      itemStyle: { 
 
        normal: { 
 
          lineStyle: { 
 
            shadowColor:'rgba(0,0,0,4)' 
 
          } 
 
        } 
 
      }, 
 
      data: [-2,1,2,5,3,2,0] 
 
    } 
 
  ] 
 
      };           
 
      myChart.setOption(option); 
 
    } 
 
  ); 
 
  </script> 
 
  
 
  
 
  <divid="main2"style="height:500px;border:1px solid #ccc;padding:10px;"></div>   
 
  <scripttype="text/javascript"> 
 
    require.config({ 
 
      paths: { 
 
        echarts:'./echarts/echarts', 
 
        'echarts/chart/bar':'./echarts/echarts', 
 
        'echarts/chart/line':'./echarts/echarts' 
 
      } 
 
    }); 
 
    require( 
 
    [ 
 
      'echarts', 
 
      'echarts/chart/bar', 
 
      'echarts/chart/line' 
 
    ], 
 
    function (ec) { 
 
      varmyChart=ec.init(document.getElementById('main2')); 
 
      option= { 
 
        title: { 
 
          text:'       ', 
 
          subtext:'    ' 
 
        }, 
 
        tooltip: { 
 
          trigger:'axis' 
 
        }, 
 
        legend: { 
 
          data: ['  ','  ','  '] 
 
        }, 
 
        toolbox: { 
 
          show:true, 
 
          feature: { 
 
            mark:true, 
 
            dataView: { readOnly:false }, 
 
            magicType: ['line','bar'], 
 
            restore:true, 
 
            saveAsImage:true 
 
          } 
 
        }, 
 
        calculable:true, 
 
        xAxis: [ 
 
    { 
 
      type:'category', 
 
      boundaryGap:false, 
 
      data: [' ','  ','  ','  ','  ','  ','  '] 
 
    } 
 
  ], 
 
        yAxis: [ 
 
    { 
 
      type:'value' 
 
    } 
 
  ], 
 
        series: [ 
 
    { 
 
      name:'  ', 
 
      type:'line', 
 
      smooth:true, 
 
      itemStyle: { normal: { areaStyle: { type:'default'}} }, 
 
      data: [10,12,21,54,260,830,710] 
 
    }, 
 
    { 
 
      name:'  ', 
 
      type:'line', 
 
      smooth:true, 
 
      itemStyle: { normal: { areaStyle: { type:'default'}} }, 
 
      data: [30,182,434,791,390,30,10] 
 
    }, 
 
    { 
 
      name:'  ', 
 
      type:'line', 
 
      smooth:true, 
 
      itemStyle: { normal: { areaStyle: { type:'default'}} }, 
 
      data: [1320,1132,601,234,120,90,20] 
 
    } 
 
  ] 
 
      };           
 
      myChart.setOption(option); 
 
    } 
 
  ); 
 
  </script> 
 
                이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Vue는 echart가 element의 tab 전환 시 부정확한 문제를 해결합니다최근 프로젝트에서 이러한 상황을 만났습니다.tab 컨트롤에 여러 개의 echart 아이콘을 렌더링한 다음 보기를 전환할 때 도표의 폭이 정확하지 않은 것을 발견합니다 원인: 페이지를 불러올 때 숨겨진 도표가 대응하는...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.