Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
409b671
New version.
agarny Nov 27, 2026
3d73508
Updated our dependencies.
agarny Nov 27, 2026
7dcaf2f
Plot: make all interaction reachable with a finger.
agarny Nov 27, 2026
9d8230d
Plot: open the range editor straight away from the context menu, so t…
agarny Nov 27, 2026
00e3fd6
Plot: let a tap then a drag move the hover tooltip, shown above the f…
agarny Nov 27, 2026
943cdb8
Plot: cancel a drag of an axis or a pinch that is released where it s…
agarny Nov 27, 2026
c3762d4
Plot: number the notes of processing a path level, and refill an over…
agarny Nov 27, 2026
843c42e
Plot: finish a pinch whose finger is released even when the plot isn'…
agarny Nov 27, 2026
c2916b6
Plot: cancel a pinch only if nothing in the plotting area has moved b…
agarny Nov 27, 2026
1a08aa3
Plot: let cancelling a pinch restore the ranges from when it started,…
agarny Nov 27, 2026
4c2772a
Plot: track the type of the pointer that moves over the plot, so that…
agarny Nov 27, 2026
6fd3fb3
Plot: stop the browser from taking over a pen on the plotting area wh…
agarny Nov 27, 2026
e2f37c7
Plot: document that a custom context menu mustn't move the keyboard f…
agarny Nov 27, 2026
8955a0b
Plot: ignore the context menu that the browser may request once a lon…
agarny Nov 27, 2026
9d6f282
Plot: cancel a long press of a legend item whose finger moves away be…
agarny Nov 27, 2026
af8b404
Plot: update the hover tooltip straight away at the end of a scrub, s…
agarny Nov 27, 2026
1eaa31a
Plot: label a context menu with its header, so that screen readers an…
agarny Nov 27, 2026
b463035
Plot: point the header's CSS comment at the right note.
agarny Nov 27, 2026
b8f74c4
Plot: ignore the context menu that follows any long press, but only s…
agarny Nov 27, 2026
dd77d62
Plot: stop a legend press whose pointer leaves the window, and only i…
agarny Nov 27, 2026
c0944eb
Plot: keep track of the trace of a pressed legend item using its key,…
agarny Nov 27, 2026
eeeaabf
Plot: replace the line breaks of a header with spaces in the demo's c…
agarny Nov 27, 2026
4c3d897
Plot: let a pen that the browser doesn't turn into touch events drag …
agarny Nov 27, 2026
f2a23bf
Plot: stop considering that a pen is used once it has left the plot, …
agarny Nov 27, 2026
508753f
Plot: leave the double-clicks of a pen that the browser doesn't turn …
agarny Nov 27, 2026
49403f0
Plot: stop the browser from scrolling the page while pinching, even u…
agarny Nov 27, 2026
157c0d6
Plot: let cancelling a pinch also undo the drag that it came from, un…
agarny Nov 27, 2026
598d5ca
Plot: let a finger that is held long enough straight after a tap zoom…
agarny Nov 27, 2026
0e46143
Plot: document that a custom context menu must prevent the default ac…
agarny Nov 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ The component is the default export of `@opencor/plot`, and is also exported as
| `PlotCsvExportFinishedEvent` | `{ type: 'finished'; success: boolean }` | An export to CSV has finished, whether successfully (and the file was downloaded) or not. |
| `PlotImageExportEvent` | `{ action: 'copy' \| 'export'; format: 'jpeg' \| 'png' \| 'svg' \| 'webp'; success: boolean }` | The payload of the [`imageExport`](#events) event: whether the plot was copied to the clipboard (always as PNG) or exported to an image file, in which format, and whether it worked. |
| `PlotContextMenuEvent` | `{ clientX: number; clientY: number; usingKeyboard: boolean; items: ContextMenuItem[] }` | The payload of the [`contextMenu`](#events) event: where the context menu was requested (in client coordinates), whether it was requested using the keyboard (in which case the custom menu should take the keyboard focus), and the items that our context menu would have shown. These items reflect the plot as it was when the context menu was requested and don't get updated if the data changes while the custom context menu is shown, but their commands always act on the plot as it is when they are chosen. |
| `ContextMenuItem` | `ContextMenuAction \| ContextMenuSeparator` | An item of a context menu. |
| `ContextMenuItem` | `ContextMenuAction \| ContextMenuSeparator \| ContextMenuHeader` | An item of a context menu. |
| `ContextMenuAction` | `{ label: string; icon?: IconName; checked?: boolean; command?: () => void; items?: ContextMenuItem[] }` | An action: its `label`, its `icon`, whether it is checked (only for a checkable action, e.g. to make an axis logarithmic), the `command` to call when it is chosen, and its submenu `items`, if any. |
| `ContextMenuSeparator` | `{ separator: true }` | A separator. |
| `ContextMenuHeader` | `{ header: string }` | A header that can't be chosen, e.g. the full name of a trace when the context menu is requested from its legend item. It can contain a little HTML (see [Data](#data)). |
| `IconName` | `'angle-right' \| 'arrows-h' \| 'arrows-v' \| 'chart-line' \| 'check' \| 'copy' \| 'download' \| 'eye' \| 'image' \| 'pencil' \| 'refresh' \| 'search-minus' \| 'search-plus'` | The name of an icon (from [PrimeIcons](https://primevue.org/icons/)). |
| `PlotPointCounts` | `{ nbOfPoints: number; nbOfDrawnPoints: number }` | The value returned by the [`pointCounts()`](#methods) method. |
| `PlotMemoryUsage` | `{ levelOfDetail: number; logValues: number }` | The value returned by the [`memoryUsage()`](#methods) method. |
Expand Down Expand Up @@ -142,7 +143,7 @@ Also set the [`live`](#props) prop while the data is live, so that the last poin
| Prop | Type | Default | Description |
|---|---|---|---|
| `data` | [`PlotData`](#types) | (required) | The data to plot. |
| `showLegend` | `boolean` | `true` | Whether to show the legend. The legend takes at most 40% of the width of the plot (with long trace names truncated, and shown in full when hovered), and is hidden if the plot is too narrow for it to be useful. |
| `showLegend` | `boolean` | `true` | Whether to show the legend. The legend takes at most 40% of the width of the plot (with long trace names truncated, and shown in full when hovered or in the context menu of their legend item), and is hidden if the plot is too narrow for it to be useful. |
| `theme` | [`PlotTheme`](#types) | `'system'` | Whether to use light or dark mode, or whatever the system uses. |
| `margins` | [`PlotMargins`](#types) | | Margins shared with other plots, so that their plotting areas line up (see [`marginsUpdated`](#events)). |
| `appendTo` | `HTMLElement \| string` | `body` | Where to append our overlays (context menu, hover tooltip, etc.). |
Expand All @@ -159,7 +160,7 @@ To draw traces without our level of detail, use `:levelOfDetail="false"`. Our pa
| `marginsUpdated` | [`PlotMargins`](#types) | The margins that the plot needs have changed. To line up several plots, pass the largest left and right margins of all of them to each plot's [`margins`](#props) prop. |
| `csvExport` | [`PlotCsvExportEvent`](#types) | An export to CSV has `'started'`, made `'progress'` (with a `percent`), or `'finished'` (with whether it was a `success`), so that its progress can be shown. |
| `imageExport` | [`PlotImageExportEvent`](#types) | The plot has been copied to the clipboard or exported to an image (or has failed to be), so that the user can be told about it. |
| `contextMenu` | [`PlotContextMenuEvent`](#types) | Only with [`customContextMenu`](#props): the context menu was requested at `clientX`/`clientY`, with the `items` that our context menu would have shown. If `usingKeyboard` is true, the custom menu should take the keyboard focus. |
| `contextMenu` | [`PlotContextMenuEvent`](#types) | Only with [`customContextMenu`](#props): the context menu was requested at `clientX`/`clientY`, with the `items` that our context menu would have shown. If `usingKeyboard` is true, the custom menu should take the keyboard focus. The custom menu should call the `command` of the chosen item while handling the click (or tap, or key press) that chose it, and it shouldn't move the keyboard focus afterwards (calling [`contextMenuHidden()`](#methods) instead), since some commands (e.g., to edit the range of an axis) give the keyboard focus to an editor that closes when it loses it, and iOS only shows its virtual keyboard for such an editor while handling a user interaction. If it calls that `command` while handling a key press (e.g., Enter or Space), it should also prevent that key's default action (using `preventDefault()`), since the key would otherwise also be typed into such an editor, replacing its selected value. |

### Methods

Expand All @@ -168,7 +169,7 @@ Available through a template ref:
| Method | Description |
|---|---|
| `resetMargins()` | Emit [`marginsUpdated`](#events) again, e.g. after the shared margins have been reset. |
| `contextMenuHidden()` | Tell the plot that a custom context menu (see [`contextMenu`](#events)) has been hidden, so that it can get the keyboard focus back. |
| `contextMenuHidden()` | Tell the plot that a custom context menu (see [`contextMenu`](#events)) has been hidden, so that it can get the keyboard focus back (unless something else, e.g. an editor opened by the chosen item, has it). |
| `pointCounts()` | The number of points of the visible traces (`nbOfPoints`), and how many of them were last drawn (`nbOfDrawnPoints`), as a [`PlotPointCounts`](#types). Meant for testing and benchmarking. |
| `memoryUsage()` | The memory (in bytes) used by the component itself, not counting the data, as a [`PlotMemoryUsage`](#types): by its levels of detail (`levelOfDetail`) and by the logarithm of its values along logarithmic axes (`logValues`). Meant for testing and benchmarking. |

Expand All @@ -179,7 +180,7 @@ Like with [Plotly](https://plotly.com/javascript/):
- **Middle of an axis:** drag to pan along that axis, use the mouse wheel to zoom along it, and double-click to reset its zoom.
- **Ends of an axis and bottom corners:** drag to move an end of the axis, or click an end of the axis to type its value.
- **Legend:** click a trace to show or hide it, double-click it to only show that trace (or all the traces again), and hover it to highlight its trace. Its context menu (right-click, or Shift+F10 once it has the focus) can also show only that trace (or all the traces again), or show or hide it if it is the only trace.
- **Touch:** drag with one finger as with a mouse, or use two fingers to zoom and pan.
- **Touch** (or a pen): on the plotting area, swipe to scroll the page, use two fingers to zoom and pan, touch and hold, then drag to zoom (in browsers that don't turn a pen into touch events, e.g. Chrome on Windows, a pen doesn't scroll the page, but drags to zoom straight away, as a mouse does), and tap, then drag straight away to move the hover tooltip (which is shown above the finger). On the axes, drag with one finger as with a mouse. Tap and double-tap as you would click and double-click. Touch and hold, then release, to open the context menu (as with a right-click), including from a legend item. If a touchscreen is available, the axes can be dragged a bit further away from the plotting area, the ends of the axes are longer, and the legend items and context menu items are taller.
- **Keyboard** (once the plot has the focus): `+` and `−` to zoom in and out, `0` to reset the zoom, the arrow keys to pan, and Shift+F10 (or the context menu key) to open the context menu (e.g., to type the value of an end of an axis). Each legend item can also get the focus: Enter or Space shows or hides its trace, and Shift+F10 opens its context menu.
- **Escape**, or pressing another mouse button, cancels a drag.

Expand Down
Loading