• 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
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

Cewolf - PageViewCountData's data

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry for another post about Cewolf, but I'm having one last problem.

My charts are displaying great, and now I want to have access to the data I passed to them,when they are clicked on.

I can get access to the instance of my PageViewCountData class (modified from the tutorial) which was clicked on, but i have NO idea how to use it!

I'm trying to retrieve the DefaultCategoryDataset which is made in produceDataset, but to no avail. Basically, I need to have access to the list created in this class, in whatever format that will make it usable. But at the moment I cant get access to anything in my parent class

I may be showing my lack of general Java Knowledge here, but I'm pretty stuck, and this is pretty important.

Below is code snippets for my PageViewCountData'

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you need access to this object in requests subsequent to the original page generation, then you need to store it in a context that stays around longer - maybe the user's session, or the maybe web app context if this is global data.

You also need to keep a reference to the DataSet around in the class in an instance field, so that you can retrieve it later via some appropriate getter method.

I'm not sure what you mean by "parent class".
 
MichaelJ McCabe
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am keeping the instance in a session -



and then



but I am trying to get the data from PageViewCountData, into a form which can be used (i.e DefaultCategoryDataset, or a list of somekind)
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So you're already halfway there. Now instead of

you want something like

so that you can retrieve (and work with) the Dataset object in the code you posted.
 
MichaelJ McCabe
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok great, I'm hitting more problems though.

I have made a ChartData class, to hold values of what was going INTO my cewolf chart. this is below



Now in my class DropDownsAction, i make a new dataset and retrieve it from my PageViewCountData



I then make a new list of ChartData objects so they can be filled with my data



I am hitting problems which I list below. If you could help, I would be so greatful.

1)
I get an error: Index: 1, Size: 1

The data in the cewolf chart is perfect, so I can only assume I'm doing something wrong

and

2)
in the code above I have done chartDataTemp.setLabel("time"+z);
This is only temporary due to a problem that getValue on DefaultCategoryDataset always returns a Number. But I have a Sring in my data set :S
 
MichaelJ McCabe
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, I have worked around the two problems by not using DefaultCategoryDataset, and just getting the raw data. Interesting problem though
 
Those who dance are thought mad by those who hear not the music. This tiny ad plays the bagpipes:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic