Personalization details

Hello,
This is a minor issue with customizing the report chart, but I can't figure out how to change the text color of the vertical axis labels.

SetChartBkColor(colorWhite);
GraphLabelDecimals = 0;
SetChartOptions(1, chartShowDates);

// Cálculo del drawdown del Portfolio ($)
EQ = C;
MaxEQ = Highest( EQ );
DD_absolute = ( Eq - MaxEQ );
MaxDD_absolute = Lowest( DD_absolute );

// Cálculo del drawdown del sistema (%)
EQ = C;
MaxEQ = Highest(EQ);
DD_percent = 100 * (EQ - MaxEQ) / MaxEQ;
MaxDD_percent = Lowest(DD_percent);

//Títulos
Title = EncodeColor(colorBlack) + " MaxDD: " + NumToStr( LastValue(MaxDD_absolute), 1.0, True ) +"($)" + "   " + NumToStr( LastValue(MaxDD_percent), 1.2, True ) + "(%)"+
 "      DDActual: " + NumToStr( LastValue(DD_absolute), 1.0, True ) +"($)" + "   " + NumToStr( LastValue(DD_percent), 1.2, True ) + "(%)";

// Pintamos Portfolio
SetGradientFill( ColorRGB( 255, 225, 225 ), ColorRGB( 255, 50, 50 ), 0);
Plot( DD_absolute, "", ColorBlend( ColorRGB( 255, 50, 50 ), colorBlack ), styleGradient |styleLine , Null, Null, 0, -1 );
Plot(MaxDD_absolute, "", colorRed, styleLine  | styleDashed );
 
// Aviso si no se aplica sobre gráfico de equity
if (Name() != "~~~EQUITY" AND Name() != "~~~OSEQUITY")
    Title = "?? Warning: this chart should be applied to ~~~EQUITY or ~~~OSEQUITY only!";

In this chart, you can see that the text color for the DDActual label is white and for MaxDD it's black. How do I change that? Is it even possible?
Also, the DDActual label is a rectangle, and the MaxDD label is also a rectangle with a pointed end. Can I customize that? How? Can I make both labels like the MaxDD label, that is, a rectangle with a pointed end?

Thank you very much

1 Like

Finer details of the answer are reserved for Tomasz,
but what you see is his good s/w development practice.

Regarding your black and white text color, this is by design where you use light on dark, or dark on light. That is why textcolor adjusts automatically.
image
Similarly, the pointed rect is reserved for the price(C) field. This is also logical so the user can quickly/uniquely identify it.

That is why they are the way you see them. Altering such design is not a good idea and we should appreciate the effort in every detail.

Now you could draw your own stuff with gfx the way you like it, but is it worth it?

Thanks nsm51,
I know it's a "silly customization thing," I was just asking if it was easy to change.
If not, it's not a big deal.

As @nsm51 wrote you, the text of the label is either black or white depending on luminescence (preceived brightness) of label background. The "brightness" is calculated as weighted sum of Red, Green, and Blue values of color. If color is found "bright" then text is black, otherwise it is white. It is done for maximum readability (maximum CONSTRAST) between label background color and text. I ensure you that changing that would make labels LESS readable.
The only way to change the text color is therefore using lighter or darker LABEL COLOR.

4 Likes