Commit Graph

5 Commits (968271a458d141e6fa0dd3ce36adf0e1f42327b2)

Author SHA1 Message Date
David Schnur 0c2f6e30c2 Slight cleanup / optimization for #1084. 13 years ago
execjosh c8c67de8b7 Also stop at root when extracting CSS color
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.
13 years ago
olau@iola.dk 7e33c7ba31 Fix color helpers plugin to return black rather than dieing when
somebody tries to parse "" or another unknown color


git-svn-id: https://flot.googlecode.com/svn/trunk@321 1e0a6537-2640-0410-bfb7-f154510ff394
15 years ago
olau@iola.dk 48adc6aaf1 Use closure trick to make inline colorhelpers plugin respect jQuery.noConflict(true), renaming the global jQuery object (reported by Nick Stielau)
git-svn-id: https://flot.googlecode.com/svn/trunk@275 1e0a6537-2640-0410-bfb7-f154510ff394
16 years ago
olau@iola.dk bc2bcd1bb5 Add color helper plugin, it might be better to host it elsewhere, but
for now it's available here


git-svn-id: https://flot.googlecode.com/svn/trunk@219 1e0a6537-2640-0410-bfb7-f154510ff394
17 years ago