问题描述
将Pivottable.js与Plotly折线图一起使用时,这些点与垂直线相连。右边应该与水平线相连。
要复制的代码
<div id="output" style="overflow:scroll;width:100%"></div>
<script>
var numberFormat = $.pivotUtilities.numberFormat;
var floatFormat = numberFormat({digitsAfterDecimal: 1});
var tpl = $.pivotUtilities.aggregatorTemplates;
var derivers = $.pivotUtilities.derivers;
var renderers = $.extend($.pivotUtilities.renderers,$.pivotUtilities.plotly_renderers);
var months = ['2000-01','2000-01','2000-02','2000-03','2000-04','2000-05','2000-06','2000-07','2000-08','2000-09','2000-10','2000-11','2000-12','2001-01','2001-01'];
var scores = [-6.5,-30.0,-26.6,-43.6,-52.3,-71.5,-81.4,-80.5,-82.2,-76,-67.3,-46.1,-35,-30,-10];
var objs =[];
var i = 0;
for (m of months) {
var obj = {};
obj['month'] = m;
obj['score'] = scores[i];
obj['user'] = 'Joe';
objs.push(obj);
i++;
}
$('#output').pivotUI(
objs,{
renderers: renderers,showUI: false,rows: ['user'],cols: ['month'],rendererName: 'Line Chart',rowOrder: 'value_a_to_z',colOrder: 'value_a_to_z',aggregators: {
"Score": function() { return tpl.sum(floatFormat)(['score']) }
},rendererOptions: {
plotly: {
xaxis: {
tickmode: "linear",tick0: '1999-12-15',dtick: 30 * 24 * 60 * 60 * 1000 // milliseconds
}
}
}
}
);
</script>
预期行为
实际行为
环境
- 可枢转的v2.23.0
- Plotly Basic v1.53.0
- jQuery v3.4.1
- Opera Browser v70.0:
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)