I have the data coming in the format (simplified for clarity):
{
"@timestamp": date,
"order": {
"status": string,
"price": float
}
}
Now, I want to make a time series plot that sums up the order.price
separately for order.status: completed
and order.status: cancelled
, but the latter should be plotted as a negative value.
Due to the fact that the graph is shared with other metrics, I am forced to use the right y-axis. The plan is to have just one axis for order.status: completed
and order.status: cancelled
plotting the values above and below the x-axis, respectively. That is why I cannot split the data into two series or I'd get two y-axis.
It is the negative value for order.status: cancelled
that I am struggling with. The series stricture:
- Aggregation (Sum of
order.price
) - Group by (Filters
order.status: completed
/order.status: cancelled
)
produces the graph with two curves but both of positive values.
The series
- Aggregation (Sum of
order.price
) - Aggregation (var
price
: Sum of order.price; Expression:params.price * -1
) - Group by (Filters
order.status: completed
/order.status: cancelled
)
makes both curves to be of negative values.
And I cannot pass as Math parameter anything but a number, i.e. I cannot make the if condition for order.status
term inside the Math execution script.