Results 1 to 5 of 5

Thread: Add Sprite to Chart and handle spriteclick

  1. #1
    Sencha User
    Join Date
    Nov 2010
    Location
    Canton, GA, USA
    Posts
    164
    Answers
    4

    Default Answered: Add Sprite to Chart and handle spriteclick

    I'm looking to insert a little icon in the corner of a donut chart and handle clicks there to open up a larger version of the chart in a separate dialog. I added a sprite to the chart's surface and positioned it correctly but I can't figure out how to get spriteclick events for it. Any guidance?

  2. SpriteEvents plugin do the trick.

    add it to your chart and listen for spriteclick event fired from you chart.


    https://docs.sencha.com/extjs/6.6.0/modern/Ext.draw.plugin.SpriteEvents.html

  3. #2
    Sencha - Forum Administrator
    Join Date
    Sep 2017
    Posts
    1,006
    Answers
    5

    Default

    Hello there- I have sent this to the support team to look into. They will be reaching out to you to provide assistance. Your patience is appreciate.

    Thank you,

    Michele

  4. #3
    Sencha Premium User wemerson.januario's Avatar
    Join Date
    Nov 2008
    Location
    Goiânia - GO, Brazil
    Posts
    898
    Answers
    15

    Default

    SpriteEvents plugin do the trick.

    add it to your chart and listen for spriteclick event fired from you chart.


    https://docs.sencha.com/extjs/6.6.0/modern/Ext.draw.plugin.SpriteEvents.html
    Wemerson Januario @JanuarioCoder
    Novanti Tecnologia, Sencha MVP/ Ext JS Consultant
    ____________________________________________
    Hire me on UpWork:

    GitHub
    https://github.com/wemersonjanuario

    Treinamento e Consultoria Ext JS. QUALIFIQUE-SE JÁ!

  5. #4
    Sencha User
    Join Date
    Nov 2010
    Location
    Canton, GA, USA
    Posts
    164
    Answers
    4

    Default

    That works though I get events for all sprites on the chart (axes, series, items, etc.) and not just the ones I add. Not a problem though. The first argument to the handler is an object with a single "sprite" property. I was able to compare that to the value returned from chart.getSurface().add({...}) earlier to see if my addition was what was clicked.

    Thanks much.

  6. #5
    Sencha Premium User wemerson.januario's Avatar
    Join Date
    Nov 2008
    Location
    Goiânia - GO, Brazil
    Posts
    898
    Answers
    15

    Default

    Really nice to know it helps you @pauldugas. I hope sprites could observe mouse/keyboard events itself one day.
    Wemerson Januario @JanuarioCoder
    Novanti Tecnologia, Sencha MVP/ Ext JS Consultant
    ____________________________________________
    Hire me on UpWork:

    GitHub
    https://github.com/wemersonjanuario

    Treinamento e Consultoria Ext JS. QUALIFIQUE-SE JÁ!

Similar Threads

  1. adding sprite to the chart
    By raman4984 in forum Sencha Touch 2.x: Q&A
    Replies: 5
    Last Post: 25 Mar 2014, 12:47 PM
  2. Chart Sprite attribute
    By fatfly in forum Sencha Touch 2.x: Q&A
    Replies: 0
    Last Post: 20 Jul 2013, 2:39 AM
  3. Chart with custom sprite as background
    By teroko in forum Sencha Touch 2.x: Q&A
    Replies: 1
    Last Post: 26 May 2013, 12:42 AM
  4. Add image or sprite to bar chart
    By mkrakowski in forum Ext: Q&A
    Replies: 1
    Last Post: 3 May 2013, 1:02 PM

Posting Permissions

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