Highcharts围绕yaxis和xaxis数字 [英] Highcharts rounding yaxis and xaxis digits

查看:129
本文介绍了Highcharts围绕yaxis和xaxis数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将yaxis和xaxis向下。例如,图中的3843应该是3.843,工具提示显示3.843 k。

我得到了工具提示工作,但无法让它更改图形yaxis和xaxis值,以便图表可以完全显示所有方面。



正如你在这里看到的:
http://jsfiddle.net/kzL0phfu/



这就是xaxis的样子

  yAxis:{
gridLineInterpolation:'polygon',
lineWidth:0,
min:0,
gridLineColor: #808080,
gridLineDashStyle:Solid,
gridLineWidth:2,
标签:{
格式:'{value:.2f}',
style :{
color:'#c4c4c4',
font:'11px Trebuchet MS,Verdana,sans-serif'
}
}
}


解决方案

如果要以同样的方式显示yAxis标签,从yAxis.labels对象(然后千位前缀将显示打好)。如果要显示点的精确值作为yAxis标签,可以在加载事件中更新 tickPositions 数组并充分格式化它们。看看下面的例子。



API参考:

http://api.highcharts.com/highcharts/chart.events.load
http://api.highcharts.com/highcharts/yAxis.tickPositions

例如:

http://jsfiddle.net/ojno8rx1/


I am trying to round yaxis and xaxis down. For example 3843 should be 3.843 on the graph and tooltip show 3.843 k.

I have got the tooltip working but cant get it to change the graphs yaxis and xaxis value so that the graph can show all sides fully.

As you can see here: http://jsfiddle.net/kzL0phfu/

This is what xaxis looks like

yAxis: {
gridLineInterpolation: 'polygon',
lineWidth: 0,
min: 0,
gridLineColor: "#808080",
gridLineDashStyle: "Solid",
gridLineWidth: 2,
labels: {
  format: '{value:.2f}',
  style: {
    color: '#c4c4c4',
    font: '11px Trebuchet MS, Verdana, sans-serif'
  }
}
}

解决方案

If you want to display yAxis labels the same way, get rid of the formatter from the yAxis.labels object (then the thousand prefix will display). In case you want to display exact values of the points as yAxis labels, you can update tickPositions array on load event and format them adequately. Take a look at the example below.

API Reference:
http://api.highcharts.com/highcharts/chart.events.load http://api.highcharts.com/highcharts/yAxis.tickPositions

Example:
http://jsfiddle.net/ojno8rx1/

这篇关于Highcharts围绕yaxis和xaxis数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆