Chart from SQLContainer

Is it possible to use a SQLContainer as a ContainerDataSeries source?

MySQL is:-
Select name x, count(*) y
from table
group by name;

When i run my app, it returns:-
ContainerDataSeries’ container should always have a property for ‘y’ values

Any examples?

Have you checked this

and namely: series.setYPropertyId(…) for setting the property used for ‘y’ values.

Thanks for the response.

Yes i did - for which i get the error (ContainerDataSeries’ container should always have a property for ‘y’ values)

I tried using an alias for the colums (x, y) and also tried the setYPropertyId as it states.

Do you have an example of how a simple DB Query can populate a chart?

Have you tried the same thing using BeanItemContainer instead of SQLContainer? Technically speaking the documentation does not state that there should be limitations regarding Container type. If you get it working with BeanItemContainer, that it is a hint that there could be a bug somewhere.

This is a wild guess, but your issue could be related to this one:

I don’t think its a bug. I just need a simple example of a SQLContainer being used to populate a chart. Can’t find a good example anywhere!

Does anyone have a simple example of a SQLContainer (with basic select x, y from table) to ContainerDataSeries?