echarts-for-react icon indicating copy to clipboard operation
echarts-for-react copied to clipboard

Different options for data on the geo map (multi series)

Open InFuz opened this issue 2 years ago • 0 comments

I have a geo map as below. I want to be able to set different options like zlevel or silent for all data in series.data but I didn't find that option. There is no such option for series.data , I tried to use the series array with each individual object for each data item but in this case I get empty values in data for some reason.

Works but it is not possible to set level or silent for each data item.

         series: [
            {
              ...scaleOpt,
              name: currentData?.name,
              type: "map",
              map: activeMapId,
              ...otherOptions,
              data: currentData?.jsonData.features.map(
                ({ properties }: Feature) => ({
                  id: properties?.id,
                  name: districtId
                    ? getRegionCenterById(properties?.id)
                    : properties?.name,
                  value: Math.round(vdlValues[properties?.id] ?? NaN) || "-",
                  selected: selectedSubjectId === properties?.id,
                  itemStyle:
                    selectedSubjectId === properties?.id
                      ? selectedAreaStyle
                      : {},
                })
              ),
            },
          ],

With this approach, for some unknown reason, the value in data is empty and is not displayed on the map.

          series: currentData?.jsonData?.features?.map(({ properties }) => ({
            ...scaleOpt,
            name: properties.name,
            type: "map",
            map: activeMapId,
            ...otherOptions,
            data: [
              {
                name: properties?.name,
                value: Math.round(vdlValues[properties?.id] ?? NaN) || "-",
                selected: selectedSubjectId === properties?.id,
                itemStyle:
                  selectedSubjectId === properties?.id ? selectedAreaStyle : {},
              },
            ],
          })),

InFuz avatar Mar 23 '22 14:03 InFuz