Loading ...
Sorry, an error occurred while loading the content.

Re: Line Chart Hide/Show Series

Expand Messages
  • tripp.bridges
    Currently, there is not an option for hiding a series through javascript in YUI Charts. There is a feature request that has been checked into github that adds
    Message 1 of 2 , May 29, 2009
    • 0 Attachment
      Currently, there is not an option for hiding a series through javascript in YUI Charts. There is a feature request that has been checked into github that adds a visibility style to the series styles. This will be included in the 2.8 release.
      http://yuilibrary.com/projects/yui2/ticket/2037620

      If I understand you correctly, this may not be what you need as the axes will still be drawn to include all data hidden or visible. Your best bet is to use the set method on your chart to update your dataSource.

      mychart.set("dataSource", yourLocalDataSource);

      The chart will render to accomodate the data that you have set.

      Thanks,
      Tripp
      --- In ydn-javascript@yahoogroups.com, "daniel.ldoyle" <daniel.ldoyle@...> wrote:
      >
      > Hi there,
      >
      > I am trying to create a very snappy chart which I have largely accomplished thanks to YUI, but I have one problem that I cannot seem to overcome.
      >
      > Is there some way to dynamically hide/show a series within a graph? I can pseudo accomplish this by keeping track of what to show in a JS array, building the series definition from that, and then remaking the graph. However, especially on higher resolution data or slower connections, the "refresh" time is extremely noticeable due to database fetching / processing time and latency.
      >
      > My preferred idea is to query all of the datasources on the first hit, and then just hide/show them based on ButtonGroup events with no further remote datasource calls.
      >
      > I have tried a couple of things, such as changing the color of the hidden ones to white to blend into the background but this still forces the dimensions of the graph to accommodate that, meaning that something "invisible" with an average value of 1000 will still make something with an average value of 5 unseeable except as a line at the bottom.
      >
      > I have also tried copying the data from the datasource via the doBeforeParseData event into a global JS object and then using that as the datasource on subsequent calls which, while better, still suffers from having to remake the entire graph.
      >
      > If there is already the means for this and in my hours spent scouring the web and APIs I missed it, my apologies in advance.
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.