The labelsAboveSpecific option with multiple lines is not showing all of the labels

« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by Bernhard on 12th June 2017

I have a canvas line graph with 4 lines and want to add specific labels above each line. Using labelsAboveSpecific I am only able to add labels to the first line - the parameter does not accept an array of arrays. How do I do this?


  var myLine = new RGraph.Line({
             id: 'line_OS',
             data: [[4,4,4,4],[19,19,19,19],[258,258,259,259],[103,103,103,103]],
             options: {
     title: 'Trend',
     titleSize: 10,
     titleColor: '#7D7F90',
     titleBold: false,
     titleY: 20,
     gutterTop: 50,
     labelsAbove: true,
     linewidth: 2,
     colors: ['green','#D0AC41','#9E1E1E','black'],
     strokestyle: 'white',
     textColor: '#7D7F90',
     shadow: false,
     backgroundGridVlines: false,
     backgroundGridBorder: false,
     axisColor: '#ccc',
     noyaxis: true,
     tickmarks: null,
     textSize: 8,
     key: ['Windows NT (4)','Windows 2000','Windows XP', 'Server 2003'],
     keyPosition : 'gutter',
                                 keyInteractive: true,
     labelsAboveBorder: false,
     labelsAboveSpecific: [['A','B','C','D'], ['a','b','c','d'], ['a','b','c','d'], ['a','b','c','d']],
Posted by Richard on 12th June 2017
Hi there,

The array that you pass to the labelsAboveSpecific option should be a flat array - not a 2D array. Here's your code:

Posted by Bernhard on 12th June 2017
Thanks a lot!
Posted by Bernhard on 12th June 2017
Follow up question: How do I suppress a specific label? Using '' gives the word "null" above the line. And using ' ' (a space) results in white spots (I want just the first and last label displayed above the line).
Posted by Richard on 12th June 2017
Hi there,

If you use a nul character it will work if you don't have boxes for the labels enabled. eg.


Add a reply

« Back to message list