Speedometer.calcCenterPosition

Syntax

calcCenterPosition();

Description

The calcCenterPosition method calculates coordinates of speedometer center.

Example

To execute the example, the page must contain the Speedometer component named speed1 (see Example of Creating a Fuel Gauge Unit). Add a button clicking which displays speedometer parameters:

<input TYPE="button" VALUE=" OK " ONCLICK="AlertButton()">
<script>
function AlertButton()
{ 
	var pt = speed1.calcCenterPosition();
	var str = "Speedometer.calcCenterPosition() = X: " + String(pt.getX()) + " " + "Y: " + String(pt.getY()) + "\n";
	pt = speed1.calcOuterRadius();
	str += "Speedometer.calcOuterRadius() = X: " + String(pt.getX()) + " " + "Y: " + String(pt.getY()) + "\n";
	pt = speed1.getScales(0).calcCenterPosition();
	str += "GaugeScale.calcCenterPosition() = X: " + String(pt.getX()) + " " + "Y: " + String(pt.getY()) + "\n";
	pt = speed1.getScales(0).calcOuterRadius();
	str += "GaugeScale.calcOuterRadius() = X: " + String(pt.getX()) + " " + "Y: " + String(pt.getY()) + "\n";
	alert(str);
}
</script>

After clicking the OK button, coordinates of the scale center and external radius are shown as a list:

Speedometer.calcCenterPosition() = X: 100 Y: 180

Speedometer.calcOuterRadius() = X: 150 Y: 150

GaugeScale.calcCenterPosition() = X: 100 Y: 180

GaugeScale.calcOuterRadius() = X: 150 Y: 150

See also:

Speedometer