2017-10-30 8 views
1

座標空間(JSBin)を描画する次のコードがありますが、Y軸のタイトル/凡例(つまりx 10000)がY軸に近すぎることがわかりました。私はそれを少し上に移動したい。 yAxis: { title: { y: 0 } }yAxis: { title: { y: -5 } }に変更すると、その一部が表示されなくなります。多分、システム全体を少し左に動かすことができますか?凡例を少し上に移動

誰にでも良い解決策がありますか?

<!DOCTYPE html> 
<html> 
<body> 
    <script src="https://code.highcharts.com/highcharts.js"></script> 
    <script src="https://code.highcharts.com/highcharts-more.js"></script> 
    <script src="https://code.highcharts.com/modules/exporting.js"></script> 
    <div id="container" style="height:400px;margin:1.5em 1em;"></div> 

    <script> 
    var chart = new Highcharts.Chart({ 
    chart: { 
     renderTo:'container', 
     type:'area' 
    }, 
    credits: false, 
    legend: false, 
    title: { text:"" }, 
    tooltip: {}, 
    plotOptions: { 
     series: { 
     color:'rgba(156,156,156,.9)', 
     fillColor:'#ffffff', 
     lineWidth:1, 
     marker: { 
      enabled:false, 
      states: { 
      hover: { 
       enabled:false 
      } 
      } 
     } 
     } 
    }, 
    xAxis: { 
     tickmarkPlacement:'on', 
     categories:[-1.7, -1.65, -1.6, -1.55, -1.5, -1.45, -1.4, -1.35, -1.3] 
    }, 
    yAxis: { 
     title: { text: "x 10000", rotation: 0, y: 0, x:10, margin: -40, align: 'high'}, 
     tickLength: 10, 
     tickWidth: 1, 
     lineWidth: 1, 
     tickmarkPlacement:'on', 
     gridLineColor:'#ffffff', 
     categories:[0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5] 
    }, 
    series:[{ 
     data:[[1,1],[1,3],[2,3],[2,1],[1,1]] 
    }]  
    }); 
    </script> 
</body> 
</html> 

答えて

0

解決策が見つかりました。余白を追加するにはここをクリックしてください:

chart: { 
    renderTo:'container', 
    type:'area', 
    marginTop: 30 
}, 

そして、タイトルに負の位置を追加することができます。 :) MarginTopは基本的にプロット領域を下に移動するので、上部に空白があります。

https://api.highcharts.com/highcharts/chart.marginTop

関連する問題