getArrowById(id: String);
id. Pointer identifier. Optional parameter. If this parameter is not defined, the method returns the first found pointer.
The getArrowById method returns pointer by its identifier.
The method returns value of the PP.Ui.GaugeArrowBase type.
To execute the example, the page must contain the Speedometer component named speed1 (see Example of Creating a Fuel Gauge Unit).
Get scale pointer, set relative type of measuring pointer radius (length) and change radius value. Set border, change its style and redraw the speedometer. Get and show values of the following properties: ratio of speedometer pointer to speedometer radius, indication of pointer value validity, number of major tick marks for pointer scale, number of speedometer children, speedometer identifier, indication that speedometer transparency is used, number of fields in speedometer scale settings, number of speedometer child SVG elements, current timeline step, identifier of pointer dimension attribute:
// Get scale pointer var arrow = speed1.getArrowById(); // Set relative type of pointer length measurement arrow.setRadiusUnit(PP.Ui.Speedometer.SizeUnit.Relative); // Set new value of pointer length arrow.setRadius(0.007) // Set border speed1._Border = PP.Color.Colors.green; speed1._BorderWidth = 5; // Set border style speed1.setBorderStyle(PP.Ui.LineTypes.Dot) // Redraw the speedometer speed1.paint(); // Show ratio of speedometer pointer radius to speedometer radius console.log("Ratio of speedometer pointer to speedometer radius: " + arrow.getAutoResKoef()); // Show the result of validity check for pointer value console.log("Indication of arrow value validity: " + arrow.getIsValid()); // Show number of pointer scale major tick marks console.log("Number of pointer scale major tick marks: " + arrow.getScale().getMajorTicks().length); // Show number of speedometer children console.log("Number of speedometer children: " + speed1.getChildren().length); // Show speedometer ID console.log("Speedometer identifier: " + speed1.getInstance().getId()); // Show indication of transparency use console.log("Indication of opacity use: " + speed1.getOpacityEnabled()); // Show the number of scale settings fields console.log("Number of scale settings fields: " + speed1.getState().getMetadata().length); // Show the number of speedometer child SVG elements console.log("Number of speedometer child SVG elements: " + speed1.getSVGNode().childElementCount); // Show the current timeline step console.log("Current timeline step: " + speed1.getTimelineStep()); // Show identifier of pointer dimension attribute console.log("Identifier of pointer dimension attribute: " + arrow.getDimAttributeId());
After executing the example new value of pointer length is set and the border is shown:
The browser console shows values of the following properties: ratio of speedometer pointer to speedometer radius, indication of pointer value validity, number of major tick marks for pointer scale, number of speedometer children, speedometer identifier, indication that speedometer transparency is used, number of fields in speedometer scale settings, number of speedometer child SVG elements, current timeline step, and identifier of pointer dimension attribute:
Ratio of speedometer pointer to speedometer radius: 0.9333333333333333
Indication of pointer value validity: True
Number of pointer scale major tick marks: 6
Number of speedometer children: 4
Speedometer identifier: Speedometer262
Indication of transparency use: True
Number of scale settings fields: 82
Number of child SVG elements in the speedometer: 5
Current step of the timeline: 0
Identifier of pointer dimension attribute: attr1
See also: