mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
-- Replaced '-' and 'Array' with 'Object' where appropriate
-- Removed unnecessary options from bar chart options
This commit is contained in:
parent
61cef17f11
commit
768a3d1e9c
@ -110,7 +110,7 @@ responsive | Boolean | true | Resizes when the canvas container does.
|
||||
responsiveAnimationDuration | Number | 0 | Duration in milliseconds it takes to animate to new size after a resize event.
|
||||
maintainAspectRatio | Boolean | true | Maintain the original canvas aspect ratio `(width / height)` when resizing
|
||||
events | Array[String] | `["mousemove", "mouseout", "click", "touchstart", "touchmove", "touchend"]` | Events that the chart should listen to for tooltips and hovering
|
||||
hover |-|-|-
|
||||
hover |Object|-|-
|
||||
*hover*.onHover | Function | null | Called when any of the events fire. Called in the context of the chart and passed an array of active elements (bars, points, etc)
|
||||
*hover*.mode | String | 'single' | Sets which elements hover. Acceptable options are `'single'`, `'label'`, or `'dataset'`. `single` highlights the closest element. `label` highlights elements in all datasets at the same `X` value. `dataset` highlights the closest dataset.
|
||||
*hover*.animationDuration | Number | 400 | Duration in milliseconds it takes to animate hover style changes
|
||||
@ -144,7 +144,7 @@ display | Boolean | true | Is the legend displayed
|
||||
position | String | 'top' | Position of the legend. Options are 'top' or 'bottom'
|
||||
fullWidth | Boolean | true | Marks that this box should take the full width of the canvas (pushing down other boxes)
|
||||
onClick | Function | `function(event, legendItem) {}` | A callback that is called when a click is registered on top of a label item
|
||||
labels |-|-|-
|
||||
labels |Object|-|-
|
||||
*labels*.boxWidth | Number | 40 | Width of coloured box
|
||||
*labels*.fontSize | Number | 12 | Font size
|
||||
*labels*.fontStyle | String | "normal" |
|
||||
@ -177,7 +177,7 @@ caretSize | Number | 5 | Size, in px, of the tooltip arrow
|
||||
cornerRadius | Number | 6 | Radius of tooltip corner curves
|
||||
multiKeyBackground | Color | "#fff" | Color to draw behind the colored boxes when multiple items are in the tooltip
|
||||
| | |
|
||||
callbacks | - | - | V2.0 introduces callback functions as a replacement for the template engine in v1. The tooltip has the following callbacks for providing text. For all functions, 'this' will be the tooltip object create from the Chart.Tooltip constructor
|
||||
callbacks | Object | - | V2.0 introduces callback functions as a replacement for the template engine in v1. The tooltip has the following callbacks for providing text. For all functions, 'this' will be the tooltip object create from the Chart.Tooltip constructor
|
||||
**Callback Functions** | | | All functions are called with the same arguments
|
||||
xLabel | String or Array[Strings] | | This is the xDataValue for each item to be displayed in the tooltip
|
||||
yLabel | String or Array[Strings] | | This is the yDataValue for each item to be displayed in the tooltip
|
||||
@ -210,11 +210,11 @@ The global options for elements are defined in `Chart.defaults.global.elements`.
|
||||
|
||||
Name | Type | Default | Description
|
||||
--- |:---:| --- | ---
|
||||
arc | - | - | -
|
||||
arc | Object | - | -
|
||||
*arc*.backgroundColor | Color | `Chart.defaults.global.defaultColor` | Default fill color for arcs
|
||||
*arc*.borderColor | Color | "#fff" | Default stroke color for arcs
|
||||
*arc*.borderWidth | Number | 2 | Default stroke width for arcs
|
||||
line | - | - | -
|
||||
line | Object | - | -
|
||||
*line*.tension | Number | 0.4 | Default bezier curve tension. Set to `0` for no bezier curves.
|
||||
*line*.backgroundColor | Color | `Chart.defaults.global.defaultColor` | Default line fill color
|
||||
*line*.borderWidth | Number | 3 | Default line stroke width
|
||||
@ -224,7 +224,7 @@ line | - | - | -
|
||||
*line*.borderDashOffset | Number | 0.0 | Default line dash offset. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset)
|
||||
*line*.borderJoinStyle | String | 'miter' | Default line join style. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin)
|
||||
*line*.fill | Boolean | true |
|
||||
point | - | - | -
|
||||
point | Object | - | -
|
||||
*point*.radius | Number | 3 | Default point radius
|
||||
*point*.pointStyle | String | 'circle' | Default point style
|
||||
*point*.backgroundColor | Color | `Chart.defaults.global.defaultColor` | Default point fill color
|
||||
@ -233,7 +233,7 @@ point | - | - | -
|
||||
*point*.hitRadius | Number | 1 | Extra radius added to point radius for hit detection
|
||||
*point*.hoverRadius | Number | 4 | Default point radius when hovered
|
||||
*point*.hoverBorderWidth | Number | 1 | Default stroke width when hovered
|
||||
rectangle | - | - | -
|
||||
rectangle | Object | - | -
|
||||
*rectangle*.backgroundColor | Color | `Chart.defaults.global.defaultColor` | Default bar fill color
|
||||
*rectangle*.borderWidth | Number | 0 | Default bar stroke width
|
||||
*rectangle*.borderColor | Color | `Chart.defaults.global.defaultColor` | Default bar stroke color
|
||||
|
||||
@ -29,7 +29,7 @@ afterCalculateTickRotation | Function | undefined | Callback that runs after tic
|
||||
beforeFit | Function | undefined | Callback that runs before the scale fits to the canvas. Passed a single argument, the scale instance.
|
||||
afterFit | Function | undefined | Callback that runs after the scale fits to the canvas. Passed a single argument, the scale instance.
|
||||
afterUpdate | Function | undefined | Callback that runs at the end of the update process. Passed a single argument, the scale instance.
|
||||
**gridLines** | Array | - | Options for the grid lines that run perpendicular to the axis.
|
||||
**gridLines** | Object | - | Options for the grid lines that run perpendicular to the axis.
|
||||
*gridLines*.display | Boolean | true |
|
||||
*gridLines*.color | Color | "rgba(0, 0, 0, 0.1)" | Color of the grid lines.
|
||||
*gridLines*.lineWidth | Number | 1 | Stroke width of grid lines
|
||||
@ -39,14 +39,14 @@ afterUpdate | Function | undefined | Callback that runs at the end of the update
|
||||
*gridLines*.zeroLineWidth | Number | 1 | Stroke width of the grid line for the first index (index 0).
|
||||
*gridLines*.zeroLineColor | Color | "rgba(0, 0, 0, 0.25)" | Stroke color of the grid line for the first index (index 0).
|
||||
*gridLines*.offsetGridLines | Boolean | false | If true, offset labels from grid lines.
|
||||
**scaleLabel** | Array | | Title for the entire axis.
|
||||
**scaleLabel** | Object | | Title for the entire axis.
|
||||
*scaleLabel*.display | Boolean | false |
|
||||
*scaleLabel*.labelString | String | "" | The text for the title. (i.e. "# of People", "Response Choices")
|
||||
*scaleLabel*.fontColor | Color | "#666" | Font color for the scale title.
|
||||
*scaleLabel*.fontFamily| String | "Helvetica Neue" | Font family for the scale title, follows CSS font-family options.
|
||||
*scaleLabel*.fontSize | Number | 12 | Font size for the scale title.
|
||||
*scaleLabel*.fontStyle | String | "normal" | Font style for the scale title, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit).
|
||||
**ticks** | Array | | Settings for the labels that run along the axis.
|
||||
**ticks** | Object | | Settings for the labels that run along the axis.
|
||||
*ticks*.beginAtZero | Boolean | false | If true the scale will be begin at 0, if false the ticks will begin at your smallest data value.
|
||||
*ticks*.fontColor | Color | "#666" | Font color for the tick labels.
|
||||
*ticks*.fontFamily | String | "Helvetica Neue" | Font family for the tick labels, follows CSS font-family options.
|
||||
|
||||
@ -105,10 +105,10 @@ Name | Type | Default | Description
|
||||
showLines | Boolean | true | If false, the lines between points are not drawn
|
||||
stacked | Boolean | false | If true, lines stack on top of each other along the y axis.
|
||||
*hover*.mode | String | "label" | Label's hover mode. "label" is used since the x axis displays data by the index in the dataset.
|
||||
elements | - | - | -
|
||||
*elements*.point | - | - | -
|
||||
elements | Object | - | -
|
||||
*elements*.point | Object | - | -
|
||||
*elements.point*.radius | Number | `3` | Defines the size of the Point shape. Can be set to zero to skip rendering a point.
|
||||
scales | - | - | -
|
||||
scales | Object | - | -
|
||||
*scales*.xAxes | Array | `[{type:"category","id":"x-axis-0"}]` | Defines all of the x axes used in the chart. See the [scale documentation](#getting-started-scales) for details on the available options.
|
||||
*Options for xAxes* | | |
|
||||
type | String | "category" | As defined in ["Category"](#scales-category-scale).
|
||||
|
||||
@ -71,29 +71,22 @@ Name | Type | Default | Description
|
||||
--- |:---:| --- | ---
|
||||
stacked | Boolean | false |
|
||||
*hover*.mode | String | "label" | Label's hover mode. "label" is used since the x axis displays data by the index in the dataset.
|
||||
scales | Array | - | -
|
||||
scales | Object | - | -
|
||||
*scales*.xAxes | Array | | The bar chart officially supports only 1 x-axis but uses an array to keep the API consistent. Use a scatter chart if you need multiple x axes.
|
||||
*Options for xAxes* | | |
|
||||
type | String | "Category" | As defined in [Scales](#scales-category-scale).
|
||||
display | Boolean | true | If true, show the scale.
|
||||
position | String | "bottom" | Position of the scale. Options are "top" and "bottom" for dataset scales.
|
||||
id | String | "x-axis-1" | Id of the axis so that data can bind to it
|
||||
categoryPercentage | Number | 0.8 | Percent (0-1) of the available width (the space between the gridlines for small datasets) for each data-point to use for the bars. [Read More](#bar-chart-barpercentage-vs-categorypercentage)
|
||||
barPercentage | Number | 0.9 | Percent (0-1) of the available width each bar should be within the category percentage. 1.0 will take the whole category width and put the bars right next to each other. [Read More](#bar-chart-barpercentage-vs-categorypercentage)
|
||||
gridLines | Array | [See Scales](#scales) |
|
||||
gridLines | Object | [See Scales](#scales) |
|
||||
*gridLines*.offsetGridLines | Boolean | true | If true, the bars for a particular data point fall between the grid lines. If false, the grid line will go right down the middle of the bars.
|
||||
scaleLabel | Array | [See Scales](#scales) |
|
||||
ticks | Array | [See Scales](#scales) |
|
||||
| | |
|
||||
*scales*.yAxes | Array | `[{ type: "linear" }]` |
|
||||
*Options for xAxes* | | |
|
||||
type | String | "linear" | As defined in [Scales](#scales-linear-scale).
|
||||
display | Boolean | true | If true, show the scale.
|
||||
position | String | "left" | Position of the scale. Options are "left" and "right" for dataset scales.
|
||||
id | String | "y-axis-1" | Id of the axis so that data can bind to it.
|
||||
gridLines | Array | [See Scales](#scales) |
|
||||
scaleLabel | Array | [See Scales](#scales) |
|
||||
ticks | Array | [See Scales](#scales) |
|
||||
|
||||
You can override these for your `Chart` instance by passing a second argument into the `Bar` method as an object with the keys you want to override.
|
||||
|
||||
|
||||
@ -94,9 +94,9 @@ The default options for radar chart are defined in `Chart.defaults.radar`.
|
||||
|
||||
Name | Type | Default | Description
|
||||
--- | --- | --- | ---
|
||||
scale | Array | [See Scales](#scales) and [Defaults for Radial Linear Scale](#scales-radial-linear-scale) | Options for the one scale used on the chart. Use this to style the ticks, labels, and grid lines.
|
||||
scale | Object | [See Scales](#scales) and [Defaults for Radial Linear Scale](#scales-radial-linear-scale) | Options for the one scale used on the chart. Use this to style the ticks, labels, and grid lines.
|
||||
*scale*.type | String |"radialLinear" | As defined in ["Radial Linear"](#scales-radial-linear-scale).
|
||||
*elements*.line | Array | | Options for all line elements used on the chart, as defined in the global elements, duplicated here to show Radar chart specific defaults.
|
||||
*elements*.line | Object | | Options for all line elements used on the chart, as defined in the global elements, duplicated here to show Radar chart specific defaults.
|
||||
*elements.line*.tension | Number | 0 | Tension exhibited by lines when calculating splineCurve. Setting to 0 creates straight lines.
|
||||
|
||||
You can override these for your `Chart` instance by passing a second argument into the `Radar` method as an object with the keys you want to override.
|
||||
|
||||
@ -76,7 +76,7 @@ These are the customisation options specific to Polar Area charts. These options
|
||||
|
||||
Name | Type | Default | Description
|
||||
--- | --- | --- | ---
|
||||
scale | Array | [See Scales](#scales) and [Defaults for Radial Linear Scale](#scales-radial-linear-scale) | Options for the one scale used on the chart. Use this to style the ticks, labels, and grid.
|
||||
scale | Object | [See Scales](#scales) and [Defaults for Radial Linear Scale](#scales-radial-linear-scale) | Options for the one scale used on the chart. Use this to style the ticks, labels, and grid.
|
||||
*scale*.type | String |"radialLinear" | As defined in ["Radial Linear"](#scales-radial-linear-scale).
|
||||
*scale*.lineArc | Boolean | true | When true, lines are circular.
|
||||
animateRotate | Boolean |true | If true, will animate the rotation of the chart.
|
||||
|
||||
@ -90,7 +90,7 @@ Name | Type | Default | Description
|
||||
cutoutPercentage | Number | 50 - for doughnut, 0 - for pie | The percentage of the chart that is cut out of the middle.
|
||||
rotation | Number | -0.5 * Math.PI | Starting angle to draw arcs from
|
||||
circumference | Number | 2 * Math.PI | Sweep to allow arcs to cover
|
||||
scale | Array | [See Scales](#scales) and [Defaults for Radial Linear Scale](#scales-radial-linear-scale) | Options for the one scale used on the chart. Use this to style the ticks, labels, and grid.
|
||||
scale | Object | [See Scales](#scales) and [Defaults for Radial Linear Scale](#scales-radial-linear-scale) | Options for the one scale used on the chart. Use this to style the ticks, labels, and grid.
|
||||
*scale*.type | String |"radialLinear" | As defined in ["Radial Linear"](#scales-radial-linear-scale).
|
||||
*scale*.lineArc | Boolean | true | When true, lines are arced compared to straight when false.
|
||||
*animation*.animateRotate | Boolean |true | If true, will animate the rotation of the chart.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user