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

渐变色区域图数据切换至全为 0 时,绘制出错 #389

Closed
simaQ opened this issue Oct 25, 2018 · 0 comments
Closed

渐变色区域图数据切换至全为 0 时,绘制出错 #389

simaQ opened this issue Oct 25, 2018 · 0 comments
Assignees
Labels
Milestone

Comments

@simaQ
Copy link
Contributor

simaQ commented Oct 25, 2018

  • F2 Version: 3.2.4
  • Platform:
  • Mini Showcase(like screenshots):
  • CodePen Link:

bug

var data1 = [
    { time: 'Jan.', tem: 1000 },
    { time: 'Feb.', tem: 2200 },
    { time: 'Mar.', tem: 2000 },
    { time: 'Apr.', tem: 2600 },
    { time: 'May.', tem: 2000 },
    { time: 'Jun.', tem: 2600 },
    { time: 'Jul.', tem: 2800 },
    { time: 'Aug.', tem: 2000 }
  ];

  var data2 = [
    { time: 'Jan.', tem: 0 },
    { time: 'Feb.', tem: 0 },
    { time: 'Mar.', tem: 0 },
    { time: 'Apr.', tem: 0 },
    { time: 'May.', tem: 0 },
    { time: 'Jun.', tem: 0 },
    { time: 'Jul.', tem: 0 },
    { time: 'Aug.', tem: 0 }
  ];
  var chart = new F2.Chart({
    id: 'mountNode',
    // animate: false,
    pixelRatio: window.devicePixelRatio
  });

  chart.source(data1);
  chart.tooltip({
    showCrosshairs: true
  });
  chart.scale({
    time: {
      range: [ 0, 1 ]
    },
    tem: {
      tickCount: 5,
      min: 0
    }
  });
  chart.axis('time', {
    label: function(text, index, total) {
      var textCfg = {};
      if (index === 0) {
        textCfg.textAlign = 'left';
      } else if (index === total - 1) {
        textCfg.textAlign = 'right';
      }
      return textCfg;
    }
  });
  // chart.axis(false)
  chart.area().position('time*tem').shape('smooth').color('l(0) 0:#1754FF 1:#00C9F3');
  chart.line().position('time*tem').shape('smooth').color('l(0) 0:#1754FF 1:#00C9F3');
  chart.render();
  console.log(chart.get('coord'));

  $('#zero').click(() => {
    chart.changeData(data1);
  });

  $('#notZero').click(() => {
    chart.changeData(data2);
  });
@simaQ simaQ added the bug label Oct 25, 2018
@simaQ simaQ self-assigned this Oct 25, 2018
@simaQ simaQ closed this as completed in 5cf6e44 Nov 19, 2018
simaQ added a commit that referenced this issue Nov 19, 2018
fix: fix the gradient color bug. Closed #389.
@simaQ simaQ added this to the 3.3 milestone Nov 19, 2018
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

1 participant