How to create a chart with colored time indications? (small guide)
The goal we aim for is a chart with different coloring styles to indicate past-present, alternating months or week-weekend-today.
All charts will be composed of following elements
To start add a measure and a time dimension on your chart.
Let's start with the top left from the first screenshot. (easy)
Afterwards add a "user dimension" containing to members. The first member is set " < today" the second is set to ">= today"
And you are already done. If you want you can change the colors of the measures to your liking.
If needed you can also hide the legend labels
Now let's look at the bottom left chart from the first screenshot.
The setup is the same for all 3 charts:
We are going to add a few calculations.
One for the background and one for the actual measure.
Background:count(0, 0, m1)
Measure: sum(all, 0, m1)
Now we have to set a visibility agent on the background measure.
We want to hide it if the "user dimension" does not contain a value.
Also hide the measure from you model, it will be replace by the "measure" calculation.
Now we can go to the properties of the chart.
Set background to the right axis. Change the type to columns, against each other, very wide.
The measure calculation will be kept on the left axis and will be of type line. (with or without markers as you see fit).
Now we have to hide and configure the right axis such that the bars will reach the top of the chart.
Remember the background measure only has a value of 1. So set the max value to 1.
All that is now left is to set the colors of you measures to whatever you desire.
Also optionally hide the correct legend labels (check box on the color pane)
Great, now to expand on the previous one and use 3 categories.
Week - weekend - today.
your use dimension will now have 3 members: one for with weekday "sun, sat", one with weekday <> "sun, sat" and the 3rd one is set "= today".
We now need an additional calculation in our chart. And also modify the calculation "measure".
Measure should only sum week and weekend columns.
The today measure will only sum the today column. Rember "today" was our 3rd member in the user dimension hence d3 is used.
measure: sum(d1:d2, 0, m1)
today: sum(d3, 0, m1)
We now have two visibility agents. One for each column calculation "measure, today"
We also have to hide the 3rd member of our user dimension, so it will not be shown in the chart.
Set background to hide position 1 starting from last.
you can also keep it visible if you also want to have a bar showing in your graph indicating today.
All that is left is the chart configuration
Unlike the background measure the today measure will also be on the left axis.
It will be of type line with only showing the marker.
You can adjust the line weight to increase the marker visibility.
Go to the color pane and give your new measure today a color to your liking.
Comments
Thanks for the inspiration!
Only one comment: If you change the TARGIT frontend language to English, it would even be much better :)
Please sign in to leave a comment.