Support Board
Date/Time: Sat, 08 Feb 2025 04:48:19 +0000
[Programming Help] - how to draw different text above each bar in chart region
View Count: 647
[2020-06-23 10:43:47] |
User104258 - Posts: 3 |
I want to add some information text for some bar index which meet some conditions. Those texts are different between each bars depending on the different condition. How can I do this? Is there example code for such similar functions? Thanks. I am failed to try subgraph text drawing (such as DisplayNameAndValue...), also not sure whether sc.Tool can do this. It's better have some example codes. |
[2020-06-23 16:29:18] |
Ackin - Posts: 1865 |
for example: scsf_UseToolExampleDrawingText40BarsBack studies.cpp ..... /ACS_source folder in the Sierra Chart program folder |
[2020-06-24 03:02:44] |
User104258 - Posts: 3 |
Thanks for you answer. I tried this, but only the last one can be shown on chart. Previous are all cleared. Can you help to figure out how to keep all historical information drawn on chart? I use autoloop mode in my code. Below is my code: if (sc.SetDefaults) { .... sc.AutoLoop = 1; //Automatic looping is enabled. sc.GraphRegion = 0; //Main chart region sc.DrawZeros= 0; return; } // draw it on windows s_UseTool Tool; int& UniqueLineNumber = sc.GetPersistentInt(1);//any random number. //Tool.Clear(); // Reset tool structure. Good practice but unnecessary in this case. Tool.ChartNumber = sc.ChartNumber; Tool.DrawingType = DRAWING_TEXT; if (UniqueLineNumber != 0) Tool.LineNumber = UniqueLineNumber; Tool.BeginIndex = sc.Index; Tool.BeginValue = sc.High[sc.Index]; Tool.Color = RGB(255,255,0); Tool.AddMethod = UTAM_ADD_OR_ADJUST; //Tool.LineWidth = 5; //Tool.FontSize = 5; if (value < A) { Tool.Text.Format("less than A: %d", value); sc.UseTool(Tool); UniqueLineNumber = Tool.LineNumber; } else if(value > B) { Tool.Text.Format("bigger than B: %d", value); sc.UseTool(Tool); UniqueLineNumber = Tool.LineNumber; } ...... |
[2020-06-24 03:10:46] |
User104258 - Posts: 3 |
BTW, I use Tool.AddMethod = UTAM_ADD_ALWAYS;
All information can be kept on chart. Is this the correct way to solve this? I am concern that too many Tool on chart will affect the performance badly. If my concern is correct, is there better way to improve this? Thanks.
|
To post a message in this thread, you need to log in with your Sierra Chart account: