Question

I am trying to display a chart with tool tips but I cannot seem to figure out how you put in tool tips when you write your own JSON for the chart.

Is this possible?

Here is the JSON I have written so far:

var days_of_week_chart = {
  "elements": [
    {
      "type": "bar",
      "values": [33,0,0,0,0,0,0,],
    }
  ],
  "title": {
    "text": "Visitors By Day of Week"
  },
  "x_axis":{
    "stroke":1,
    "tick_height":10,
    "colour":"#d000d0",
    "grid_colour":"#00ff00",
    "labels": {
        "labels": ["Saturday","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday",]
    }
   },
    "y_axis": {
        "stroke": 4,
        "steps": 5,
        "tick_length": 5,
        "colour": "#d000d0",
        "grid_colour": "#00ff00",
        "offset":  0,
        "max": 33   }
};
Was it helpful?

Solution

You need to have the tooltip element, and tip element in the data series:

{ "elements": [ { "type": "hbar", "values": [ { "right": 4 }, { "right": 8 }, { "right": 3 }, { "right": 4 }, { "right": 7 }, { "right": 8 } ], "colour": "#86BBEF", "tip": "Months: #val#" } ], "title": { "text": "Total hours on project mayhem" }, "x_axis": { "offset": false, "min": 0, "max": 10 }, "y_axis": { "offset": 1, "labels": [ "Jeff", "Geoff", "Bob", "Terry", "Duncan", "monk.e.boy" ] }, "tooltip": { "mouse": 2, "stroke": 1, "colour": "#000000", "background": "#ffffff" } }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top