javascript - HighCharts pointPlacement 选项在单柱形图中不起作用

标签 javascript jquery highcharts

看起来 pointPlacement 不适用于单个列...

The point placement can also be numeric, where 0 is on the axis value, -0.5 is between this value and the previous, and 0.5 is between this value and the next. Unlike the textual options, numeric point placement options won't affect axis padding.

就像在下面的示例中,我删除了这些数据,它不再起作用了:

{
  name: 'Employees Optimized',
  color: 'rgba(126,86,134,.9)',
  data: [140],
  pointPadding: 0.4,
  pointPlacement: -0.2
},{
  name: 'Profit',
  color: 'rgba(248,161,63,1)',
  data: [183.6],
  pointPadding: .3,
  pointPlacement: 0.2,
  yAxis: 1
}

http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/plotoptions/series-pointplacement-numeric/

这个 jsfiddle 显示了通常的 pointplacement 选项。如果您调整此 fiddle 并删除 3 个数据集中的 2 个,则 pointplacement 选项将被破坏,而即使在那种情况下,拥有和工作它仍然应该有用,甚至在我的情况下也是必需的...

编辑

我将其添加到 fiddle 中,因为到目前为止唯一响应的人没有从代码示例中得到要点。所以这里是:http://jsfiddle.net/dargno/3YMyq/

如果有人知道无需“破解”源代码的可能解决方案,我将不胜感激。

最佳答案

在我的特定实例中,通过向图形区域添加负边距并添加额外(空)数据点,我自己解决了这个问题。

chart: {
  type: 'column',
  marginRight: -400

series: [{
  name: 'Employees',
  color: 'rgba(165,170,217,1)',
  data: [150,0],

请记住,如果您不小心的话,工具提示可能会“丢失”。

可以在 http://jsfiddle.net/dargno/wtaaH/ 找到示例

虽然这不是一个合适的解决方案,但它肯定暂时绕过了这个错误。

关于javascript - HighCharts pointPlacement 选项在单柱形图中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19119912/

相关文章:

javascript - 将 javascript 变量作为 hightcharts 系列数据传递时,Highcharts 不起作用

javascript - Highcharts:需要带有月份和日期的热图

javascript - 什么是window.onunload?

javascript - 简单的if else onclick then呢?

javascript - 语法错误: illegal character when posting array to data attribute of highcharts

jquery - 带 Html 标签的 Yii2 Active Form 自定义消息

javascript - 使用 Javascript 将文本 CSS 解析为 JSON

javascript - Javascript 中的法语 ABC 顺序

javascript - ejs模板数据未插入到mongodb中

javascript - JSONArray JSP Ajax Jquery