简体   繁体   中英

Define yAxis value with two different yAxis scale highcharts

Hello I have a chart with Highcharts, it's a line chart with two different yAxis. The left one graphics % and the right one minutes. I want to "hardcode" the left to be in this scale "0%, 20%, 40%, 60%, 80%, 100%"

This is my code

   var chartTot = {
     chart: {
         renderTo: 'grafTot',
         type: 'line',
         marginBottom: 110,

     },
     legend: {
         itemDistance: 20,
         itemWidth: 190
     },

     title: {
         text: ''
     },
     plotOptions: {
         series: {
             marker: {
                 enabled: false
             }
         }
     },
     xAxis: {
         categories: $scope.hours
     },
     yAxis: [{ //1st yAxis
             title: {
                 text: 'Clients %'
             },
             min: 0, // I want my graphic 0 to 100 but with this i get 
             max: 100, // 0- 120 because of the second axis 
             labels: {
                 format: '{value} %',
             },
         },



         { //2nd yAxis
             title: {
                 text: 'Minutes'
             },
             min: 0,
             max: 60,
             labels: {
                 format: '{value} min',
                 style: {
                     color: Highcharts.getOptions().colors[6]
                 }
             },
             opposite: true

         }
     ]
 };

How can I define the 1st yAxis scale and left the 2nd dynamic?

Thanks a lot

您应该将AlignTicks设置为false

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