This change adds an additional check for whether the parent element
is `null` or `undefined` in `$.color.extract`. This can happen when
working with elements that have not yet been added to the DOM under
`<body>`.
Consider the following example pie chart.
var elm = $("<div />")
.css({
width: "240px"
, height: "320px"
})
var data = [
{label: "One", data: "33"}
, {label: "Two", data: "33"}
, {label: "Three", data: "33"}
]
var opts = {
legend: {
show: true
}
, series: {
pie: {
show: true
}
}
}
$.plot(elm, data, opts)
elm.appendTo($("body"))
When flot inserts each legend row, it tries to use the same color as
the corresponding graph part, unless it was explicitly specified in
the options. However, in this example, `$.color.extract` runs into
an unexpected `null` reference because `<body>` is not an ancestor
of `elm`. Specifically, a `TypeError: Cannot read property
'nodeName' of undefined` would be thrown.
The pie plugin was a little too clever in its use of closures. In
processDatapoints it set canvas, target, and options for use in other
functions. Since options was not declared this meant that it became
global. Pages containing multiple pie plots therefore saw a range of
weird effects resulting from earlier plots receiving some of the options
set by later ones. Resolves#1128, resolves#1073, resolves#1055.
If an explicit numeric offset was provided, we should not override it.
The clipping is only meant to apply to the case where the center is
moved to make room for the legend in 'auto' mode, anyway.
When series.points.show is false, currently a ring appears on highlight
around where the point would have been. Instead, display the point on
highlight.
The autoscale check was too broad; it included the case where autoscale
was undefined. This resulted in axes not expanding correctly when
coordinates at the end of a series had null x or y values. Fixed by
narrowing the check to !== false; resolves#1095.
This is up to 2x faster and appears to work around issues in Chrome's
canvas implementation that sometimes result in bars not being filled.
Resolves#915.
Throwing an exception was overkill for such a limited-use option; we
should reserve those, and the file-size bytes they consume, for serious
cases only.
Support for right-aligned bars was never added to the hover or highlight
code; only the actual bar drawing. We need to replicate that in the
other two places as well.
Resolves#1093.
Since a plot may be redrawn after removing ticks or hiding the axis,
the tick text should always be removed before determining if there are
ticks to draw.
Labels are provided via a 'label' option on the axis, and can be styled
with the flot-axis-label class. The labelFont option works similarly to
tickFont, as an override for the default font or the flot-axis-label
class. The labelPadding option adds extra space between the axis and
its label.
Since most plots with axis labels currently use @markrcote's
flot-axislabels plugin, we also support the axisLabel and
axisLabelPadding options, and the axisLabels / axis[name]Label CSS
classes, to make it as easy as possible to transition from that plugin.
These are deprecated, and will be removed in 1.0.
The implementation uses the internal text API introduced in 0.8.
Updated the axis option defaults and docs for tickColor, tickFont,
tickWidth, and tickHeight. Also re-organized the API docs to match the
master list, and revised many areas for clarity.
The reference document is quite large; a table of contents would help readers navigate and find topics. (TOC was generated via [DocToc](http://doctoc.herokuapp.com/))