SVGGraph legends

« Return to SVGGraph page

Legends were added in version 2.6 of SVGGraph by popular request, along with the titles and axis labels. I had resisted adding them up until this point, thinking that they would be more easily created in the HTML surrounding a graph. With plain bar graphs that is probably still true, but for dashed line graphs with different coloured and differently shaped markers, it would be a lot more tricky.

Using graph legends

The legend is the small box that describes what each of the entries in the graph represents. By default, SVGGraph will not draw one because it doesn't know what each of the entries means. To set the entries in the legend, use an array of strings as the legend_entries option: