954,545 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Axis Labels

Hey guys n girls, I have two arrays (one for x and one for y axis) which contain labels i would like to display on a graph. How do you recommend i do this?

I was thinking multiple JLabels, spread out depending on the quantity. But If theres a better of way without creating multiple Jabels then that would be better. Maybe hashtable similar to the slider label creation process?

MrScruff
Junior Poster in Training
89 posts since Nov 2004
Reputation Points: 10
Solved Threads: 0
 

I wonder if this would work: Create one array with all the values you need, then create a gridlayout with the certain number of rows and columns you need and then append them to the container set to the grid layout

server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
 

Hi everyone,

Read the labels into an array and then use the graphics object to paint it on the specified object. Do not forget to valite and repaint the component on which you painted the labels.

Richard West

freesoft_2000
Practically a Master Poster
623 posts since Jun 2004
Reputation Points: 25
Solved Threads: 10
 

Ive actually just created a border layout with the graph in the center, Y axis (panel with gridLayout) to west and x axis (same as Y) south. Then created 5 labels for each y/x panel which i have placed a range of values from some arrays. Its taken some tweaking but it kinda works.

MrScruff
Junior Poster in Training
89 posts since Nov 2004
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You