SELECT TODATE(`date`, "MM/dd/yy") AS dt, `key`, value::int AS value FROM EXTERNAL CSV("http://scleraviz.herokuapp.com/assets/data/area-stacked.csv") PLOT( GEOM=AREA(x=dt, y=value), INTERPOLATE="cardinal", POSITION=STACK, FILL=`key` SCALE=COLOR("category20c") LEGEND(REVERSED) ) AXIS dt(TICKS=4)
The chart plots the `value` column, for different values of the `key` column in an area stack, against the `date` column. For better aesthetics, the curves are smoothed by specifying the interpolation mode as "cardinal". The color scheme used is "category20c", and a legend shows the color to `key` map. The order of the legend is reversed to be compatible with the stacking order. The date axis is automatically taken as a time axis, and has the number of ticks fixed as 4, as specified in the `AXIS` clause.
The data is read from a URL. The `date` column values are parsed as dates based on the specified pattern, and the `value` column is cast to `int`.