PP.Ui.GaugeCenterLabel(settings);
settings. JSON object that contains values of class properties.
The GaugeCenterLabel constructor creates an instance of the GaugeCenterLabel class.
To execute the example, the page must contain the Speedometer component with the speedometer identifier (see Example of Creating a Speedometer with a Wizard). Create a new central speedometer label:
// Delete speedometer setup wizard master.setDataView(null); master.dispose(); // Get speedometer scale var scale = speedometer.getScales()[3]; // Get scale arrow by name var arrow = scale.getArrowByName("Arrow1")[0]; // Prohibit transparency use arrow.setOpacityEnabled(False); // Set arrow length arrow.setRadius(0.8); // Get format of values output in scale label var maskLabel = arrow.getScale().getMaskLabel(); // Get actual width and height of label var realWidth = speedometer.getCenterLabel().getRealWidth(); var realHeight = speedometer.getCenterLabel().getRealHeight(); // Create a central speedometer label var label = new PP.Ui.GaugeCenterLabel({ Width: realWidth, // Label width Height: realHeight, // Label height Arrow: arrow, // Scale arrow MaskLabel: maskLabel, // Format of values output in label Background: { // Label background fill brush '@PPType': 'PP.SolidColorBrush', '@Color': '#ffffff' }, Border: { // Label border '@PPType': 'PP.SolidColorBrush', '@Color': '#6B6B61' } }); // Set a new speedometer central label speedometer.setCenterLabel(label); // Set arrow value arrow.setValue(2); // Rerender label label.animate(speedometer, speedometer.getParent());
After executing the example a new central speedometer label is set:
See also: