John274
(John K)
February 5, 2017, 10:56am
1
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?
Tatu2
(Tatu Lund)
February 6, 2017, 11:11am
2
Have you checked this
https://vaadin.com/docs/-/part/charts/java-api/charts-data.html#charts.data.containerseries
and namely: series.setYPropertyId(…) for setting the property used for ‘y’ values.
John274
(John K)
February 6, 2017, 12:27pm
3
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?
Tatu2
(Tatu Lund)
February 6, 2017, 1:11pm
4
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.
Tatu2
(Tatu Lund)
February 6, 2017, 2:17pm
5
This is a wild guess, but your issue could be related to this one: https://github.com/vaadin/framework/issues/7288
John274
(John K)
February 9, 2017, 10:47pm
6
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!
John274
(John K)
February 24, 2017, 10:19pm
7
Does anyone have a simple example of a SQLContainer (with basic select x, y from table) to ContainerDataSeries?