highcharts - Highcharts 跳过大型数据集的共享工具提示点
问题描述
似乎 Highcharts 正在为大量数据点(2500+)跳过共享工具提示中的一些数据点。
我正在尝试使用 Highcharts 为 4 个系列渲染具有 2500 多个数据点的双轴图表。我还使用共享工具提示选项来呈现我的自定义工具提示 html。但有时 Highcharts 会在工具提示中跳过 1 或 2 个数据点。例如,当我从左到右慢慢地将鼠标悬停在每个点上时,我应该在“3 月 31 日”之后看到“4 月 1 日”。但相反,我看到的是“4 月 2 日”。它是一个错误吗?还是我错过了什么?(我已验证所有日期都存在于传递给 Highcharts 的类别中。)
tooltip: {
borderColor: '#ccc',
backgroundColor: 'transparent',
borderWidth: 0,
shadow: false,
shared: true, //show all series values together
useHTML: true,
// hideDelay: 50000,
formatter: function() {
if (props.config.type == 'pie') {
return 'Value : ' + this.y;
} else {
let html = '<div class="fixed-tooltip">';
html += formatTooltipDate(this.x);
if (this.points &&
this.points.length > 1 &&
props.config.type != "combination") { //multiple series*(see note below)
//*combination series are having 1 point, so handled in the else section as single series.
let dateIndex = props.config.data.categories.indexOf(this.x);
console.log(" date ", this.x);
console.log(" dateIndex ", dateIndex);
if (props.config.type == "dual") {
let dualAxisTitles = props.config.dualAxisTitles;
html += formatDualSeriesTooltipData(this.x, dateIndex, this.points, dualAxisTitles);
} else {
html += formatMultiSeriesTooltipData(this.x, dateIndex, this.points);
}
} else { //single series
//for combination charts have a custom tooltip logic
if (props.config.type == "combination") {
let dateIndex = props.config.data.categories.indexOf(this.x);
html += formatMultiSeriesTooltipData(this.x, dateIndex, props.config.data.series);
} else {
let seriesColor = this.points[0].point.series.color;
let seriesName = this.points[0].point.series.name;
let value = this.points[0].y;
html += formatSingleSeriesTooltipData(value);
}
}
html += '</div>';
return html;
}
}
}
预计会在“3 月 31 日”之后看到“4 月 1 日”数据点的工具提示。而是看到“4 月 2 日”数据点的工具提示。
解决方案
如果绘图区域中没有足够的空间放置这些点(1 像素为 1 点),则跳过这些点。解决方案是设置足够的图表宽度:
chart: {
width: 1000
},
现场演示:http: //jsfiddle.net/BlackLabel/yjk0ta43/
推荐阅读
- python - 如何生成嵌套字典?
- apache-spark - PySpark 执行程序库何时会与驱动程序不同?
- c++ - while循环在它的contition变为false后不会刹车
- python - 使用 Dataframe 列中的 DateTime 类型更新 SQL 列 Type Text
- c# - 将继承接口的类与接口引用进行比较
- xml - 类型不匹配:预期地图但在 apoc 中是 List{map}
- javascript - 打字稿中JavaScript符号类型的接口或类型?
- javascript - 将数据从脚本发送到脚本
- hadoop - HBase 表二级索引问题
- python - 预期的浏览器二进制位置,但无法在默认位置找到二进制文件,没有使用 GeckoDriver 提供的“moz:firefoxOptions.binary”功能