Skip to content

Area Chart (Trend Chart)

Examples

Basic Example

vue
<script setup>
const data = {
  Taylor: 502.84,
  Clark: 205.97,
  Martin: 332.79,
  Perez: 282.55,
  Wilson: 214.02,
}
</script>

<template>
  <div
    v-ec="['lineGradientTrend', data]"
    style="width: 100%; height: 300px;"
  />
</template>

Configured Example

vue
<script setup>
const data = [
  {
    name: 2021,
    data: {
      Taylor: 502.84,
      Clark: 205.97,
      Martin: 332.79,
      Perez: 282.55,
      Wilson: 214.02,
    },
  },
  {
    name: 2022,
    data: {
      Taylor: 281.55,
      Clark: 398.35,
      Martin: 214.02,
      Perez: 179.55,
      Wilson: 356.14,
    },
  },
]
</script>

<template>
  <div
    v-ec="[
      'lineGradientTrend',
      data,
      {
        backgroundColor: '#0A1612',
        lineColors: ['#C5C1C0', '#F7CE3E'],
        xAxisLabelColor: '#C5C1C0',
      },
      {
        legend: { top: '15px' },
      },
    ]"
    style="width: 100%; height: 300px;"
  />
</template>

Parameter Descriptions

IndexTypeRequiredDefault ValueDescription
0lineGradientTrendYes--
1DataYes-Data
2OptionsNodefaultOptionsConfiguration Parameters
3EcOptionsNo-ECharts Configuration Parameters

Default Parameter Values

options

ts
const defaultOptions: Options = {
  lineColors: ['#00b3f4', '#00ca95'],
  backgroundColor: '#080b30',
  xAxisLabelColor: '#fff',
}

Parameter Types

Data

ts
export type NameData = { name: string, data: NumberObject | NumberKeyValuePairArray }[]

export type Data =
  NumberObject |
  NumberKeyValuePairArray |
  NameData

Options

ts
export interface Options {
  lineColors?: string[]
  backgroundColor?: string
  xAxisLabelColor?: string
}

EcOptions

ts
export type EcOptions = Partial<EChartsOption>

Released under the MIT License.