1. #1
    Sencha User
    Join Date
    Jan 2011
    Posts
    3
    Vote Rating
    0
    Courtney Hauth is on a distinguished road

      0  

    Default Query Bar Chart Series is being shown or hidden within the Chart.

    Query Bar Chart Series is being shown or hidden within the Chart.


    Using EXT 4.2.

    Within charts, you can hide or show each series by clicking on the series' legend.

    Is there a way to query each series to see if it is being shown or not?

    I tried to add a listener, actually several different listeners, when the series was hidden or shown within the legend. I was not successful there.

    The other thought was to check each series on whether it was being shown or not.

    I am trying to get the status of each of the series on whether it is being shown or not within the chart.

    I have looked and looked, it is not obvious.

    Any assistance or feedback would be appreciative!

    Thanks in advance.

  2. #2
    Sencha User
    Join Date
    Jan 2011
    Posts
    3
    Vote Rating
    0
    Courtney Hauth is on a distinguished road

      0  

    Default Solution to getting the Status of the Bar Chart Series.

    Solution to getting the Status of the Bar Chart Series.


    After several days, must experimenting and finally reviewing the Ext code found a solution. I have only tested on Bar Charts and EXT 4.2.1. Line charts seem to have different properties.

    The following code iterates through all the Bar chart series and print a boolean value on whether each series is hidden or not.

    Ext.each(
    Ext.getCmp('BarChartId').legend.items, function(item) {
    console.log(item.hiddenSeries);
    }
    );

    The following code adds a listener to the legend when the series is hidden and unhidden:

    Ext.getCmp('BarChartId').on('mouseup', onBarChartMouseUpEvent, this);

    Note the event is on 'mouseup' and not 'mousedown'. Turns out on 'mousedown' event, the series has not changed state yet. The 'mousedown' event is before the series changes state(hidden or unhidden).