jqPlot Legend Options not working

3,641 views
Skip to first unread message

smh0427

unread,
Dec 7, 2011, 1:37:34 PM12/7/11
to jqplot-users
I'm trying to control the text color and font size of the Legend using
option values like -

textColor: '#FFFFFF', fontFamily: 'Arial, Verdana, Helvetica',
fontSize: '10pt'

but it doesnt have any effect on the legend. Am I missing something or
is this a known bug?

PriorityMarketers

unread,
Dec 7, 2011, 2:33:29 PM12/7/11
to jqplot-users
Could you show a larger snippet of your options?

This seems to work for me:

{
legend: {
show: true,


fontFamily: "Arial, Verdana, Helvetica",

textColor: "#FFF",
fontSize: "10pt"

smh0427

unread,
Dec 7, 2011, 3:24:52 PM12/7/11
to jqplot-users
Here you go -

Depending on some condition I'm showing/hiding the legend

if (somecondition) {
Legend = { show: true, placement: "outsideGrid", location:
"nw", textColor: "#FFFFFF", fontSize: "10pt" };
}
else {
Legend = { show: false };
}

var chartPlot = $.jqplot('chartModal', chartData[1], {
seriesColors: ["#000066", "#990000", "#006600", "#FF3300",
"#00CC99"],
title: {
text: 'my chart', // title for the plot,
show: true,
fontSize: "10pt",


fontFamily: "Arial, Verdana, Helvetica",

textAlign: "center",
textColor: "white"
},
stackSeries: false,
seriesDefaults: {
shadow: false,
renderer: $.jqplot.BarRenderer,
rendererOptions: {
barMargin: 25,
barWidth: 12,
barPadding: 2,
fillToZero: true
},
pointLabels: { show: false }
},
legend: Legend}

> > is this a known bug?- Hide quoted text -
>
> - Show quoted text -

PriorityMarketers

unread,
Dec 7, 2011, 3:43:00 PM12/7/11
to jqplot-users
Sorry, I told you incorrectly the first time, you're going to want to
do something more like:

Legend = {
show: true,
placement: "outsideGrid",
location: "nw",
rendererOptions: {

textColor: "#FFFFFF",
fontSize: "10pt"
}
};

PriorityMarketers

unread,
Dec 7, 2011, 5:21:58 PM12/7/11
to jqplot-users
At a minimum, it looks like there's a problem with the regular
(TableLegendRenderer) not adding these styles to the table with the
beta version, however, if you use the EnhancedLegendRenderer it should
work.

On Dec 7, 12:24 pm, smh0427 <smh0...@gmail.com> wrote:

Reply all
Reply to author
Forward
0 new messages