Statistics: How to pragmatically define ValueType series color? getSeriesColor() is never invoked Follow
Hello,
My build is reporting statistics via service messages. I have implemeted a bean which provides a description and value format for my statistics key. The ValueType.getDescription() and ValueType.getValueFormat() are invoked at the time of creating a chart and correctly display my statistics key description and pre-set value type. However, ValueType.getSeriesColor() is never invoked, and thus colors are always randomly assigned to the values. I have series I consider 'negative' and would like to be red by default, and series I consider 'positive' and should be green by default.
I found an "OpenAPI" change log here: https://confluence.jetbrains.com/display/TCD8/Open+API+Changes
It mentions this line:
-
jetbrains.buildServer.serverSide.statistics.ValueType#getColor
now returns String containing Web Color
ValueType doesn't even have a getColor() method. I tried implementing it just in case the bean calls it by name via reflection, but it didn't work. I'm guessing the whole thing is just broken.
Anyone able to get color assignments working without editting xml files?
Please sign in to leave a comment.
I believe it's a typo here. The correct name is jetbrains.buildServer.serverSide.statistics.ValueType#getSeriesColor
I agree there is a typo. They said "getColor()" when it should have said "getSeriesColor()", but the root issue still remains: getSeriesColor() is never invoked in any OpenAPI workflow.
It is invoked by several classes that use this value to color the text. You need to invoke this method by yourself, if you are using this feature. Also, existing providers also invoke this method when necessary.
I'm not sure what you mean by "you need to invoke this method by yourself". After I invoke it, what do I do with the HTML color code string the method provides?
Are there any examples available of "existing providers" using this feature? None of the bundled or sample plugins have references to this method call.. and neither does google :(
This method is used when building a statistics graph. It is not in OpenAPI, indeed, but Teamcity's internals uses it. Again, you can rely on this method, when you'd like to draw your own data.
Anyway, this method is annotated as @Nullable, which means you can simply return null and don't care.
If TeamCity never requests my ValueType's color via getSeriesColor() for the Statistics graphs, is there a working way to specify color?