We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
想实现柱状图分组功能 像这样的
我现在的效果是这样的 这怎么成这样了
代码 var chart = new G2.Chart({ container: 'g2-ri', autoFit: true, // paddingTop: 0, // paddingBottom: 10, // paddingRight: 10 });
chart .interval() .data({ type: 'inline', value: this.zhuData.RiProfit, transform: [ { type: 'fold', fields: ['date_times', 'ps_sale_total_price', 'cost_money', 'lirun_price'], // key: 'key', // value: 'value', }, ], }) .transform({ type: 'sortX', by: 'y', reverse: true, slice: 6 }) .transform({ type: 'dodgeX' }) .encode('x', 'date_times') .encode('y', 'ps_sale_total_price') .encode('color', 'ps_sale_total_price') .scale('y', { nice: true }) .axis('y', { labelFormatter: '~s' }); chart .interaction('tooltip', { shared: true }) .interaction('elementHighlightByColor', { background: true }); chart.render();
数据是 [ { "date_times": "2023-10-01", "ps_sale_total_price": 0, "cost_money": 0, "lirun_price": 0 }, { "date_times": "2023-10-02", "ps_sale_total_price": 0, "cost_money": 0, "lirun_price": 0 }, { "date_times": "2023-10-03", "ps_sale_total_price": 0, "cost_money": 0, "lirun_price": 0 }, { "date_times": "2023-10-04", "ps_sale_total_price": 0, "cost_money": 0, "lirun_price": 0 } ]
需要把每个日期下面 ps_sale_total_price cost_money lirun_price 这三个字段分为一组 搞不定了啊 帮帮忙感谢了
The text was updated successfully, but these errors were encountered:
.encode('x', 'key') .encode('y', 'value')
Sorry, something went wrong.
什么意思啊
能准确回复吗 我已经提交好几次了 一直解决不了
相同的问题:#5711
No branches or pull requests
想实现柱状图分组功能 像这样的
我现在的效果是这样的 这怎么成这样了
代码
var chart = new G2.Chart({
container: 'g2-ri',
autoFit: true,
// paddingTop: 0,
// paddingBottom: 10,
// paddingRight: 10
});
数据是
[
{
"date_times": "2023-10-01",
"ps_sale_total_price": 0,
"cost_money": 0,
"lirun_price": 0
},
{
"date_times": "2023-10-02",
"ps_sale_total_price": 0,
"cost_money": 0,
"lirun_price": 0
},
{
"date_times": "2023-10-03",
"ps_sale_total_price": 0,
"cost_money": 0,
"lirun_price": 0
},
{
"date_times": "2023-10-04",
"ps_sale_total_price": 0,
"cost_money": 0,
"lirun_price": 0
}
]
需要把每个日期下面 ps_sale_total_price cost_money lirun_price 这三个字段分为一组 搞不定了啊 帮帮忙感谢了
The text was updated successfully, but these errors were encountered: