ft-interactive/g-legend

Name: g-legend

Owner: FT Interactive News

Description: null

Created: 2017-06-27 16:37:11.0

Updated: 2017-06-27 16:39:54.0

Pushed: 2017-11-13 15:50:03.0

Homepage: null

Size: 125

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

g-legend codecov

Pre styled and positioned legend for use with the FT's g-chartframe architecture as part of the Visual Vocabulary. As the name suggests it creates a legend that can be appended to the .plot obejct in the g-chartframe hopefully eliminating the need to code another standard legend for each template.

Installing

Add this line of code to the head of your index.html file

ipt src="https://rawgit.com/ft-interactive/g-legend/master/build/g-legend.js"></script>

Getting started

Make sure you have these settings at the top of your index.html file with the rest of your chart settings

legendAlign = "vert"//hori or vert, alignment of the legend
legendType = 'rect' //rect, line or circ, geometry of legend marker

Add this code to your index.html file, this will define your legend and add it to your chart plot. The default for what the legend draws are your seriesNames.

t myLegend = gLegend.legend();

gend
eriesNames(seriesNames)
eometry(legendType)
em(myChart.rem())
lignment(legendAlign)
olourPalette((frameName));  

entFrame.plot()
ppend("g")
ttr("id","legend")
electAll(".legend")
ata(seriesNames)
nter()
ppend("g")
lassed("legend",true)
all(myLegend)

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.