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
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
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.
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>
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)