1
votes

For example I have plotted a line chart based on the date and number of students registered on a particular day on x and y axis respectively. When i mouse over to a particular point in the line chart i can view the tool tip displaying the x and y axis values. Instead I want to display the names of the students registered on that day when I mouse over to a particular point. Is there any solution for this problem? If there is no work around with Jqplot, please suggest me any other charts.. Please help me out. Thanks in advance.

1

1 Answers

1
votes

Here's a little example I put together for you.

It uses the largely undocumented tooltipContentEditor property of the highlighter plugin:

         highlighter: {
            show: true,
            sizeAdjust: 7.5,
            tooltipContentEditor:tooltipContentEditor
         }

Where your data is predefined like:

      var students = [
          ['Bob','Mark','Dave'],
          ['Tim','Mike']
      ];

      var data = [students[0].length,students[1].length];          

      function tooltipContentEditor(str, seriesIndex, pointIndex, plot) {
          // display series_label, x-axis_tick, y-axis value
          return students[pointIndex].join(", ");
        }