How to change colors of the chart based on timeframe
I am trying to change the colors of current month and future months a different color than past months. Past months show actual values and current/future months show forecast values. How would I go about doing this? What I would like is past months to be the current color below and current/future months to be a lighter color to be able to visually see the difference between actual and forecast values.
Best Answers
-
You can do this by creating beast modes for each of your series for current/future months and another for historical months. Since you have 3 bars, that would indicate you have 3 items in your series, so you would need to create 6 beast modes. Each would look like this:
Series A Historical Beast Mode
CASE WHEN seriesname = 'A' AND LAST_DAY(dt) < LAST_DAY(CURRENT_DATE()) THEN value END
Series A Current/Future Beast Mode
CASE WHEN seriesname = 'A' AND LAST_DAY(dt) >= LAST_DAY(CURRENT_DATE()) THEN value END
Series B Historical Beast Mode
CASE WHEN seriesname = 'B' AND LAST_DAY(dt) < LAST_DAY(CURRENT_DATE()) THEN value END
Series B Current/Future Beast Mode
CASE WHEN seriesname = 'B' AND LAST_DAY(dt) >= LAST_DAY(CURRENT_DATE()) THEN value END
Series C Historical Beast Mode
CASE WHEN seriesname = 'C' AND LAST_DAY(dt) < LAST_DAY(CURRENT_DATE()) THEN value END
Series C Current/Future Beast Mode
CASE WHEN seriesname = 'C' AND LAST_DAY(dt) >= LAST_DAY(CURRENT_DATE()) THEN value END
Drag all of these int your Series.
Now that they are all individual fields, you can use Color Rules to assign specific colors to each (i.e. Green and Light Green for the 2 Series A items, etc.)
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.3 -
So right now you have 4 groups in your series, let's say they're called:
- Line A
- Bar A
- Bar B
- Bar C
Could create a single BeastMode that appends something like "projected" to the end of each of those.
CASE WHEN LAST_DAY(date) >= LAST_DAY(CURRENT_DATE()) THEN CONCAT(seriesname, " projected")
else seriesname
END
That should split your series into eight groups:
- Line A
- Bar A
- Bar B
- Bar C
- Line A projected
- Bar A projected
- Bar B projected
- Bar C projected
And you should be able to adjust the color rules on each of those.
You will also want to change the number of series for a line from the default to 2, so that both "Line A" and "Line A projected" are graphed as a line. The other challenge there is that you will need to make sure your sort puts your two groups in the series first. Something like this:
- Line A
- Line A projected
- Bar A
- Bar B
- Bar C
- Bar A projected
- Bar B projected
- Bar C projected
Here's what it could look like:
The upside of this approach compared to Mark's is one BeastMode vs. 8. (TBH, I really used two, because I used a BeastMode to help the sort. Mark's approach is easier to control the bar order, since you're dragging the different BeastModes in).
A downside of of both of our approaches is that there is a discontinuity between actual and projected, and it creates empty slots in the grouped bar (there are three empty bars on the right side of the actuals and three empty bars on the left side of the projected).
Please 💡/💖/👍/😊 this post if you read it and found it helpful.
Please accept the answer if it solved your problem.
0
Answers
-
You can do this by creating beast modes for each of your series for current/future months and another for historical months. Since you have 3 bars, that would indicate you have 3 items in your series, so you would need to create 6 beast modes. Each would look like this:
Series A Historical Beast Mode
CASE WHEN seriesname = 'A' AND LAST_DAY(dt) < LAST_DAY(CURRENT_DATE()) THEN value END
Series A Current/Future Beast Mode
CASE WHEN seriesname = 'A' AND LAST_DAY(dt) >= LAST_DAY(CURRENT_DATE()) THEN value END
Series B Historical Beast Mode
CASE WHEN seriesname = 'B' AND LAST_DAY(dt) < LAST_DAY(CURRENT_DATE()) THEN value END
Series B Current/Future Beast Mode
CASE WHEN seriesname = 'B' AND LAST_DAY(dt) >= LAST_DAY(CURRENT_DATE()) THEN value END
Series C Historical Beast Mode
CASE WHEN seriesname = 'C' AND LAST_DAY(dt) < LAST_DAY(CURRENT_DATE()) THEN value END
Series C Current/Future Beast Mode
CASE WHEN seriesname = 'C' AND LAST_DAY(dt) >= LAST_DAY(CURRENT_DATE()) THEN value END
Drag all of these int your Series.
Now that they are all individual fields, you can use Color Rules to assign specific colors to each (i.e. Green and Light Green for the 2 Series A items, etc.)
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.3 -
So right now you have 4 groups in your series, let's say they're called:
- Line A
- Bar A
- Bar B
- Bar C
Could create a single BeastMode that appends something like "projected" to the end of each of those.
CASE WHEN LAST_DAY(date) >= LAST_DAY(CURRENT_DATE()) THEN CONCAT(seriesname, " projected")
else seriesname
END
That should split your series into eight groups:
- Line A
- Bar A
- Bar B
- Bar C
- Line A projected
- Bar A projected
- Bar B projected
- Bar C projected
And you should be able to adjust the color rules on each of those.
You will also want to change the number of series for a line from the default to 2, so that both "Line A" and "Line A projected" are graphed as a line. The other challenge there is that you will need to make sure your sort puts your two groups in the series first. Something like this:
- Line A
- Line A projected
- Bar A
- Bar B
- Bar C
- Bar A projected
- Bar B projected
- Bar C projected
Here's what it could look like:
The upside of this approach compared to Mark's is one BeastMode vs. 8. (TBH, I really used two, because I used a BeastMode to help the sort. Mark's approach is easier to control the bar order, since you're dragging the different BeastModes in).
A downside of of both of our approaches is that there is a discontinuity between actual and projected, and it creates empty slots in the grouped bar (there are three empty bars on the right side of the actuals and three empty bars on the left side of the projected).
Please 💡/💖/👍/😊 this post if you read it and found it helpful.
Please accept the answer if it solved your problem.
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 620 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 742 Beast Mode
- 58 App Studio
- 41 Variables
- 686 Automate
- 176 Apps
- 453 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 395 Distribute
- 113 Domo Everywhere
- 276 Scheduled Reports
- 6 Software Integrations
- 124 Manage
- 121 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive