antvis/G2
The issue has been closed
[v5] 面积图在 transpose 坐标系下绘制不出来 #4530
visiky posted onGitHub
描述
- 不开启
chart.coordinate([{type:'transpose'}])
, 面积图正常绘制。开启之后,面积图绘制不出来
期望 | 现状 |
---|---|
<img width="889" alt="image" src="https://user-images.githubusercontent.com/15646325/209743777-3ba0cc58-8eea-4343-b420-f549132c1705.png"> | <img width="688" alt="image" src="https://user-images.githubusercontent.com/15646325/209743768-2e0701f2-fd16-419b-aaed-d5e847ae43f9.png"> |
代码
/**
* A recreation of this demo: https://www.anychart.com/zh/products/anychart/gallery/Combined_Charts/Range_Spline-Area,_Spline_and_Marker_Chart.php
*/
import { Chart } from '@antv/g2';
const chart = new Chart({
container: 'container',
autoFit: true,
});
chart.data(getData())
chart.coordinate([{type:'transpose'}])
chart
.area()
.encode('x', d => new Date(d[0]))
.encode('y', d => d[1])
.encode('shape', 'smooth')
.style('fillOpacity', 0.45)
.style('fill', '#64b5f6')
chart
.point()
.encode('x', d => new Date(d[0]))
.encode('y', d => d[1])
chart
.line()
.encode('shape', 'smooth')
.encode('x', d => new Date(d[0]))
.encode('y', d => d[1])
chart.render();
function getData() {
return [
['2015/9/01', 10],
['2015/9/02', 12],
['2015/9/03', 11],
['2015/9/04', 15],
['2015/9/05', 20],
['2015/9/06', 22],
['2015/9/07', 21],
['2015/9/08', 25],
['2015/9/09', 31],
['2015/9/10', 32],
['2015/9/11', 28],
['2015/9/12', 29],
['2015/9/13', 40],
['2015/9/14', 41],
['2015/9/15', 45],
['2015/9/16', 50],
['2015/9/17', 65],
['2015/9/18', 45],
['2015/9/19', 50],
['2015/9/20', 51],
['2015/9/21', 65],
['2015/9/22', 60],
['2015/9/23', 62],
['2015/9/24', 65],
['2015/9/25', 45],
['2015/9/26', 55],
['2015/9/27', 59],
['2015/9/28', 52],
['2015/9/29', 53],
['2015/9/30', 40]
];
}