F2 supports two kinds of coordinates, Cartesian coordinate and polar coordinate. Cartesian coordinate is used by default.
Configuration
Cartesian Coordinate
// use Cartesian coordinatechart.coord('rect');// transpose coordinate, needed when drawing bar chart(horizontal)chart.coord({ transposed:true});chart.coord('rect', { transposed:true});
Polar Coordinate
// use polar coordinatechart.coord('polar');// more configurationschart.coord('polar', { transposed:true,// transpose coordinate startAngle: {Number},// starting angle endAngle: {Number},// ending angle innerRadius: {Number},// Inner ring radius, range of [0, 1] radius: {Number} // radius, range of [0, 1]});
Get Coordinate Instance
chart.get('coord')
The method will return the coordinate instance of current chart. Different coordinate types contain different properties.
Cartesian Coordinate
If it is a cartesian coordinate instance, it will contain the following properties:
Polar Coordinate
If it is a polar coordinate instance, it will contain the following properties:
The starting point of the coordinate in canvas, the origin of the coordinate in F2 chart is located in the lower left corner. The value is like { x: 10, y: 10 }
end
Object
The position of upper right corner of the coordinate system in canvas. The value is like { x: 100, y: 100 }
transposed
Boolean
Wether the coordinate is transposed, true means it is transposed.
isRect
Boolean
Indicating that it is a Cartesian coordinate.
Name
Type
Description
startAngle
Number
The starting angle of polar coordinate
endAngle
Number
The ending angle of polar coordinate
innerRadius
Number
The internal hollow radius when a ring is drawn, relative value, range of [0, 1]
radius
Number
The radius of the circle, relative value, range of [0, 1]
isPolar
Boolean
Wether it is a polar coordinate, true if it is
transposed
Boolean
Wether it is transposed, true means it is
center
Object
The canvas coordinates of the center of the polar coordinates