How to use the echarts.util function in echarts

To help you get started, we’ve selected a few echarts examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sakitam-fdd / ol3Echarts / packages / ol-echarts / src / utils / formatGeoJSON.ts View on Github external
export default function (json: any) {
  const geoJson = decode(json);
  // @ts-ignore
  const _features = echarts.util.map(
    // @ts-ignore
    echarts.util.filter(geoJson.features,
      (featureObj: { geometry: { coordinates: { length: number } }; properties: any }) =>
        // Output of mapshaper may have geometry null
         featureObj.geometry && featureObj.properties && featureObj.geometry.coordinates.length > 0),
    (featureObj: { properties: any; geometry: any }) => {
      const properties = featureObj.properties;
      const geo = featureObj.geometry;
      const coordinates = geo.coordinates;
      const geometries = [];
      if (geo.type === 'Polygon') {
        geometries.push(coordinates[0]);
      }
      if (geo.type === 'MultiPolygon') {
        // @ts-ignore
        echarts.util.each(coordinates, (item: any[]) => {
          if (item[0]) {
            geometries.push(item[0]);
github sakitam-fdd / ol3Echarts / packages / ol-echarts / src / utils / formatGeoJSON.ts View on Github external
(featureObj: { properties: any; geometry: any }) => {
      const properties = featureObj.properties;
      const geo = featureObj.geometry;
      const coordinates = geo.coordinates;
      const geometries = [];
      if (geo.type === 'Polygon') {
        geometries.push(coordinates[0]);
      }
      if (geo.type === 'MultiPolygon') {
        // @ts-ignore
        echarts.util.each(coordinates, (item: any[]) => {
          if (item[0]) {
            geometries.push(item[0]);
          }
        });
      }
      return {
        properties,
        type: 'Feature',
        geometry: {
          type: 'Polygon',
          coordinates: geometries,
        },
      };
    },
  );
github sakitam-fdd / ol3Echarts / website / pages / line.tsx View on Github external
},
      },
      tooltip: {
        trigger: 'axis',
      },
    };
    const inflationStartIdx = 14;
    const inflationYearCount = 6;
    const inflationYearStart = '2006';
    const xAxisCategory: any[] = [];
    for (let i = 0; i < inflationYearCount; i++) {
      xAxisCategory.push(`${+inflationYearStart + i}`);
    }

    // @ts-ignore
    echarts.util.each(rawData, (dataItem: any, idx: number | string) => {
      const coordinates = geoCoordMap[dataItem[0]];
      idx += '';

      const inflationData = [];
      for (let k = 0; k < inflationYearCount; k++) {
        inflationData.push(dataItem[inflationStartIdx + k]);
      }

      option.xAxis.push({
        id: idx,
        gridId: idx,
        type: 'category',
        name: dataItem[0],
        nameStyle: {
          color: '#ddd',
          fontSize: 12,
github kendricktan / ledger-analytics / src / components / charts / bar-chart.js View on Github external
align: {
          options: {
            left: 'left',
            center: 'center',
            right: 'right'
          }
        },
        verticalAlign: {
          options: {
            top: 'top',
            middle: 'middle',
            bottom: 'bottom'
          }
        },
        position: {
          options: echarts.util.reduce(posList, (map, pos) => {
            map[pos] = pos
            return map
          }, {})
        },
        distance: {
          min: 0,
          max: 100
        }
      },
      config: {
        rotate: 90,
        align: 'left',
        verticalAlign: 'middle',
        position: 'insideBottom',
        distance: 15
      }
github sakitam-fdd / ol3Echarts / dist / ol3Echarts.esm.js View on Github external
function formatGeoJSON (json) {
  var geoJson = decode(json);
  var _features = echarts.util.map(echarts.util.filter(geoJson.features, function (featureObj) {
    return featureObj.geometry && featureObj.properties && featureObj.geometry.coordinates.length > 0;
  }), function (featureObj) {
    var properties = featureObj.properties;
    var geo = featureObj.geometry;
    var coordinates = geo.coordinates;
    var geometries = [];
    if (geo.type === 'Polygon') {
      geometries.push(coordinates[0]);
    }
    if (geo.type === 'MultiPolygon') {
      echarts.util.each(coordinates, function (item) {
        if (item[0]) {
          geometries.push(item[0]);
        }
      });
    }
github sakitam-fdd / ol3Echarts / dist / ol3Echarts.esm.js View on Github external
}), function (featureObj) {
    var properties = featureObj.properties;
    var geo = featureObj.geometry;
    var coordinates = geo.coordinates;
    var geometries = [];
    if (geo.type === 'Polygon') {
      geometries.push(coordinates[0]);
    }
    if (geo.type === 'MultiPolygon') {
      echarts.util.each(coordinates, function (item) {
        if (item[0]) {
          geometries.push(item[0]);
        }
      });
    }
    return {
      'type': 'Feature',
      'geometry': {
        'type': 'Polygon',
        'coordinates': geometries
      },
      'properties': properties
    };
  });
  return {
github suweiteng / vue2-management-platform / src / views / index / echarts.vue View on Github external
function getPieSeries(scatterData, chart) {
          return echarts.util.map(scatterData, function (item, index) {
            var center = chart.convertToPixel('calendar', item);
            return {
              id: index + 'pie',
              type: 'pie',
              center: center,
              label: {
                normal: {
                  formatter: '{c}',
                  position: 'inside'
                }
              },
              radius: pieRadius,
              data: [
                {name: '工作', value: Math.round(Math.random() * 24)},
                {name: '娱乐', value: Math.round(Math.random() * 24)},
                {name: '睡觉', value: Math.round(Math.random() * 24)}
github sakitam-fdd / ol3Echarts / packages / ol3-echarts / src / coordinate / formatGeoJSON.js View on Github external
function (featureObj) {
      let properties = featureObj.properties;
      let geo = featureObj.geometry;
      let coordinates = geo.coordinates;
      let geometries = [];
      if (geo.type === 'Polygon') {
        geometries.push(coordinates[0]);
      }
      if (geo.type === 'MultiPolygon') {
        echarts.util.each(coordinates, function (item) {
          if (item[0]) {
            geometries.push(item[0]);
          }
        });
      }
      return {
        type: 'Feature',
        geometry: {
          type: 'Polygon',
          coordinates: geometries
        },
        properties: properties
      };
    }
  );
github vipshop / Saturn / saturn-console-web / src / components / common / charts / relate.vue View on Github external
graphic: echarts.util.map(this.option.series[0].data, (item, dataIndex) => {
          const tmpPos = this.myChart.convertToPixel({ seriesIndex: 0 }, [item.x, item.y]);
          return {
            type: 'circle',
            id: dataIndex,
            position: tmpPos,
            shape: {
              cx: 0,
              cy: 0,
              r: 20,
            },
            invisible: true,
            draggable: true,
            ondrag: echarts.util.curry(this.onPointDragging(), dataIndex),
            z: 100,
          };
        }),
      });