Skip to content

Commit 560eae1

Browse files
Merge branch 'master' into feature/dx-177-remove-all-remaining-mentions-of-discord-from-the-docs
2 parents 46db075 + a248ff5 commit 560eae1

34 files changed

+1139
-265
lines changed

docs/data/charts/gauge/gauge.md

Lines changed: 48 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -9,64 +9,67 @@ waiAria: https://www.w3.org/WAI/ARIA/apg/patterns/meter/
99

1010
# Charts - Gauge
1111

12-
<p class="description">Gauge let the user evaluate metrics.</p>
12+
<p class="description">Use gauge charts to show a numeric value within a defined range as an arc or meter.</p>
1313

1414
{{"component": "@mui/docs/ComponentLinkHeader", "design": false}}
1515

16-
## Basics
16+
## Overview
17+
18+
A gauge shows a numeric value within a defined range, often as an arc or needle against a scale.
19+
Use it for metrics like progress, capacity, or levels (for example, battery, storage, or completion).
1720

18-
The Gauge displays a numeric value that varies within a defined range.
21+
The demo below shows basic gauge configurations.
1922

2023
{{"demo": "BasicGauges.js"}}
2124

22-
## Value range
25+
## Basics
2326

24-
The Gauge's value is provided through the `value` props, which accept a value range between 0 and 100.
25-
To modify it, use the `valueMin` and `valueMax` props.
27+
Pass the current value with the `value` prop.
28+
By default, the scale runs from 0 through 100.
29+
Use `valueMin` and `valueMax` to set a different range.
2630

2731
{{"demo": "GaugeValueRange.js"}}
2832

29-
## Arcs configuration
33+
## Arc configuration
3034

31-
Modify the arc shape with the following props:
35+
Use these props to change the arc shape:
3236

33-
- `startAngle` and `endAngle`: The angle range provided in degrees
34-
- `innerRadius` and `outerRadius`: The arc's radii. It can be a fixed number of pixels or a percentage string, which will be a percent of the maximal available radius
35-
- `cornerRadius`: It can be a fixed number of pixels or a percentage string, which will be a percent of the maximal available radius
37+
- `startAngle` and `endAngle`: angle range in degrees
38+
- `innerRadius` and `outerRadius`: arc radii, as a pixel value or a percentage string (such as `'50%'`)
39+
- `cornerRadius`: corner rounding, as a pixel value or percentage string
3640

37-
{{"demo": "ArcPlayground.js", "bg": "playground", "hideToolbar": true }}
41+
{{"demo": "ArcPlayground.js", "bg": "playground", "hideToolbar": true}}
3842

3943
:::success
40-
Notice that the arc position is computed to let the Gauge take as much space as possible in the drawing area.
44+
The arc is positioned to use as much of the drawing area as possible.
4145

42-
Use the `cx` and/or `cy` props to fix the coordinate of the arc center.
46+
Use the `cx` and `cy` props to fix the arc center.
4347
:::
4448

4549
## Text configuration
4650

47-
By default, the Gauge displays the value in the center of the arc.
48-
To modify it, use the `text` prop.
49-
50-
This prop can be a string, or a formatter.
51-
In the second case, the formatter argument contains the `value`, `valueMin` and `valueMax`.
51+
The gauge shows the value in the center of the arc by default.
52+
Use the `text` prop to customize the center text.
53+
Pass a string or a formatter function.
54+
The formatter receives an object with `value`, `valueMin`, and `valueMax`.
5255

53-
To modify the text's layout, use the `gaugeClasses.valueText` class name.
56+
Use the `gaugeClasses.valueText` class to change the text layout.
5457

5558
{{"demo": "TextPlayground.js", "bg": "playground", "hideToolbar": true}}
5659

5760
## Arc design
5861

59-
To customize the Gauge styles, use the `gaugeClasses` export to pull class names from different parts of the component, such as `valueText`, `valueArc`, and `referenceArc`.
62+
Use the `gaugeClasses` export for class names that target different parts of the gauge, such as `valueText`, `valueArc`, and `referenceArc`.
6063

61-
For a full reference list, visit the [API page](/x/api/charts/gauge/#classes).
64+
See [Gauge—Classes](/x/api/charts/gauge/#classes) for the full list.
6265

6366
{{"demo": "ArcDesign.js"}}
6467

6568
## Adding elements
6669

6770
### Using the default Gauge
6871

69-
To insert more elements into the Gauge, the first option would be to add them as children, which means they will be stacked on top of the default rendering.
72+
Add elements as children of `Gauge` to render them on top of the default arc and text.
7073

7174
```tsx
7275
import { Gauge } from '@mui/x-charts/Gauge';
@@ -78,11 +81,11 @@ import { Gauge } from '@mui/x-charts/Gauge';
7881

7982
### Using the Gauge container
8083

81-
The second option is to make use of the following elements that are available within the Gauge module:
84+
Use `GaugeContainer` and the following components when you need more control over the layout:
8285

83-
- Gauge Reference Arc
84-
- Gauge Value Arc
85-
- Gauge Value Text
86+
- `GaugeReferenceArc`: the reference arc
87+
- `GaugeValueArc`: the value arc
88+
- `GaugeValueText`: the text in the center
8689

8790
```tsx
8891
import {
@@ -99,33 +102,33 @@ import {
99102
</GaugeContainer>;
100103
```
101104

102-
### Creating your components
105+
### Creating custom components
103106

104-
To create your own components, use the `useGaugeState()` hook which provides all you need about the gauge configuration:
107+
Use the `useGaugeState()` hook to build custom gauge components.
108+
It returns:
105109

106-
- information about the value: `value`, `valueMin`, `valueMax`
107-
- information to plot the arc: `startAngle`, `endAngle`, `outerRadius`, `innerRadius`, `cornerRadius`, `cx`, and `cy`
108-
- computed values:
109-
- `maxRadius`: the maximal radius that can fit the drawing area
110-
- `valueAngle`: the angle associated with the current value
110+
- Value info: `value`, `valueMin`, `valueMax`
111+
- Arc geometry: `startAngle`, `endAngle`, `outerRadius`, `innerRadius`, `cornerRadius`, `cx`, `cy`
112+
- Computed: `maxRadius` (largest radius that fits the drawing area) and `valueAngle` (angle for the current value)
111113

112114
{{"demo": "CompositionExample.js"}}
113115

114116
## Accessibility
115117

116-
The MUI X Gauge is compliant with the [Meter ARIA pattern](https://www.w3.org/WAI/ARIA/apg/patterns/meter/), which includes the addition of the `meter` role to the parent container and correct usage of the `aria-valuenow`, `aria-valuemin`, and `aria-valuemax` attributes.
118+
The gauge follows the [Meter ARIA pattern](https://www.w3.org/WAI/ARIA/apg/patterns/meter/).
119+
The container has the `meter` role, and `aria-valuenow`, `aria-valuemin`, and `aria-valuemax` match the value range.
117120

118121
### Label
119122

120-
If a visible label is available, reference it by adding `aria-labelledby` attribute.
121-
Otherwise, the label can be manually provided by `aria-label`.
123+
If the gauge has a visible label, set `aria-labelledby` to point to it.
124+
Otherwise, provide a label with `aria-label`.
122125

123126
### Presentation
124127

125128
Assistive technologies often present the value as a percentage.
126-
This can be modified by providing `aria-valuetext` attribute.
129+
You can override this by setting the `aria-valuetext` attribute.
127130

128-
For example, a battery level indicator is better with an hour-long duration.
131+
For example, a battery level indicator is clearer when it announces a duration (such as hours remaining) instead of only a percentage.
129132

130133
```jsx
131134
<h3 id="battery_level_label">
@@ -141,15 +144,15 @@ For example, a battery level indicator is better with an hour-long duration.
141144

142145
## Composition
143146

144-
Use the `<GaugeContainer />` to provide all the parameters as props: `value`, `valueMin`, `valueMax`, `startAngle`, `endAngle`, etc.
147+
Use `GaugeContainer` to supply the gauge parameters: `value`, `valueMin`, `valueMax`, `startAngle`, `endAngle`, and so on.
145148

146-
In addition to the common chart components available for [composition](/x/react-charts/composition/), you can use the following components:
149+
In addition to the shared chart components available for [composition](/x/react-charts/composition/), you can use:
147150

148-
- `<GaugeReferenceArc />` renders the reference arc.
149-
- `<GaugeValueArc />` renders the value arc.
150-
- `<GaugeValueText />` renders the text at the center.
151+
- `GaugeReferenceArc`: the reference arc
152+
- `GaugeValueArc`: the value arc
153+
- `GaugeValueText`: the text in the center
151154

152-
Here's how the Gauge is composed:
155+
Here's how the gauge is composed:
153156

154157
```jsx
155158
<GaugeContainer>

docs/data/charts/heatmap/heatmap.md

Lines changed: 50 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,24 @@ components: Heatmap, HeatmapPlot, HeatmapTooltip, HeatmapTooltipContent, Heatmap
66

77
# Charts - Heatmap [<span class="plan-pro"></span>](/x/introduction/licensing/#pro-plan 'Pro plan')
88

9-
<p class="description">Heatmap charts visually represents data with color variations to highlight patterns and trends across two dimensions.</p>
9+
<p class="description">Use heatmap charts to show intensity as a grid of colored cells across two dimensions.</p>
1010

1111
## Overview
1212

13-
Heatmaps are ideal for visualizing intensity variations across two categorical or continuous dimensions. They highlight areas of high and low concentration in a dataset, making it easy to detect trends, clusters, or anomalies at a glance. Each cell in a heatmap represents the intersection of two variables, with color encoding used to convey the magnitude of a numerical value.
13+
A heatmap shows how a numeric value varies across two dimensions as a grid of colored cells.
14+
Each cell is the intersection of an x and y category or tick, and color encodes the value.
15+
16+
Use heatmaps to spot areas of higher or lower intensity, clusters, or anomalies.
17+
18+
The demo below shows bicycle counts in Paris by day and hour.
19+
1420
{{"demo": "HeatmapDemo.js", "disableAd": true, "defaultCodeOpen": false}}
1521

1622
## Basics
1723

18-
Heatmap charts series must contain a `data` property containing an array of 3-tuples.
19-
The first two numbers in each tuple correspond to the x and y indexes of the cell, respectively.
20-
The third number is the value for the given cell.
24+
A heatmap series must include a `data` property with an array of 3-tuples.
25+
Each tuple is `[xIndex, yIndex, value]`.
26+
The first two numbers are the cell's x and y indices, and the third is the cell value.
2127

2228
```jsx
2329
<Heatmap
@@ -32,92 +38,94 @@ The third number is the value for the given cell.
3238
/>
3339
```
3440

35-
You can specify x and y ticks with the `xAxis` and `yAxis` props.
41+
Use the `xAxis` and `yAxis` props to set x and y ticks.
3642

3743
{{"demo": "BasicHeatmap.js"}}
3844

3945
## Color mapping
4046

41-
To customize the color mapping, use the `zAxis` configuration.
42-
You can either use the piecewise or continuous [color mapping](https://mui.com/x/react-charts/styling/#value-based-colors).
47+
Use the `zAxis` configuration to customize how values map to color.
48+
You can use piecewise or continuous scales.
49+
See [Styling—Value-based colors](/x/react-charts/styling/#value-based-colors) for details.
4350

4451
{{"demo": "ColorConfig.js"}}
4552

4653
## Highlight
4754

48-
You can choose to highlight the hovered element by setting `highlightScope.highlight` to `'item'`.
49-
To fade the other item, set `highlightScope.fade` to `'global'`.
55+
Set `highlightScope.highlight` to `'item'` to highlight the hovered cell.
56+
Set `highlightScope.fade` to `'global'` to fade the other cells.
5057

5158
{{"demo": "HighlightHeatmap.js"}}
5259

53-
By default highlighted/faded effect is obtained by applying the CSS property `filter: saturate(...)` to cells.
54-
To modify this styling, use the `heatmapClasses.highlighted` and `heatmapClasses.faded` CSS classes to override the applied style.
60+
By default, the highlight and fade use the CSS `filter: saturate(...)` property.
61+
You can override the effect with the `heatmapClasses.highlighted` and `heatmapClasses.faded` classes.
5562

56-
In the following demo, we replace the highlight saturation by a border radius and reduce the saturation of the faded cells.
63+
The demo below uses border radius on the highlighted cell and reduced saturation for faded cells.
5764

5865
{{"demo": "HighlightClasses.js"}}
5966

60-
## Click event
67+
## Click events
6168

62-
Use `onItemClick` to know which cell is clicked by user.
69+
Use `onItemClick` to handle cell clicks.
6370

64-
The first argument is the click event.
65-
The second one is the item identifier.
66-
It contains the properties `xIndex` and `yIndex` that are the indexes of the clicked cell along the x- and y-axes respectively.
67-
68-
If this cell has associated data, the `dataIndex` property indicates the position of the cell's data within the series' `data` array.
71+
The handler receives the click event as the first argument and an item object as the second.
72+
The item includes `xIndex` and `yIndex` (cell position on the x- and y-axes) and, when the cell has data, `dataIndex` (index in the series `data` array).
6973

7074
{{"demo": "HeatmapCellClick.js"}}
7175

72-
## Common features
76+
## Shared features
7377

74-
The heatmap shares several features with other charts.
75-
This section only explains the details that are specific to the heatmap.
76-
If you'd like to learn more about the shared features, you can visit their dedicated pages.
78+
Heatmap charts use the same axis, tooltip, and legend patterns as other charts.
79+
This section notes heatmap-specific details.
80+
See the linked pages for full options.
7781

7882
### Axes
7983

80-
The Heatmap axes can be customized like any other chart axis.
81-
The available options are available in the [axis customization page](/x/react-charts/axis/#axis-customization).
84+
You can configure heatmap axes like other chart axes.
85+
See [Axis—Customization](/x/react-charts/axis/#axis-customization) for details.
8286

8387
### Tooltip
8488

85-
The Heatmap has an item tooltip that can be customized as described in the [Tooltip documentation page](/x/react-charts/tooltip/).
89+
The default heatmap tooltip is item-based.
90+
You can customize it with slots.
91+
See [Tooltip](/x/react-charts/tooltip/) for details.
8692

87-
The only difference of the Heatmap Tooltip is its default content.
88-
You can import the default tooltip, or only its content as follows:
93+
The heatmap package exports the default tooltip and its content if you want to reuse or extend them:
8994

9095
```js
91-
import { HeatmapTooltip, HeatmapTooltipContent } from '@mui/x-charts/Heatmap',
96+
import { HeatmapTooltip, HeatmapTooltipContent } from '@mui/x-charts/Heatmap';
9297
```
9398

9499
### Legend
95100

96-
The Heatmap comes with a legend which is by default the [ContinuousColorLegend](/x/react-charts/legend/#color-legend).
101+
The heatmap includes a [`ContinuousColorLegend`](/x/react-charts/legend/#color-legend) by default.
97102

98-
To display it set `hideLegend` to `false`.
99-
You can modify it with `slots.legend` and `slotProps.legend`.
103+
Set `hideLegend` to `true` to hide the legend.
104+
Customize it with `slots.legend` and `slotProps.legend`.
100105

101106
{{"demo": "HeatmapLegend.js"}}
102107

103-
## Custom item
108+
## Custom cells
109+
110+
Use the `cell` slot to replace the default cell shape or add labels.
104111

105112
{{"demo": "CustomItem.js"}}
106113

107-
## WebGL Renderer [<span class="plan-premium"></span>](/x/introduction/licensing/#premium-plan 'Premium plan')🧪
114+
## WebGL renderer [<span class="plan-premium"></span>](/x/introduction/licensing/#premium-plan 'Premium plan')🧪
108115

109116
:::info
110-
This feature is in preview. It is ready for production use, but its API, visuals and behavior may change in future minor or patch releases.
117+
This feature is in preview.
118+
It is ready for production use, but its API, visuals and behavior may change in future minor or patch releases.
111119
:::
112120

113-
Heatmaps can contain a large number of cells.
114-
To improve performance when rendering many cells, you can use the WebGL renderer by setting the `renderer` prop to `'webgl'`.
121+
Heatmaps can have many cells, which can slow down rendering.
122+
Set the `renderer` prop to `'webgl'` for better performance with large datasets.
115123

116-
The WebGL renderer has some limitations compared to the SVG renderer:
124+
The WebGL renderer has some limitations:
117125

118-
- The `cell` slot is not supported;
119-
- The heatmap cell cannot be customized using CSS;
126+
- The `cell` slot is not supported
127+
- You cannot style cells with CSS
120128

121-
The following example showcases a heatmap with approximately 8800 cells rendered using WebGL.
129+
The demo below shows roughly 8,800 cells rendered with WebGL.
122130

123131
{{"demo": "WebGLHeatmap.js"}}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import * as React from 'react';
2+
import Box from '@mui/material/Box';
3+
import { LineChart } from '@mui/x-charts/LineChart';
4+
5+
const data = {
6+
xAxis: [{ data: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }],
7+
series: [
8+
{
9+
data: [5, 8, 3, 7, 2, 9, 4, 6, 1, 5, 3],
10+
label: 'Series C',
11+
area: true,
12+
highlightScope: { highlight: 'series', fade: 'global' },
13+
},
14+
{
15+
data: [2, 5.5, 2, 8.5, 1.5, 5, 1, 4, 3, 8, 2],
16+
label: 'Series A',
17+
highlightScope: { highlight: 'series', fade: 'global' },
18+
},
19+
{
20+
data: [8, 2, 5, 1, 7, 3, 9, 2, 6, 3, 7],
21+
label: 'Series B',
22+
highlightScope: { highlight: 'series', fade: 'global' },
23+
},
24+
],
25+
};
26+
27+
export default function LinePointerInteraction() {
28+
return (
29+
<Box sx={{ width: '100%', height: 300 }}>
30+
<LineChart
31+
{...data}
32+
experimentalFeatures={{ enablePositionBasedPointerInteraction: true }}
33+
/>
34+
</Box>
35+
);
36+
}

0 commit comments

Comments
 (0)