In this post we will take on this month`s #SWDchallenge in data visualization. The challenge is relatively simple, to improve on the following chart of home sales for houses in Hamilton:
As a starting point, we imported the sample data provided to Dashboards Direct as a CSV file, naming it OctData21 (see this post on importing csv files to Dashboards Direct).We also added a second file where yearly data was aggregated into a single column.
We then did a little manipulation on the OctData21 data to generate a house sales forecast for the remainder of 2021; in summary, we took an average of the percentage gain between 2020 and 2021 and projected it on to 2020’s house sales figures.
oct:(select Month, Y2019, Y2020, Y2021, YoY20:((Y2020-Y2019)%Y2019)*100, YoY21:((Y2021-Y2020)%Y2020)*100 from OctData21);
update Forecast21:Y2020*(((YoY20*(avg (YoY21%YoY20)))%100)+1) from oct
With our data defined, we next went with working on the visuals.
In the original chart, heavy emphasis is given to house sales for 2021 - with sales for 2020 and 2019 a little lost with its use of lighter colors, hashed-lines and inconsistent use of data points.
The easiest solution for this is to display average monthly house sales as a single line chart. This provides equal weighting to each year and more importantly, shows the leap in prices from 2020 to 2021. By adding a title to the chart we can make reference to this gain to help focus the reader’s attention.
To achieve this in Dashboards Direct we start with the Canvas Chart component - line chart. For this chart type I have opted to go with a Stepped interpolation.
And a line fill to the origin, with Fade to Transparent enabled.
I like the stepped view as it shows the month to month change more clearly than a standard line chart, and with the transparency fade it has the appearance of a city skyline.
What about the forecast data?
For the forecast data I took the 2021 sales data as the baseline line chart, also with a stepped interpolation, and added a new Layer for the 2021 forecast data; the forecast data based on the average percentage gain between 2019 to 2020, and 2020 to 2021 (to date), projected forward to 2021.
I have taken the same line color used for existing 2021 monthly house sales, but lowered the opacity to increase transparency of the forecast line which is the overlaid on 2021 house sales in the chart. By using a feinter line we are separating the appearance of the reported data from the forecast, while retaining the continuity through the use of the shared color.
I then applied an area fill between the two layers to highlight the variance between the 2021 forecast and the reported data – this gives the reader an idea of what level of variation can be expected from the forecast relative to reported months.
Together, we could have a single graphic highlighting the sales surge, with a supporting projection as to what may follow. By making the forecast chart smaller we place greater emphasis on the known (the rising trend in house sales), but offer the reader a scenario as to what may follow for the rest of 2021.
If you would like to see how this was achieved in Kx Dashboards, watch the video.