The polygon series allows users to specify arbitrary polygons in coordinates. This may seem un-useful, but it allows for easy creation of radar charts, fancy mark series dots, and any variety of additional things you might need polygons for!
<XYPlot
width={300}
height={300}>
<XAxis />
<YAxis />
<PolygonSeries
className="polygon-series-example"
data={myData}/>
</XYPlot>
Each series corresponds to exactly one svg path. It is perfectly okay to many series to express many polygons!
Like other series, it is required that the data be an array of objects, formatted like so:
const myData = [
{x: 0, y: 0},
{x: 1, y: 0},
{x: 0, y: 1}
]
Which would render a triangle.
Type: number
The x position in coordinates of the box to be used.
Type: number
The y position in coordinates of the box to be used.
See the XYPlot's animation
section for more information.
Type: string
Provide an additional class name for the series.
Type: string
The color for all elements in the series, this property will be over-ridden by color specified in the data attribute. See colors
Type: Array<Object>
Array of data for the series. See above data format reference.
Type: object
Paths accept a ton of different styles, so rather than prescribe every single one we just accept a general grab bag pf the styles. check out the w3 page for more details and the [style] documentation (style.md).
Type: function(value, {event, innerX, index})
A callback function which is triggered each time the mouse pointer moves. It can access the datapoint of the mark whose x position is the closest to that of the cursor.
Callback is triggered with two arguments. value
is the data point, info
object has following properties:
innerX
is the left position of the mark;index
is the index of the data point in the array of data;event
is the event object. See interaction
Type: function(value, {event, innerX, innerY, index})
A callback function which is triggered each time the mouse pointer moves. It can access the datapoint of the mark whose position is the closest to that of the cursor.
Callback is triggered with two arguments. value
is the data point, info
object has following properties:
innerX
is the left position of the mark;innerY
is the top position of the mark;index
is the index of the data point in the array of data;event
is the event object. See interaction
Type: function(d, {event})
click
event handler for the elements corresponding separate data points. First argument received is, d
, the relevant data point, and second an object with the only event
property. See interaction
Type: function(d, {event})
mouseout
event handler for the elements corresponding separate data points. First argument received is, d
, the relevant data point, and second an
Type: function(d, {event})
mouseover
event handler for the elements corresponding separate data points. First argument received is, d
, the relevant data point, and second an object with the only event
property. See interaction
object with the only event
property. See interaction
Type: function(d, {event})
right-click
event handler for the elements corresponding separate data points. First argument received is, d
, the relevant data point, and second an object with the only event
property. See interaction