Plot year/month in a Sparkline

#1

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?

#2

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.

#3

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

#4

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.

#5

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

1 Like