javascript - How to place labels on opposite Y axis in Highchart without a second series -


i have following chart set in highcharts:

// initialize chart when document loads. $(document).ready(function() {     $('#results').highcharts({         chart: {             type: 'bar'         },         title: {             text: ''         },         xaxis: [{             categories: [                 'injustice: gods among ★',                 'tekken tag tournament 2 ★',                 'super smash bros. melee ★',                 'persona 4 arena',                 'king of fighters xiii',                 'dead or alive 5 ultimate',                 'street fighter x tekken ver. 2013',                 'soulcalibur v'             ],         }],         yaxis: {             allowdecimals: false,             title: {                 text: 'votes'             }         },         series: [{             data: [                 {y:1426,color:'#29a329'},{y:823,color:'#29a329'},                 {y:462,color:'#29a329'},{y:305,color:'#cc0000'},                 {y:181,color:'#cc0000'},{y:148,color:'#cc0000'},                 {y:127,color:'#cc0000'},{y:115,color:'#cc0000'}             ],             datalabels: {                 color: '#ffffff',                 enabled: true,                 inside: true             },             showinlegend: false,             name: 'votes'         }]     }); });  

this produces chart looks this:

chart single y axis.

what i'd have labels on y axis on opposite side (it's string, nothing special).

i can add series empty data points, , labels want (i'm writing javascript page server side effect) following code additions:

// initialize chart when document loads. $(document).ready(function () {     $('#results').highcharts({         chart: {             type: 'bar'         },         title: {             text: ''         },         xaxis: [{             categories: [                 'injustice: gods among ★',                  'tekken tag tournament 2 ★',                  'super smash bros. melee ★',                  'persona 4 arena',                  'king of fighters xiii',                  'dead or alive 5 ultimate',                  'street fighter x tekken ver. 2013',                  'soulcalibur v'          ],         }, {             categories: [                 '8/5/2013 8:59 pm',                 '8/5/2013 12:59 pm',                 '8/5/2013 2:59 pm',                 '8/5/2013 6:59 pm',                 '8/5/2013 12:59 am',                 '8/5/2013 3:59 pm',                 '8/5/2013 8:23 pm',                 '8/5/2013 8:19 pm'],             opposite: true,             title: {                 text: 'last vote cast at'             }         }],         yaxis: {             allowdecimals: false,             title: {                 text: 'votes'             }         },         series: [{             data: [{                 y: 1426,                 color: '#29a329'             }, {                 y: 823,                 color: '#29a329'             }, {                 y: 462,                 color: '#29a329'             }, {                 y: 305,                 color: '#cc0000'             }, {                 y: 181,                 color: '#cc0000'             }, {                 y: 148,                 color: '#cc0000'             }, {                 y: 127,                 color: '#cc0000'             }, {                 y: 115,                 color: '#cc0000'             }],             datalabels: {                 color: '#ffffff',                 enabled: true,                 inside: true             },             showinlegend: false,             name: 'votes',             xaxis: 1         }, {             data: [0, 0, 0, 0, 0, 0, 0, 0],             showinlegend: false         }]     }); }); 

jsfiddle

this gets me exactly want, except 1 thing, bars thinner, space made accommodate fake data series isn't meant shown:

multiple series in chart, 1 no data

the question is, how labels on right-side without these side effects? note don't need second data series, it's closed i've come solution. long bars displayed normally, don't mind mechanism values on right hand side written.

you want linked axis http://jsfiddle.net/u5dhw/

xaxis: [{             categories: ['injustice: gods among ★', 'tekken tag tournament 2 ★', 'super smash bros. melee ★', 'persona 4 arena', 'king of fighters xiii', 'dead or alive 5 ultimate', 'street fighter x tekken ver. 2013', 'soulcalibur v'],         },         {         categories: ['fred', 'tom', 'bill', 'david', 'nathan', 'charles', 'mike', 'andrew'],             linkedto: 0,             opposite: true         }], 

http://api.highcharts.com/highcharts#xaxis.linkedto


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -