antvis/G2








The issue has been closed
[5.x] Unknown Component: data.sort #4425
Valar103769 posted onGitHub
const renderChart = () => {
const chart = new Chart({
container: chartRef.value,
autoFit: true,
})
const line1 = chart
.line()
.data({
type: 'inline',
value: response.data1,
transform: [
{
type: 'filter',
callback: (item) => {
return item.hour.trim()
},
},
{
type: 'map',
callback: (item: any) => ({
...item,
x: dayjs(item.hour, 'YYYY-MM-DD HH').format('HH'),
}),
},
{
type: 'sort',
callback: (a, b) => a.x - b.x,
},
],
})
.encode('x', 'x')
.encode('y', 'new_recharge_orders')
.encode('shape', 'smooth')
Dose I should install these peerDependencies? <img width="509" alt="image" src="https://user-images.githubusercontent.com/36926073/206424722-187c1978-f3b1-4fee-8dc6-8f5d5e3aa311.png">