Support Board
Date/Time: Sun, 09 Feb 2025 23:30:35 +0000
[Programming Help] - ACSIL Control Background and Transparency in
View Count: 138
[2025-01-06 10:33:22] |
User92573 - Posts: 541 |
Dear Support I'd be grateful for a little help with the following: My code is as follows and the Subgraph_TextDisplay is populated by 3 values which display as required. Here are the issues: 1) Despite "Subgraph_TextDisplay.SecondaryColorUsed = false;" I still get the color set for the secondary color?
2) When I select "Transparent Background" I get a solid Green background and the study value value part of the text string blocked out? Subgraph_TextDisplay.Name = "Text Display"; Subgraph_TextDisplay.DrawStyle = DRAWSTYLE_CUSTOM_TEXT; //DRAWSTYLE_TRANSPARENT_CUSTOM_VALUE_AT_Y; // DRAWSTYLE_CUSTOM_TEXT; Subgraph_TextDisplay.PrimaryColor = RGB(0, 0, 0); //black Subgraph_TextDisplay.SecondaryColor = RGB(255, 255, 221); // pale yellow Subgraph_TextDisplay.SecondaryColorUsed = false; // Get the value set in the input. int TransparentLabelBackground = Input_TransparentLabelBackground.GetYesNo(); sc.AddAndManageSingleTextDrawingForStudy ( sc , false , Input_HorizontalPosition.GetInt() , Input_VerticalPosition.GetInt() , Subgraph_TextDisplay , TransparentLabelBackground , StringValueText , sc.DrawStudyUnderneathMainPriceGraph? 0 : 1 , UseBoldFont ); // StringValueText is my formatted string that presents correctly. It's the drawing format that I'm struggling with. Any help appreciated. Many thanks. |
[2025-01-06 15:39:27] |
cmet - Posts: 605 |
Not sure if this helps but take a look. Custom study that plots three text values in subgraph based on your inputs. If you're still getting the full secondary color background, could possibly be something in chart graphic settings. Just go down the list and see if the same shade of green shows up and see what it corresponds to. #include "sierrachart.h"
SCDLLName("Custom Text Display") SCSFExport scsf_TextDisplay(SCStudyInterfaceRef sc) { SCSubgraphRef Subgraph_TextDisplay = sc.Subgraph[0]; SCInputRef Input_HorizontalPosition = sc.Input[0]; SCInputRef Input_VerticalPosition = sc.Input[1]; SCInputRef Input_TransparentLabelBackground = sc.Input[2]; SCInputRef Input_UseBoldFont = sc.Input[3]; SCInputRef Input_TextValue1 = sc.Input[4]; SCInputRef Input_TextValue2 = sc.Input[5]; SCInputRef Input_TextValue3 = sc.Input[6]; if (sc.SetDefaults) { sc.GraphName = "Custom Text Display"; Subgraph_TextDisplay.Name = "Text Display"; Subgraph_TextDisplay.DrawStyle = DRAWSTYLE_CUSTOM_TEXT; Subgraph_TextDisplay.PrimaryColor = RGB(0, 0, 0); // Black text Subgraph_TextDisplay.SecondaryColor = RGB(255, 255, 221); // Pale yellow (backup) Subgraph_TextDisplay.SecondaryColorUsed = false; // Disable secondary color Subgraph_TextDisplay.LineWidth = 12; // Font size Input_HorizontalPosition.Name = "Horizontal Position"; Input_HorizontalPosition.SetInt(50); // Default position Input_VerticalPosition.Name = "Vertical Position"; Input_VerticalPosition.SetInt(50); // Default position Input_TransparentLabelBackground.Name = "Transparent Background"; Input_TransparentLabelBackground.SetYesNo(true); // Default to transparent Input_UseBoldFont.Name = "Use Bold Font"; Input_UseBoldFont.SetYesNo(false); // Default to non-bold Input_TextValue1.Name = "Text Value 1"; Input_TextValue1.SetString("Value 1"); Input_TextValue2.Name = "Text Value 2"; Input_TextValue2.SetString("Value 2"); Input_TextValue3.Name = "Text Value 3"; Input_TextValue3.SetString("Value 3"); sc.AutoLoop = 0; return; } // Define transparent background flag int TransparentLabelBackground = Input_TransparentLabelBackground.GetYesNo(); // Retrieve text values from inputs SCString TextValue1 = Input_TextValue1.GetString(); SCString TextValue2 = Input_TextValue2.GetString(); SCString TextValue3 = Input_TextValue3.GetString(); // Combine text values for display SCString CombinedText; CombinedText.Format("%s\n%s\n%s", TextValue1.GetChars(), TextValue2.GetChars(), TextValue3.GetChars()); // Forcefully ensure secondary color is not used Subgraph_TextDisplay.SecondaryColorUsed = false; // Add and manage the text drawing with specified properties sc.AddAndManageSingleTextDrawingForStudy( sc, false, // Do not display in fill space Input_HorizontalPosition.GetInt(), Input_VerticalPosition.GetInt(), Subgraph_TextDisplay, TransparentLabelBackground, // Use transparency setting CombinedText, sc.DrawStudyUnderneathMainPriceGraph ? 0 : 1, // Draw below the main price graph Input_UseBoldFont.GetYesNo() // Use bold font if enabled ); // Ensure no solid green background when transparency is selected if (TransparentLabelBackground) { Subgraph_TextDisplay.PrimaryColor = RGB(0, 0, 0); // Default to black text Subgraph_TextDisplay.SecondaryColorUsed = false; // Reinforce disabling secondary color } // Restore scaling for the chart sc.ScaleRangeType = SCALE_SAMEASREGION; } Date Time Of Last Edit: 2025-01-06 15:40:07
|
![]() |
[2025-01-07 13:11:23] |
User92573 - Posts: 541 |
Thank you for helping with this. The issue seems to be when the study uses autoloop = 1 which I use for calculating the referenced studies. When the "Input_TransparentLabelBackground = true" the resolution is lost and when including study values in the data string I end up with a black block. Changing back to "Input_TransparentLabelBackground = false" recovers both the resolution and the study values? I've now programmed using "Tool.DrawingType = DRAWING_TEXT" and all works fine. Not sure why the above didn't. Many thanks. Date Time Of Last Edit: 2025-01-07 18:25:26
|
To post a message in this thread, you need to log in with your Sierra Chart account: