Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    22
    Answers
    1
    Vote Rating
    0
    maxycini is on a distinguished road

      0  

    Default Unanswered: How to get the label of series in the bar chart on tap event

    Unanswered: How to get the label of series in the bar chart on tap event


    I have a very strange requirement.

    I have a column chart which has

    on the X axis - year
    and Y axis three fields [data1, data2, data3]


    graph.png

    So now my requirement is when i click on the first bar i want to show in an overlay the details of the bar i have clicked

    For Eg: Year : 2012-02 and Data1 : 2. using item

    Here i am able to get values 2012-02 and 2 on the bar tap using the code below
    {
    type : 'iteminfo',
    gesture : 'tap',
    listeners: {
    show: function (interaction, item, panel) {
    //item.value[0]
    //item.value[1];
    }
    }
    }

    but unable to find whether i have tapped on data1, data2 or data3 bar item.

  2. #2
    Sencha User
    Join Date
    Aug 2012
    Posts
    1
    Vote Rating
    0
    paradoxpixel is on a distinguished road

      0  

    Default Sencha silence on this is scary

    Sencha silence on this is scary


    I'm also looking for a way to do this too.

    There is a hacky way to get it if you get the legend item with the same color as the item object fill color.
    Of course this will only work if you have a different value for each yField.

    I just don't know why they couldn't just add it to the series item object here:
    Code:
    items.push({
                    series: me,
                    storeItem: currentRecord,
                    value: [currentRecord.get(me.xField), yValue],
                    attr: barAttr,
                    point: column ? [barAttr.x + barAttr.width / 2, yValue >= 0 ? barAttr.y : barAttr.y + barAttr.height] :                                [yValue >= 0 ? barAttr.x + barAttr.width : barAttr.x, barAttr.y + barAttr.height / 2]            });

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    22
    Answers
    1
    Vote Rating
    0
    maxycini is on a distinguished road

      0  

    Default


    Thanks for the reply

  4. #4
    Sencha User
    Join Date
    Mar 2012
    Posts
    22
    Answers
    1
    Vote Rating
    0
    maxycini is on a distinguished road

      0  

    Default Work around for this problem

    Work around for this problem


    In the series listener in the item tap event, we can get the index of the tapped bar item selected based on comparing the color code and value like this

    itemtap: function (series, item, event) {
    for(i=0; i<series.items.length; i++){
    if(item.attr.fill == series.items[i].attr.fill && item.value[0] == series.items[i].value[0]){
    selBarIndex = i;
    }
    }
    }



    so once you find the selected bar index from the Y fields array you can find out the label of the field you have tapped.

    so for example if the Y axis if we had 3 fields [data1, data2, data3]
    and in the item tap you got the selBarIndex = 1 that means the field you have tapped is fields[1] ie data1

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar