Highstock/Highcharts - yAxis Label top -


using highstock or highcharts, want yaxis label on top. don't want, varying margin between left border of chart , beginning of grid lines.

if take @ following fiddle: jsfiddle

relevant part is:

yaxis: {     title: {         align: 'high',         offset: 0,         text: 'rainfall (mm)',         rotation: 0,         y: -10     } } 

this correct, offset margin taken label width. if set offset: -41 instead, looks right. problem is, -41 due rendered length of text. if change text of different length, label positioned wrongly again.

is there possibility make sure, positions "correct" in above definition of correct, regardless of text length?

screenshot, left part wrong, right part correct:

display difference

i think can use text-anchor property style title. here can find more information text-anchor property: https://developer.mozilla.org/en-us/docs/web/svg/attribute/text-anchor

  title: {     align: 'high',     text: 'rainfall (mm)',     style: {       'text-anchor': 'start'     },     rotation: 0,     y: -10,     x: -25   }, 

i think need use chart.marginleft parameter well. give chance set specific left margin chart. here can find information it. http://api.highcharts.com/highcharts#chart.marginleft

you may use xaxis.labels.reservespace parameter turn off reserving space labels: http://api.highcharts.com/highcharts#xaxis.labels.reservespace

here can find live example how chart can work options: http://jsfiddle.net/ljwp7694/

kind regards,


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

unity3d - Fatal error- Monodevelop-Unity failed to start -