samber / chartjs-plugin-datasource-prometheus

📊 Chart.js plugin for Prometheus
https://www.npmjs.com/package/chartjs-plugin-datasource-prometheus
MIT License
107 stars 20 forks source link

Exclude empty label set from caption #18

Closed temppost2 closed 2 years ago

temppost2 commented 2 years ago

Sometimes for some reasons I exclude any labels from resulting time series data. In this case we have captions of resulting charts in the form like: node_load1{}, node_load5{}, etc. Is it possible to switch off drawing of empty label sets?

image

samber commented 2 years ago

I'm not sure to understand your need, but did you try the dataSetHook hook?

temppost2 commented 2 years ago

I think dataSetHook is not an option, because there is no need to modify data set. I just want to transform node_load1{} to node_load1 when it is rendered.

samber commented 2 years ago

Ok, you would like to rename the series name.

Feel free to open a PR to add a hook. The code is quite simple.

temppost2 commented 2 years ago

Sorry, I was wrong. dataSetHook is quite a nice place where it could be performed.