Type class
Represents a relative value (percent).
The Percent object, can be instantiated using two ways:
- Via
new Percent(X)
. - Via
am4core.percent(X)
.
Percent
type objects can be used in a number of dual-measuring or positioning properties, like width
. E.g.:
chart.paddingRight = new Percent(10); // or chart.paddingRight = am4core.percent(10);
chart.paddingRight = new Percent(10); // or chart.paddingRight = am4core.percent(10);
{ // ... "paddingRight": "10%" }
Sources
Percent can be used (imported) via one of the following packages.
/** * -------------------------------------------------------- * Import from: "core.ts" * Use like: am4core.Percent * -------------------------------------------------------- */ import * as am4core from "@amcharts/amcharts4/core";
/** * -------------------------------------------------------- * Include via: <script src="core.js"></script> * Access items like: am4.Percent * -------------------------------------------------------- */
Inheritance
Percent does not extend any other symbol.
Percent is not extended by any other symbol.
Properties
percent # |
Type Value in percent. |
---|---|
value # |
Type Relative value. E.g. 100% is 1, 50% is 0.5, etc. This is useful to apply transformations to other values. E.g.: let value = 256; let percent = new am4core.Percent(50); console.log(value * percent.value); // outputs 128 var value = 256; var percent = new am4core.Percent(50); console.log(value * percent.value); // outputs 128 Alternatively, you can use let value = 256; let percent = am4core.percent(50); console.log(value * percent.value); // outputs 128 var value = 256; var percent = am4core.percent(50); console.log(value * percent.value); // outputs 128 @readonly |
Methods
constructor( percent: ) |
Returns Constructor. |
---|---|
toString() |
Returns |
Events
Percent does not have any events.
Adapters
Percent does not have any adapters.