How can I add text to the graphs control

Question:
I’m building some process control software and I need to addlabels, such as Upper Control Limit (UCL), into my chart.

Answer:
The graph control was added to PowerBuilder in v3.0 and Powersoft has not added any new features to this control since. The graph control was added to compete with other products at the time, and is still in the product just to offer backwards compatibility and simple graphing for people who want it. PowerBuilder’s market is not graphs and thus Powersoft cannot compete with the makers of good graph controls. Powersoft’s graph control is very simple and it is very difficult to do any really worthwhile graphs with it. The best solution is to buy an OCX control from a company that specializes in graphs and use that product inside of PowerBuilder for all your graphing needs. It is possible to “jazz up” PowerBuilder’s graphs slightly, such as by adding text as you have asked, but I would not recommend it. The text added to the graph is added at an absolute x,y coordinate position; thus, if the user resized the graph or printed the graph in landscape when you had designed it in portrait, the text would be a mess and no longer in the correct position. To add a text item you can either add a static text item (by editing the graph and selecting the text control, then placing the text on the graph), or you can dynamically add a text control using the modify statement. This is your best bet because you can use expressions for the x,y of the text item to reposition the text based on other values.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: