Skip to content

你正在查看 v1.0.1 文档。切换到最新版请访问:/

?

?What

????????????

?óWhen

  • ?
  • /??

?How - Quick

ts
import { BaseLine } from '@ymhc/harmonycharts';
import type { BaseLineConfig } from '@ymhc/harmonycharts';

@Entry
struct Index {
  @Prop baseLineConfig: BaseLineConfig = {
    categories: ['0', '1', '2', '3', '4', '5'],
    series: [{ name: 'Sine', data: [0, 0.84, 0.91, 0.14, -0.76, -0.96] }],
    tooltip: { show: true, trigger: 'axis', confine: true },
    legend: { show: true }
  };

  build() {
    Column() {
      BaseLine({ config: this.baseLineConfig, chartHeight: 220 })
    }
  }
}

н

line sine

????

ts
const option: HarmonyChartsOption = {
  grid: { top: 28, left: 12, right: 12, bottom: 24 },
  tooltip: { show: true, trigger: 'axis', triggerOn: 'mousemove', confine: true },
  legend: { show: true },
  xAxis: { type: 'category', data: ['0', '1', '2', '3', '4', '5'], boundaryGap: false },
  yAxis: { type: 'value', includeZero: true },
  series: [
    { type: 'line', name: 'Sine', data: [0, 0.84, 0.91, 0.14, -0.76, -0.96], lineStyle: { color: '#5470C6', width: 2 } }
  ]
};

?????

??? BaseLine ?£??????

?API

???
lineStyle?LineStrokeStyle-
showSymbol??booleantrue

??Events

ts
chart.on('click', (params) => {
  // params.seriesType === 'line'
});

?÷Advanced

  • smooth ???

? / ?Notes

  • ??? yAxis.includeZero ? true

HarmonyCharts 鸿蒙图表文档。