Plot year/month in a Sparkline


We have a customer requirement that is asking to plot in a Sparkline a “line” where each data point represent year/month … given that we do not have a type that store data related to year/month ( and I would avoid to create it ) - any suggestion about how to accomplish the requirement?


assuming you have a metric SomeMetric that generates your original data points, you can have metric like:

"expression": "sum(eval('YEAR', SomeMetric)) / sum(eval('MONTH', SomeMetric))"

then simply use this new metric to display in the chart.


I was not clear describing the requirement - they want to plot something like :
201701 201702 201703

So basically a timeseries where each data point is the concatenation of year and month starting from 9 years ago


oh I see, you can manually construct the timeseries, you have the start and end and the interval would be month, or try using the timeComponent expression function in a metric.


I used the Timeseries.fromObjs(objs, tsEvalSpec, asTimeseriesSpec)

1 Like