Skip to content

Conversation

Justin-ZS
Copy link
Contributor

@Justin-ZS Justin-ZS commented Jun 16, 2025

@Justin-ZS Justin-ZS force-pushed the feat/support_reverse_stack_order branch from 640f994 to e2c34b8 Compare June 16, 2025 10:31
@Justin-ZS Justin-ZS changed the title doc: add doc for echarts/pull/20998 doc: add doc for stackOrder Jun 16, 2025
@Justin-ZS
Copy link
Contributor Author

@Ovilia Could you help to reivew this doc changes? Thanks!

@Ovilia Ovilia merged commit 8106d40 into apache:master Jun 21, 2025
1 check passed
@Ovilia
Copy link
Contributor

Ovilia commented Jun 21, 2025

Thanks!

@helgasoft
Copy link

tested with the 6 beta
It works, but the documentation should say "stackOrder should be defined for all series with the same stack name"
Example:
If stackOrder is defined for just one series ('Direct') and this series is deselected from legend, then the stack order in the chart will auto-reverse.

stackDesc.mp4
option = {
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      // Use axis to trigger tooltip
      type: 'shadow' // 'shadow' as default; can also be 'line' or 'shadow'
    }
  },
  legend: { top: 26 },
  grid: { containLabel: true },
  xAxis: {},
  yAxis: { data: ['Mon', 'Tue', 'Wed'] },
  series: [
  {
    name: 'Direct', stackOrder: 'seriesDesc',
    type: 'bar',
    stack: 'total',
    label: { show: true },
    data: [320, 302, 301, 334, 390, 330, 320]
  },
  {
    name: 'Mail Ad', //stackOrder: 'seriesDesc',
    type: 'bar',
    stack: 'total',
    label: { show: true },
    data: [120, 132, 101, 134, 90, 230, 210]
  },
  {
    name: 'Affiliate Ad', //stackOrder: 'seriesDesc',
    type: 'bar',
    stack: 'total',
    label: { show: true },
    data: [220, 182, 191, 234, 290, 330, 310]
  },
  {
    name: 'Search Engine', //stackOrder: 'seriesDesc',
    type: 'bar',
    stack: 'total',
    label: { show: true },
    data: [820, 832, 901, 934, 1290, 1330, 1320]
  }]
};

@Justin-ZS
Copy link
Contributor Author

tested with the 6 beta It works, but the documentation should say "stackOrder should be defined for all series with the same stack name" Example: If stackOrder is defined for just one series ('Direct') and this series is deselected from legend, then the stack order in the chart will auto-reverse.

stackDesc.mp4

option = {
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      // Use axis to trigger tooltip
      type: 'shadow' // 'shadow' as default; can also be 'line' or 'shadow'
    }
  },
  legend: { top: 26 },
  grid: { containLabel: true },
  xAxis: {},
  yAxis: { data: ['Mon', 'Tue', 'Wed'] },
  series: [
  {
    name: 'Direct', stackOrder: 'seriesDesc',
    type: 'bar',
    stack: 'total',
    label: { show: true },
    data: [320, 302, 301, 334, 390, 330, 320]
  },
  {
    name: 'Mail Ad', //stackOrder: 'seriesDesc',
    type: 'bar',
    stack: 'total',
    label: { show: true },
    data: [120, 132, 101, 134, 90, 230, 210]
  },
  {
    name: 'Affiliate Ad', //stackOrder: 'seriesDesc',
    type: 'bar',
    stack: 'total',
    label: { show: true },
    data: [220, 182, 191, 234, 290, 330, 310]
  },
  {
    name: 'Search Engine', //stackOrder: 'seriesDesc',
    type: 'bar',
    stack: 'total',
    label: { show: true },
    data: [820, 832, 901, 934, 1290, 1330, 1320]
  }]
};

Thanks! I will open another PR to fix.

Justin-ZS added a commit to Justin-ZS/echarts-doc that referenced this pull request Jul 24, 2025
- Add important note that stackOrder should be defined for all series with the same stack name
- Explain potential issues when stackOrder is only defined for some series
- Address feedback from PR apache#448 comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants