Results 1 to 8 of 8

Thread: Disable Legend Click Event for ExtJs Charts

  1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    5
    Answers
    1

    Default Answered: Disable Legend Click Event for ExtJs Charts

    Hi All,
    I need to disable the default behavior for legend click which show/hides the chart element.
    I tried doing this but its not working

    Ext.each(chart.legend.items, function(item) {
    item.un("mousedown", item.events.mousedown.listeners[0].fn);
    })

    Please let me know if anyone have done this before.

    Manoj

  2. Ok. Was able to solve the issue.

    We need to add following after the chart is rendered .
    Ext.each(chart.legend.items, function(item) {
    item.un("mousedown", item.events.mousedown.listeners[0].fn);
    })

    Manoj

  3. #2
    Sencha User
    Join Date
    Sep 2011
    Posts
    5
    Answers
    1

    Default

    Ok. Was able to solve the issue.

    We need to add following after the chart is rendered .
    Ext.each(chart.legend.items, function(item) {
    item.un("mousedown", item.events.mousedown.listeners[0].fn);
    })

    Manoj

  4. #3
    Sencha User
    Join Date
    Nov 2011
    Location
    Bengaluru
    Posts
    12

    Default hi

    How to disabled the click functionality of legend in sencha touch?

  5. #4
    Sencha User
    Join Date
    May 2012
    Posts
    1

    Default

    I tried with the above code in afterrender listener, but its not working.

    Can anybody please help me to disable the click event in legend.

  6. #5

    Default use that like this

    use that like this

    Ext.each(
    Ext.getCmp('YOUR CHART ID')
    .legend.items, function(item) {
    item.un("mousedown", item.events.mousedown.listeners[0].fn);
    })

    you must
    replace
    YOUR CHART ID
    with id of chart that you want to disable its legend hover behavior
    it works i do it

  7. #6

    Default Can anyone suggest where to place these link?

    Can anyone suggest where to place these link?

    Ext.each(
    Ext.getCmp('YOUR CHART ID')
    .legend.items, function(item) {
    item.un("mousedown", item.events.mousedown.listeners[0].fn);
    })

    If you can paste the whole code for this pie chart, it will be more than helpful.
    Thanks

  8. #7

    Default Solution with live example


  9. #8

    Default

    Is it possible to add a listeners on the legend item(EXT JS MVC).

    i tried but it is working for the first time click but it is not working on the second time click event.
    {
    xtype : 'lineChart',
    listeners : {
    afterrender : function(chart, eOpts){
    setTimeout(function(){
    var legendItems = chart.legend.items;
    if(legendItems){
    for(var i = 0; i < legendItems.length; i++){
    legendItems[i].on('mousedown', function(event){
    console.log('Mouse Down : ' + event);
    });
    legendItems[i].on('mousedown', function(event){
    console.log('Mouse Over : ' + event);
    });
    /* legendItems[i].un("mousedown", legendItems[i].events.mousedown.listeners[0].fn);*/
    }
    }

    }, 200);
    }
    }
    }

    Also how i can disable and enable the series lines or any chart through programmetically using extjs mvc.

    Is it possible to replace the Legend Item feature(Hide and show the charts box or lines) with the check boxes.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •