简体   繁体   中英

Highcharts Scaling Graph Issue

I am using Highcharts to create a chart:

http://dev.speechlink.co.uk/David/sixthiteration/home.php

When scaling however, it seems to chop part of the right side of the chart off...I'm not entirely sure why..?

Here is my code:

jQuery:

chart = new Highcharts.Chart({
      chart: {
         renderTo: 'summarycontainer',
      },
      credits: {
        enabled: false
      },
      exporting: {
        enabled: false
      },
       title: {
        text: 'No. Entries Submitted This Month',
        style: {
             fontSize: 10
        }
      },      
      xAxis: {         
         lineWidth: 1,
         lineColor: '#999999',
         title: {
            text: 'x-axis' 
         }
      },
      yAxis: {
         title: {
            text: 'y-axis'
         },
     labels: {
        y: 2
     },
     lineWidth: 1,
         lineColor: '#999999',
         gridLineWidth: 1,
         gridLineColor: '#eaeaea', 
         startOnTick: false,
         showFirstLabel: false
      },
      tooltip: {
         shared: true               
      },
      legend: {
         enabled: false
      },
      plotOptions: {
      },
      series: [{
         type: 'scatter',
         name: '',
         data: [10, 20, 10, 20, 2, 3, 1, 9],
         lineColor:  '#f6a828',
         color: '#418ed6'
      }],
   });
});

And in my HTML, I have a div container:

<div id = "summarycontainer" style="width: 250px; height: 250px"></div>

In code above you have:

data: [10, 20, 10, 20, 2, 3, 1, 9],

and in source of page thre is:

data: [10, 20, 10, 20, 2, 3, 1],

Maybe that you think the plot chops last dot?

edit: Add: categories: ['', ''] to your xAxis :

xAxis: {         
         categories: ['', ''],
         lineWidth: 1,
         lineColor: '#999999',
         title: {
            text: 'x-axis' 
         }
      },

In my opinion there is a bug in highcharts.

edit 2:

For formatting tooltip use (below is only example!):

tooltip: {
         formatter: function() {
                   return '<b>'+ this.series.name +'</b><br/>'+
               this.x +': '+ this.y +'°C';
         }
      },

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM