Skip to content

Latest commit

Β 

History

History
895 lines (807 loc) Β· 20.8 KB

chart-nestedPie.md

File metadata and controls

895 lines (807 loc) Β· 20.8 KB

NestedPie 차트

μ°¨νŠΈλ³„λ‘œ μ‚¬μš©ν•  수 μžˆλŠ” APIλŠ” 이 κ°€μ΄λ“œμ—μ„œ 닀루지 μ•ŠλŠ”λ‹€. μ‚¬μš© κ°€λŠ₯ν•œ APIκ°€ κΆκΈˆν•˜λ‹€λ©΄ API κ°€μ΄λ“œλ₯Ό μ°Έκ³ ν•˜μž.

차트 μƒμ„±ν•˜κΈ°

NestedPie 차트의 생성 방법은 두 가지가 μžˆλ‹€. μƒμ„±μž ν•¨μˆ˜μ™€ 정적 ν•¨μˆ˜λ₯Ό 톡해 생성할 수 μžˆλ‹€. κ²°κ³ΌλŠ” λͺ¨λ‘ 차트의 μΈμŠ€ν„΄μŠ€κ°€ λ°˜ν™˜λœλ‹€. 맀개 λ³€μˆ˜λŠ” μ°¨νŠΈκ°€ κ·Έλ €μ§€λŠ” μ˜μ—­μΈ HTML μš”μ†Œ el, 데이터값인 data, μ˜΅μ…˜κ°’ optionsκ°€ 객체둜 λ“€μ–΄κ°„λ‹€. el 값은 차트의 μ»¨ν…Œμ΄λ„ˆ μ˜μ—­μ΄λ―€λ‘œ 차트 외에 λ‹€λ₯Έ μš”μ†Œλ“€μ΄ ν¬ν•¨λ˜μ–΄ 있으면 μ°¨νŠΈμ— 영ν–₯을 쀄 수 있음으둜 λΉ„μ–΄μžˆλŠ” HTML μš”μ†Œλ₯Ό μ‚¬μš©ν•˜λŠ” 것을 ꢌμž₯ν•œλ‹€.

import { NestedPieChart } from '@toast-ui/chart';

const chart = new NestedPieChart({el, data, options});

// ν˜Ήμ€

import Chart from '@toast-ui/chart';

const chart = Chart.nestedPieChart({el, data, options});

기본 차트

데이터 νƒ€μž…

λ°μ΄ν„°λŠ” series λ₯Ό 톡해 μž…λ ₯λ°›λŠ”λ‹€. μ€‘μ²©λœ 파이 μ°¨νŠΈλŠ” 별칭이 λ˜λŠ” name값을 μž…λ ₯λ°›κ³ , data에 μ„Ήν„°λ₯Ό ν‘œν˜„ν•  수 μžˆλŠ” 데이터λ₯Ό name, data 쌍으둜 μž…λ ₯λ°›λŠ”λ‹€. μž…λ ₯ν•œ λͺ¨λ“  data 값이 범둀에 ν‘œμ‹œλœλ‹€.

const data = {
  series: [
    {
      name: 'browsers',
      data: [
        {
          name: 'Chrome',
          data: 50,
        },
        {
          name: 'Safari',
          data: 20,
        },
        {
          name: 'IE',
          data: 10,
        },
        {
          name: 'Firefox',
          data: 10,
        },
        {
          name: 'Opera',
          data: 3,
        },
        {
          name: 'Etc',
          data: 7,
        },
      ],
    },
    {
      name: 'versions',
      data: [
        {
          name: 'Chrome 64',
          data: 40,
        },
        {
          name: 'Chrome 63',
          data: 10,
        },
        {
          name: 'Safari 13',
          data: 15,
        },
        {
          name: 'Safari 12',
          data: 5,
        },
        {
          name: 'IE 11',
          data: 4,
        },
        {
          name: 'IE 10',
          data: 3,
        },
        {
          name: 'IE 9',
          data: 2,
        },
        {
          name: 'IE 8',
          data: 1,
        },
        {
          name: 'Firefox 13',
          data: 8,
        },
        {
          name: 'Firefox 12',
          data: 2,
        },
        {
          name: 'Opera 15',
          data: 2,
        },
        {
          name: 'Opera 12',
          data: 1,
        },
        {
          name: 'Etc - 2020',
          data: 7,
        },
      ],
    },
  ]
}

image

κ·Έλ£Ή 데이터

parentName을 μ§€μ •ν•˜λ©΄ λ°μ΄ν„°μ˜ λΆ€λͺ¨ μ‹œλ¦¬μ¦ˆλ₯Ό μ„€μ •ν•΄μ£Όμ–΄ κ·Έλ£Ή λ°μ΄ν„°λ‘œ ν‘œν˜„ν•œλ‹€. κ·Έλ£Ή λ°μ΄ν„°λŠ” μ‹œλ¦¬μ¦ˆμ˜ 색깔이 κ°™μœΌλ©° 투λͺ…λ„λ‘œ κ΅¬λΆ„λœλ‹€. series의 첫번째 μΈλ±μŠ€μ— μžˆλŠ” data κ°’λ§Œ λ²”λ‘€λ‘œ ν‘œμ‹œν•œλ‹€.

const data = {
  categories: ['A', 'B'],
  series: [
    {
      name: 'browsers',
      data: [
        {
          name: 'Chrome',
          data: 50,
        },
        {
          name: 'Safari',
          data: 20,
        },
        {
          name: 'IE',
          data: 10,
        },
        {
          name: 'Firefox',
          data: 10,
        },
        {
          name: 'Opera',
          data: 3,
        },
        {
          name: 'Etc',
          data: 7,
        },
      ],
    },
    {
      name: 'versions',
      data: [
        {
          name: 'Chrome 64',
          parentName: 'Chrome',
          data: 40,
        },
        {
          name: 'Chrome 63',
          parentName: 'Chrome',
          data: 10,
        },
        {
          name: 'Safari 13',
          parentName: 'Safari',
          data: 15,
        },
        {
          name: 'Safari 12',
          parentName: 'Safari',
          data: 5,
        },
        {
          name: 'IE 11',
          parentName: 'IE',
          data: 4,
        },
        {
          name: 'IE 10',
          parentName: 'IE',
          data: 3,
        },
        {
          name: 'IE 9',
          parentName: 'IE',
          data: 2,
        },
        {
          name: 'IE 8',
          parentName: 'IE',
          data: 1,
        },
        {
          name: 'Firefox 13',
          parentName: 'Firefox',
          data: 8,
        },
        {
          name: 'Firefox 12',
          parentName: 'Firefox',
          data: 2,
        },
        {
          name: 'Opera 15',
          parentName: 'Opera',
          data: 2,
        },
        {
          name: 'Opera 12',
          parentName: 'Opera',
          data: 1,
        },
        {
          name: 'Etc 1',
          parentName: 'Etc',
          data: 3,
        },
        {
          name: 'Etc 2',
          parentName: 'Etc',
          data: 2,
        },
        {
          name: 'Etc 3',
          parentName: 'Etc',
          data: 1,
        },
        {
          name: 'Etc 4',
          parentName: 'Etc',
          data: 1,
        },
      ],
    },
  ],
};

image

visible μ˜΅μ…˜

각각의 seriesλŠ” visible μ˜΅μ…˜μ„ κ°€μ§ˆ 수 μžˆλ‹€. visible μ˜΅μ…˜μ€ 처음 μ°¨νŠΈκ°€ κ·Έλ €μ‘Œμ„ λ•Œ μ‹œλ¦¬μ¦ˆλ₯Ό λ‚˜νƒ€λ‚Όμ§€μ— λŒ€ν•œ μ—¬λΆ€λ₯Ό κ²°μ •ν•œλ‹€. 기본값은 true이닀. κΈ°λ³Έ μ°¨νŠΈμ™€ κ·Έλ£Ή 데이터 차트의 μ‚¬μš©λ²•μ€ λ™μΌν•˜λ‹€.

const data = {
  series: [
    {
      name: 'browsers',
      data: [
        {
          name: 'Chrome',
          data: 50,
          visible: false,
        },
        {
          name: 'Safari',
          data: 20,
        },
        {
          name: 'IE',
          data: 10,
        },
        {
          name: 'Firefox',
          data: 10,
          visible: false,
        },
        {
          name: 'Opera',
          data: 3,
        },
        {
          name: 'Etc',
          data: 7,
        },
      ],
    },
    {
      name: 'versions',
      data: [
        {
          name: 'Chrome 64',
          data: 40,
        },
        {
          name: 'Chrome 63',
          data: 10,
        },
        {
          name: 'Safari 13',
          data: 15,
        },
        {
          name: 'Safari 12',
          data: 5,
        },
        {
          name: 'IE 11',
          data: 4,
        },
        {
          name: 'IE 10',
          data: 3,
        },
        {
          name: 'IE 9',
          data: 2,
        },
        {
          name: 'IE 8',
          data: 1,
        },
        {
          name: 'Firefox 13',
          data: 8,
        },
        {
          name: 'Firefox 12',
          data: 2,
        },
        {
          name: 'Opera 15',
          data: 2,
        },
        {
          name: 'Opera 12',
          data: 1,
        },
        {
          name: 'Etc - 2020',
          data: 7,
        },
      ],
    },
  ]
}

μœ„ μ˜΅μ…˜μ„ μ μš©ν•΄ 차트λ₯Ό 생성해보면 μ²΄ν¬λ°•μŠ€κ°€ ν•΄μ œλ˜μ–΄ μƒμ„±λ˜λŠ” 것을 확인할 수 μžˆμŠ΅λ‹ˆλ‹€.

image

μ˜΅μ…˜

optionsλŠ” 객체둜 μž‘μ„±ν•œλ‹€. series μ˜΅μ…˜μ€ 기본적으둜 Pie 차트의 μ‹œλ¦¬μ¦ˆ μ˜΅μ…˜κ³Ό κ°™κ³  radiusRangeλŠ” 각 μ‹œλ¦¬μ¦ˆμ˜ λ°˜μ§€λ¦„ λ²”μœ„λ₯Ό μ„€μ •ν•˜κΈ° μœ„ν•΄ [name] μ˜΅μ…˜μœΌλ‘œ μ΄λ™ν–ˆλ‹€. [name]은 μž…λ ₯받은 λ°μ΄ν„°μ—μ„œ series의 name이 이에 ν•΄λ‹Ήν•œλ‹€. μ€‘μ²©λœ λͺ¨λ“  μ‹œλ¦¬μ¦ˆμ— κ³΅ν†΅μœΌλ‘œ μ μš©ν•  μ˜΅μ…˜μ€ series에 λ°”λ‘œ μž‘μ„±ν•˜κ³ , 각 μ‹œλ¦¬μ¦ˆλ³„λ‘œ μ μš©ν•  μ˜΅μ…˜μ€ [name]에 μž‘μ„±ν•œλ‹€.

type options = {
  chart?: {
    //...
  }
  legend?: {
    //...
  }
  exportMenu?: {
    //...
  }
  tooltip?: {
    //...
  }
  responsive?: {
    //...
  }
  theme?: {
    // μ•„λž˜ ν…Œλ§ˆ μ±•ν„°μ—μ„œ μ„€λͺ…
  }
  series?: {
    selectable?: boolean;
    clockwise?: boolean;
    angleRange?: {
      start?: number;
      end?: number;
    };
    dataLabels?: {
      visible?: boolean;
      anchor?: DataLabelAnchor;
      offsetX?: number;
      offsetY?: number;
      formatter?: (value) => string;
      pieSeriesName?: {
        visible: boolean;
        anchor?: 'center' | 'outer';
      };
    };
    [name]: {
      selectable?: boolean;
      clockwise?: boolean;
      angleRange?: {
        start?: number;
        end?: number;
      };
      radiusRange?: {
        inner?: number | string;
        outer?: number | string;
      };
      dataLabels?: {
        visible?: boolean;
        anchor?: DataLabelAnchor;
        offsetX?: number;
        offsetY?: number;
        formatter?: (value) => string;;
        pieSeriesName?: {
          visible: boolean;
          anchor?: 'center' | 'outer';
        };
      };
    }
  }
}

이 μ°¨νŠΈμ—μ„œ μ‚¬μš©ν•  수 μžˆλŠ” 곡톡 μ˜΅μ…˜μ— λŒ€ν•΄μ„œλŠ” 이 κ°€μ΄λ“œμ—μ„œ 닀루지 μ•ŠλŠ”λ‹€. ν•„μš”ν•˜λ‹€λ©΄ ν•΄λ‹Ή μ˜΅μ…˜μ˜ κ°€μ΄λ“œλ₯Ό μ°Έκ³ ν•˜μž. (링크: chart μ˜΅μ…˜, λ²”λ‘€, 내보내기, 툴팁, responsive μ˜΅μ…˜ )

selectable

ν•΄λ‹Ή μ‹œλ¦¬μ¦ˆλ₯Ό 선택할 수 μžˆλ‹€.

  • κΈ°λ³Έκ°’: false
const options = {
  series: {
    selectable: true
  }
};

각 μ‹œλ¦¬μ¦ˆ name에 ν•΄λ‹Ήν•˜λŠ” μ˜΅μ…˜μ„ μ„€μ •ν•  수 μžˆλ‹€. μ•„λž˜μ™€ 같이 μž‘μ„±ν•˜λ©΄, 'browsers'에 ν•΄λ‹Ήν•˜λŠ” Pie μ°¨νŠΈλŠ” 선택할 수 있고, versions에 ν•΄λ‹Ήν•˜λŠ” Pie μ°¨νŠΈλŠ” 선택할 수 μ—†λ‹€.

const options = {
  series: {
    browsers: {
      selectable: true
    },
    versions: {
      selectable: false
    }
  }
};

image

κ·Έλ£Ή 데이터λ₯Ό μ„ νƒν•˜λ©΄ parentName으둜 μ—°κ²°λœ λͺ¨λ“  μ‹œλ¦¬μ¦ˆλ₯Ό μ„ νƒν•œλ‹€.

image

selectable μ˜΅μ…˜κ³Ό on API의 selectSeries, unselectSeriesλ₯Ό ν•¨κ»˜ μ‚¬μš©ν•  경우 ν•΄λ‹Ή μ‹œλ¦¬μ¦ˆμ— λŒ€ν•œ μ œμ–΄λ₯Ό μΆ”κ°€λ‘œ ν•  수 μžˆλ‹€.

clockwise

μ‹œλ¦¬μ¦ˆκ°€ κ·Έλ €μ§€λŠ” λ°©ν–₯을 μ„€μ •ν•œλ‹€. 기본적으둜 μ‹œκ³„ λ°©ν–₯으둜 그렀지고, false둜 μ„€μ •ν•˜λ©΄ μ‹œκ³„ λ°˜λŒ€ λ°©ν–₯으둜 그렀진닀.

  • κΈ°λ³Έκ°’: true
const options = {
  series: {
    clockwise: false
  }
};

image

각 μ‹œλ¦¬μ¦ˆ name에 ν•΄λ‹Ήν•˜λŠ” μ˜΅μ…˜μ„ μ„€μ •ν•  수 μžˆλ‹€. μ•„λž˜μ™€ 같이 μž‘μ„±ν•˜λ©΄, 'browsers'에 ν•΄λ‹Ήν•˜λŠ” Pie μ°¨νŠΈλŠ” μ‹œκ³„ λ°©ν–₯으둜 그렀지고, versions에 ν•΄λ‹Ήν•˜λŠ” Pie μ°¨νŠΈλŠ” μ‹œκ³„ λ°˜λŒ€ λ°©ν–₯으둜 그렀진닀.

const options = {
  series: {
    browsers: {
      clockwise: true
    },
    versions: {
      clockwise: false
    }
  }
};

image

radiusRange

radiusRangeλŠ” inner와 outer μ˜΅μ…˜μ„ μ§€μ •ν•˜μ—¬ μ•ˆμͺ½ μ›μ˜ λ°˜μ§€λ¦„κ³Ό λ°”κΉ₯μͺ½ μ›μ˜ λ°˜μ§€λ¦„μ„ μ„€μ •ν•œλ‹€. inner의 기본값은 0이닀. 0보닀 큰 값을 μž…λ ₯ν•˜λ©΄ 도넛 λͺ¨μ–‘μ˜ 차트λ₯Ό λ§Œλ“€ 수 μžˆλ‹€. 각 μ‹œλ¦¬μ¦ˆ name에 ν•΄λ‹Ήν•˜λŠ” μ˜΅μ…˜μ„ μ„€μ •ν•  수 μžˆλ‹€. λ§Œμ•½ series.radiusRangeλ₯Ό μ„€μ •ν•˜μ§€ μ•ŠλŠ”λ‹€λ©΄ 각 μ€‘μ²©λœ μ‹œλ¦¬μ¦ˆκ°€ κ· μΌν•œ λ°˜μ§€λ¦„μ„ 갖도둝 μ„€μ •λœλ‹€.

속성 μ„€λͺ…
radiusRange.inner μ•ˆμͺ½μ˜ λ°˜μ§€λ¦„ μ„€μ •
radiusRange.outer λ°”κΉ₯μͺ½μ˜ λ°˜μ§€λ¦„ μ„€μ •

값을 %λ₯Ό ν¬ν•¨ν•œ λ¬Έμžμ—΄ νƒ€μž…μœΌλ‘œ μž…λ ₯ν•˜λ©΄ λΉ„μœ¨λ‘œ κ³„μ‚°ν•œλ‹€.

const options = {
  series: {
    browsers: {
      radiusRange: {
        inner: '20%',
        outer: '50%'
      }
    },
    versions: {
      radiusRange: {
        inner: '55%',
        outer: '85%'
      }
    }
  }
};

image

값을 숫자 νƒ€μž…μœΌλ‘œ μž…λ ₯ν•˜λ©΄ λ°˜μ§€λ¦„μ€ μ ˆλŒ€κ°’μœΌλ‘œ κ³„μ‚°λœλ‹€.

const options = {
  series: {
    browsers: {
      radiusRange: {
        inner: 50,
        outer: 130
      },
    },
    versions: {
      radiusRange: {
        inner: 150,
        outer: 230
      }
    }
  }
};

image

angleRange

angleRangeλŠ” start와 end μ˜΅μ…˜μ„ μ‚¬μš©ν•˜μ—¬ 호의 λ²”μœ„λ₯Ό μ„€μ •ν•œλ‹€.

속성 μ„€λͺ…
angleRange.start 호의 μ‹œμž‘ 각도 (κΈ°λ³Έκ°’: 0)
angleRange.end 호의 끝 각도 (κΈ°λ³Έκ°’: 360)
const options = {
  series: {
    angleRange: {
      start: -90,
      end: 90
    }
  }
};

image

각 μ‹œλ¦¬μ¦ˆ name에 ν•΄λ‹Ήν•˜λŠ” μ˜΅μ…˜μ„ μ„€μ •ν•  수 μžˆλ‹€.

const options = {
  series: {
    browsers: {
      angleRange: {
        start: 0,
        end: 180
      }
    },
    versions: {
      angleRange: {
        start: 180,
        end: 360
      }
    }
  }
};

image

dataLabels

series.dataLabels μ˜΅μ…˜μ„ μ§€μ •ν•˜λ©΄ λͺ¨λ“  μ€‘μ²©λœ Pie μ°¨νŠΈμ—μ„œ 데이터 라벨이 ν‘œμ‹œν•  수 μžˆλ‹€.

const options = {
  ...
  series: {
    dataLabels: {
      visible: true;
    }
  }
};

image

series μ˜΅μ…˜μ— 각 κ³„μΈ΅λ³„λ‘œ Pie μ‹œλ¦¬μ¦ˆ μ˜΅μ…˜μ„ μ •μ˜ν•  수 있으며, 데이터 라벨 κ΄€λ ¨ μ˜΅μ…˜λ„ μ’€ 더 μ„Έλ°€ν•˜κ²Œ μ„€μ •ν•  수 μžˆλ‹€.

type options = {
  ...
  series?: {
    [name]: {
      ...
      dataLabels: {
        // Pie μ‹œλ¦¬μ¦ˆ  데이터 라벨 μ˜΅μ…˜
      };
    },
    ...
  };
};

μ•„λž˜ μ½”λ“œλŠ” μ•ˆμͺ½μ— μžˆλŠ” Pie μ‹œλ¦¬μ¦ˆ('browsers')μ—λŠ” 데이터 라벨만 ν‘œμ‹œν•˜κ³ , λ°”κΉ₯μͺ½μ— μžˆλŠ” Pie μ‹œλ¦¬μ¦ˆ('versions')μ—λŠ” μ‹œλ¦¬μ¦ˆ 이름 λΌλ²¨κΉŒμ§€ ν‘œμ‹œν•˜λ„λ‘ μ„€μ •ν•œ μ˜΅μ…˜μ΄λ‹€.

const options = {
  series: {
    browsers: {
      radiusRange: {
        inner: '20%',
        outer: '50%'
      },
      dataLabels: {
        visible: true,
        pieSeriesName: {
          visible: false
        }
      }
    },
    versions: {
      radiusRange: {
        inner: '55%',
        outer: '85%'
      },
      dataLabels: {
        visible: true,
        pieSeriesName: {
          visible: true,
          anchor: 'outer'
        }
      }
    }
  }
};

image

μ‹œλ¦¬μ¦ˆ theme

NestedPie μ°¨νŠΈμ—μ„œ 각 μ‹œλ¦¬μ¦ˆλ³„λ‘œ μˆ˜μ •ν•  수 μžˆλŠ” μ‹œλ¦¬μ¦ˆ ν…Œλ§ˆμ΄λ‹€. 각 Pie μ‹œλ¦¬μ¦ˆμ˜ 데이터 라벨 μŠ€νƒ€μΌμ„ 지정할 경우 series[name].dataLabelsλ₯Ό μ •μ˜ν•œλ‹€.

interface NestedPieChartSeriesTheme {
  colors?: string[];
  areaOpacity?: number;
  lineWidth?: number;
  strokeStyle?: string;
  hover?: {
    color?: string;
    lineWidth?: number;
    strokeStyle?: string;
    shadowColor?: string;
    shadowBlur?: number;
    shadowOffsetX?: number;
    shadowOffsetY?: number;
  };
  select?: {
    color?: string;
    lineWidth?: number;
    strokeStyle?: string;
    shadowColor?: string;
    shadowBlur?: number;
    shadowOffsetX?: number;
    shadowOffsetY?: number;
    restSeries?: {
      areaOpacity?: number;
    };
    areaOpacity?: number;
  };
  dataLabels?: CommonDataLabelBoxTheme & {
    pieSeriesName?: CommonDataLabelBoxTheme;
    callout?: {
      useSeriesColor?: boolean;
      lineWidth?: number;
      lineColor?: string;
    };
  };
}

type CommonDataLabelBoxTheme = {
  useSeriesColor?: boolean;
  lineWidth?: number;
  textStrokeColor?: string;
  shadowColor?: string;
  shadowBlur?: number;
  fontSize?: number;
  fontFamily?: string;
  fontWeight?: string | number;
  color?: string;
  textBubble?: {
    visible?: boolean;
    paddingX?: number;
    paddingY?: number;
    backgroundColor?: string;
    borderRadius?: number;
    borderColor?: string;
    borderWidth?: number;
    shadowColor?: string;
    shadowOffsetX?: number;
    shadowOffsetY?: number;
    shadowBlur?: number;
  };
};
이름 νƒ€μž… μ„€λͺ…
colors string[] μ‹œλ¦¬μ¦ˆμ˜ 색상
areaOpacity number λͺ¨λ“  μ‹œλ¦¬μ¦ˆκ°€ ν™œμ„± λ˜μ–΄ μžˆμ„ λ•Œμ˜ 전체 μ˜μ—­ 투λͺ…도
lineWidth number μ‹œλ¦¬μ¦ˆμ˜ ν…Œλ‘λ¦¬ μ„  λ„ˆλΉ„
strokeStyle string μ‹œλ¦¬μ¦ˆμ˜ ν…Œλ‘λ¦¬ μ„  색
hover object 데이터에 마우슀λ₯Ό μ˜¬λ Έμ„ λ•Œ μŠ€νƒ€μΌ
select object μ˜΅μ…˜ series.selectable: true둜 μ„€μ • λ˜μ–΄ μžˆμ„ λ•Œ μ‹œλ¦¬μ¦ˆκ°€ 선택 되면 μ μš©λ˜λŠ” μŠ€νƒ€μΌ
dataLabels object 데이터 라벨 μŠ€νƒ€μΌ. Pie 차트의 theme.dataLabels μ˜΅μ…˜κ³Ό κ°™λ‹€.

ν…Œλ§ˆλŠ” μ˜΅μ…˜μ—μ„œ theme μ˜΅μ…˜μ„ μ§€μ •ν•˜κ³  μ‹œλ¦¬μ¦ˆ ν…Œλ§ˆλŠ” theme.series둜 μ„€μ •ν•œλ‹€. κ°„λ‹¨ν•œ μ˜ˆμ‹œλ‘œ μ‹œλ¦¬μ¦ˆμ˜ μŠ€νƒ€μΌμ„ λ°”κΏ”λ³΄μž.

μ•„λž˜ μ½”λ“œλŠ” lineWidth, strokeStyle을 μ„€μ •ν•˜μ—¬ μ€‘μ²©λœ λͺ¨λ“  μ‹œλ¦¬μ¦ˆμ˜ μ„  λ‘κ»˜μ™€ 색깔을 λ³€κ²½ν•œ μ˜΅μ…˜μ΄λ‹€.

const options = {
  theme: {
    series: {
      colors: ['#eef4c4', '#77543f', '#b7c72e', '#5b9aa0', '#30076f', '#622569', '#f75294'],
      lineWidth: 5,
      strokeStyle: '#cccccc',
    }
  }
}

image

[name]에 ν•΄λ‹Ήν•˜λŠ” 각 μ‹œλ¦¬μ¦ˆλ³„λ‘œ μŠ€νƒ€μΌμ„ μ μš©ν•  수 μžˆλ‹€. μ•„λž˜ μ½”λ“œλŠ” μ‹œλ¦¬μ¦ˆ 색상, ν…Œλ‘λ¦¬ λ‘κ»˜, ν…Œλ‘λ¦¬ 색상과 마우슀λ₯Ό μ˜¬λ Έμ„ λ•Œ μŠ€νƒ€μΌμ„ λ³€κ²½ν•œ μ˜΅μ…˜μ΄λ‹€.

const options = {
  theme: {
    series: {
      browsers: {
        colors: ['#eef4c4', '#77543f', '#b7c72e', '#5b9aa0', '#30076f', '#622569'],
        lineWidth: 5,
        strokeStyle: '#0000ff',
        hover: {
          color: '#0000ff',
          lineWidth: 5,
          strokeStyle: '#000000',
          shadowColor: 'rgba(0, 0, 0, 0.5)',
          shadowBlur: 10
        },
      },
      versions: {
        colors: [
          '#cddbda',
          '#efd1d1',
          '#ea005e',
          '#fece2f',
          '#fc6104',
          '#dd2429',
          '#ebc7ff',
          '#fece2f',
          '#dd2429',
          '#ff8d3a',
          '#fc6104',
          '#5ac18e',
          '#8570ff'
        ],
        lineWidth: 2,
        strokeStyle: '#ff0000',
        hover: {
          color: '#ff0000',
          lineWidth: 2,
          strokeStyle: '#000000',
          shadowColor: 'rgba(0, 0, 0, 0.5)',
          shadowBlur: 10
        }
      }
    }
  }
};

image

[name]에 ν•΄λ‹Ήν•˜λŠ” 각 μ‹œλ¦¬μ¦ˆλ³„λ‘œ 라벨 μŠ€νƒ€μΌμ„ μ μš©ν•  수 μžˆλ‹€. μ•„λž˜ μ½”λ“œλŠ” κΈ€μž μŠ€νƒ€μΌκ³Ό 말풍선을 μ‚¬μš©ν•˜μ—¬ ν…Œλ§ˆλ₯Ό μ μš©ν•œ μ˜΅μ…˜μ΄λ‹€.

const options = {
  series: {
    browsers: {
      dataLabels: {
        visible: true
      }
    },
    versions: {
      dataLabels: {
        visible: true,
        pieSeriesName: { visible: true, anchor: 'outer' }
      }
    }
  },
  theme: {
    series: {
      browsers: {
        dataLabels: {
          fontFamily: 'fantasy',
          fontSize: 13,
          useSeriesColor: true,
          textBubble: {
            visible: true,
            backgroundColor: '#333333',
            borderRadius: 5,
            borderColor: '#ff0000',
            borderWidth: 3,
            shadowOffsetX: 0,
            shadowOffsetY: 0,
            shadowBlur: 0,
            shadowColor: 'rgba(0, 0, 0, 0)',
          },
        },
      },
      versions: {
        dataLabels: {
          fontFamily: 'monaco',
          useSeriesColor: true,
          lineWidth: 2,
          textStrokeColor: '#ffffff',
          shadowColor: '#ffffff',
          shadowBlur: 4,
          callout: {
            lineWidth: 3,
            lineColor: '#f44336',
            useSeriesColor: false
          },
          pieSeriesName: {
            useSeriesColor: false,
            color: '#f44336',
            fontFamily: 'fantasy',
            fontSize: 13,
            textBubble: {
              visible: true,
              paddingX: 1,
              paddingY: 1,
              backgroundColor: 'rgba(158, 158, 158, 0.3)',
              shadowOffsetX: 0,
              shadowOffsetY: 0,
              shadowBlur: 0,
              shadowColor: 'rgba(0, 0, 0, 0)'
            }
          }
        }
      }
    }
  }
};

image