The values in the x-axis keep on recurring and I want only three values to appear: Rural, Peri Urban and Urban. Below is my Javascript code showing the drawChar
t function used to visualize the chart. What could be the problem?
function drawVisualization(County) {
google.visualization.drawChart({
containerId: "visualization",
dataSourceUrl: "http://www.google.com/fusiontables/gvizdata?tq=",
query: "SELECT Environment,'BoyPupils','GirlPupils' " +
"FROM 1eC4sIAgVXfFj01mOM2cDiyW2nly7TcFeIXj1G3s" +
"WHERE Environment IN ('Rural','Urban'.'Peri Urban')",
chartType: "ColumnChart",
options: {
title: County,
height: 750,
width: 1100
}
});
}
You need a GROUP BY
clause for Environment
and must use SUM
for the other columns
"SELECT Environment, \
SUM('BoyPupils') as BoyPupils, \
SUM('GirlPupils') as GirlPupils \
FROM 1eC4sIAgVXfFj01mOM2cDiyW2nly7TcFeIXj1G3s \
GROUP BY Environment"