Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] legend.data.shape优先级应该高于legend.item.symbolType #3633

Open
skie1997 opened this issue Jan 3, 2025 · 0 comments
Open
Assignees

Comments

@skie1997
Copy link
Contributor

skie1997 commented Jan 3, 2025

What problem does this feature solve?

当前表现:
主题中的legend.item.style.symbolType优先级高于legend.data.shape.symbolType,导致用户自定义shape失效
image

spec:

const spec = {
  type: 'bar',
  data: [
    {
      id: 'barData',
      values: [
        { type: 'Autocracies', year: '1930', value: 129 },
        { type: 'Autocracies', year: '1940', value: 133 },
        { type: 'Autocracies', year: '1950', value: 130 },
        { type: 'Autocracies', year: '1960', value: 126 },
        { type: 'Autocracies', year: '1970', value: 117 },
        { type: 'Autocracies', year: '1980', value: 114 },
        { type: 'Autocracies', year: '1990', value: 111 },
        { type: 'Autocracies', year: '2000', value: 89 },
        { type: 'Autocracies', year: '2010', value: 80 },
        { type: 'Autocracies', year: '2018', value: 80 },
        { type: 'Democracies', year: '1930', value: 22 },
        { type: 'Democracies', year: '1940', value: 13 },
        { type: 'Democracies', year: '1950', value: 25 },
        { type: 'Democracies', year: '1960', value: 29 },
        { type: 'Democracies', year: '1970', value: 38 },
        { type: 'Democracies', year: '1980', value: 41 },
        { type: 'Democracies', year: '1990', value: 57 },
        { type: 'Democracies', year: '2000', value: 87 },
        { type: 'Democracies', year: '2010', value: 98 },
        { type: 'Democracies', year: '2018', value: 99 }
      ]
    }
  ],
  xField: ['year', 'type'],
  yField: 'value',
  seriesField: 'type',
  legends: {
    visible: true,
    orient: 'top',
    position: 'start',
    data: item => {
      return item.map(i => {
        console.log('i', i)
        return {...i, shape: {...i.shape, symbolType: 'rect'}}
    })
    }
  }
};

const theme = {
    background: 'rgba(12,9,41,1)',
    component: {
      axis: {
        grid: {
          visible: true,
          style: {
            stroke: 'rgba(255,255,255,0.15)',
            lineWidth: 1
          }
        },
        label: {
          visible: true,
          style: {
            angle: 0,
            fill: 'rgba(255,255,255,0.65)',
            fontFamily: 'D-DIN',
            fontSize: 12,
            fontWeight: 'normal'
          }
        },
        domainLine: {
          visible: false,
          style: {
            stroke: 'rgba(0,0,0,0)'
          }
        },
        title: {
          visible: false
        }
      },
      crosshair: {
        xField: {
          line: {
            style: {
              opacity: 0.2
            }
          }
        }
      },
      tooltip: {
        backgroundColor: 'rgba(0,0,0,0.8)',
        panel: {
          backgroundColor: 'rgba(0,0,0,0.8)'
        },
        titleLabel: {
          fontColor: 'rgba(255,255,255,0.65)'
        },
        keyLabel: {
          fontColor: 'rgba(255,255,255,0.65)'
        },
        valueLabel: {
          fontColor: 'rgba(255,255,255,0.65)'
        }
      },
      discreteLegend: {
        item: {
          shape: {
            style: {
              symbolType: 'circle'
            }
          }
        }
      }
    }
  };



 VChart.ThemeManager.registerTheme('user', theme);
VChart.ThemeManager.setCurrentTheme('user');


const vchart = new VChart(spec, { dom: CONTAINER_ID });
vchart.renderSync();
window['vchart'] = vchart;

What does the proposed API look like?

null

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

No branches or pull requests

2 participants