antv G2 设置base不正确,占用大家的一点时间帮忙看看吧
contain() {
const chart = new Chart({ container: 'container',theme: 'classic', autoFit: true});
chart.data({
type: 'inline',
value: [
[5,0.09459459], [10,0.22972973],
[15,0.36486486], [20,0.5],
[25,0.63513514], [30,0.77027027],
[35,0.90540541]
],
});
chart
.point()
.encode('x', (d) => d[0])
.encode('y', (d) => d[1])
.encode('shape', 'point')
.scale('x', {
domain: [1, 100],
type: 'log',
// base: 10,
//tickCount:3,
},
)
.scale('y', {
domain: [0.001, 1],
type: 'log',
base: 10,
//tickCount:4,
})
.style('fillOpacity', 0.75)
.axis('x',
{
tickLine: {
lineWidth: 2,
length: 10,
stroke: 'red',
alignWithLabel:true,
}
}
)
// chart
// .interval().
// axis('x', { tickCount: 4 })
chart
.line()
.data({
transform: [
{
type: 'custom',
callback: regressionExp(),
},
],
})
.encode('x', (d) => d[0])
.encode('y', (d) => d[1])
.encode('shape', 'smooth')
.style('stroke', '#30BF78')
.style('lineWidth', 2)
chart.render();
},
已解决
.scale('x', { domain: [1, 100], type: 'log' })
.scale('y', { domain: [0.001, 1], type: 'log' })
.axis('y', { tickCount: -1})
.axis('x', { tickCount: -1})
不知道你这个问题是否已经解决, 如果还没有解决的话: