• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Bar Chart

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm looking to create a Bar Chart applet,I did that by drawing
rectangles,but the problem is I need to create an event when I click on each bar,but the bars are not objects ,they are just shapes.
Any one please can help and tell me how to create a Bar Chart applet and when you click on each bar we popup a menu.
Thanks alot.
 
Trailboss
Posts: 23954
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I suggest that you make lightweight components. Each component can inherit Canvas or Component. Set their size to be the size of the rectangle you want. Set their background color to the color you want. Then place them on a panel using the null layout manager (so you can get exact positioning). Now, each bar has it's own collection of events that it will generate!
 
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not quite sure creating each comp. for every chart is that great idea, since it can slow the whole down a lot (depends on how many charts are there). Why just not check coordinates from the mouse clicks that are going to root component ?
From the other side, for the popup menu it can be more complicated, since if popup menu differes for every chart, then you'll need to remove/add items each time you click the popupTrigger button.

------------------
With best of best regards, Pawel S. Veselov ( aka Black Angel )
 
Wanna see my flashlight? How about this tiny ad?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic