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

官网饼图选中交互例子中,没有设置默认选中的属性吗? #248

Closed
gg343917542 opened this issue Aug 15, 2018 · 3 comments
Assignees
Labels

Comments

@gg343917542
Copy link

  • F2 Version:
  • Platform:
  • Mini Showcase(like screenshots):
  • CodePen Link:
@simaQ simaQ self-assigned this Aug 15, 2018
@simaQ simaQ added the feature label Aug 15, 2018
@simaQ
Copy link
Contributor

simaQ commented Aug 15, 2018

稍等,这个属于合理的新功能,我支持一下。

@simaQ
Copy link
Contributor

simaQ commented Aug 20, 2018

3.2.1-beta.1 版本,使用方法:

var data = [
  { name: '芳华', percent: 0.4, a: '1' },
  { name: '妖猫传', percent: 0.2, a: '1' },
  { name: '机器之血', percent: 0.18, a: '1' },
  { name: '心理罪', percent: 0.15, a: '1' },
  { name: '寻梦环游记', percent: 0.05, a: '1' },
  { name: '其他', percent: 0.12, a: '1' }
];
var chart = new F2.Chart({
  id: 'mountNode',
  pixelRatio: window.devicePixelRatio
});
chart.source(data, {
  percent: {
    formatter: function formatter(val) {
      return val * 100 + '%';
    }
  }
});
chart.legend({
  position: 'right',
  marker: 'square'
});
chart.tooltip(false);
chart.coord('polar', {
  transposed: true,
  radius: 0.85,
  innerRadius: 0.618
});
chart.axis(false);
chart
  .interval()
  .position('a*percent')
  .color('name', ['#1890FF', '#13C2C2', '#2FC25B', '#FACC14', '#F04864', '#8543E0'])
  .adjust('stack')
  .style({
    lineWidth: 1,
    stroke: '#fff',
    lineJoin: 'round',
    lineCap: 'round'
  });
chart.render();

chart.interaction('pie-select', {
  animate: {
    duration: 300,
    easing: 'backOut'
  },
  defaultSelected: { name: '机器之血', percent: 0.18, a: '1' }, // 设置默认选中
});

@simaQ simaQ closed this as completed Aug 20, 2018
@gg343917542
Copy link
Author

@simaQ 手动好评

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants