Skip to content

Documentation improvement and clarity#1862

Open
HJassar wants to merge 2 commits intovisjs:masterfrom
HJassar:Examples-and-Options-documentation-improvement
Open

Documentation improvement and clarity#1862
HJassar wants to merge 2 commits intovisjs:masterfrom
HJassar:Examples-and-Options-documentation-improvement

Conversation

@HJassar
Copy link

@HJassar HJassar commented May 4, 2025

Added clarifications and details to the documentation that reveal how to use the examples and summarizes the properties and selectors.

src="https://unpkg.com/vis-timeline@latest/standalone/umd/vis-timeline-graph2d.min.js"
></script>
```
````
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one tick to many

Comment on lines +96 to +106
## Options

| Property | Type | Default | Description | Examples and Demos |
| ----------- | ---------------------------------------------------------------------------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **STYLING** | | | |
| rtl | _boolean_ | false | Right-to-left option for rtl languages, e.g. Arabic. |
| orientation | _{axis:<br>"both"\|"bottom" \| "none" \| "top",<br>item: "top" \| "bottom"}_ | {axis:"bottom", item: "bottom"} | There are a number of orientation options for the time axis and the items. | [Example](https://github.com/visjs/vis-timeline/blob/master/examples/timeline/styling/axisOrientation.html) \| [Demo](https://visjs.github.io/vis-timeline/examples/timeline/styling/axisOrientation.html) |
| **EDITING** | | | |
| editable | _boolean \| {add: boolean, updateTime: boolean, updateGroup: boolean, remove: boolean }_ | false | An editable timeline allows to drag items around, create new items, and remove items. Changes are logged in the browser console. | |
| multiselect | _boolean_ | false | **Editable** option is required.<br><br>Allow selecting multiple items using ctrl+click, shift+click, or hold. |
| snap | _function(date: Date, scale: string, step: number) \| null_ | null | **Editable** option is required.<br><br>Snap function controls timeline item alignment:<br>- Returns modified Date object<br>- Called when items are moved<br>- Affects time unit snapping<br>- Set to _null_ to disable snapping | See [Snap Example](#snap-example) for implementation |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The options are already described in the docs and should not be part of the readme. Otherwise we have two places we need to maintain them.

Comment on lines +108 to +145
## Selectors

### Custom CSS

[Demo](https://visjs.github.io/vis-timeline/examples/timeline/styling/customCss.html) \| [Example](https://github.com/visjs/vis-timeline/blob/master/examples/timeline/styling/customCss.html)

The style of the Timeline can be fully customized via CSS.

![Custom CSS](docs/img/customCss.png)

Below are some of the selectors to customize the timeline.

```css
.vis-timeline {
}
.vis-item {
}

.vis-item.vis-line {
}
.vis-item.vis-dot {
}

.vis-item.vis-selected {
}

.vis-time-axis .vis-text {
}
.vis-time-axis .vis-text.vis-major {
}
.vis-time-axis .vis-text.vis-minor {
}

.vis-time-axis .vis-grid.vis-minor {
}
.vis-time-axis .vis-grid.vis-major {
}
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These selectors are already described here: https://visjs.github.io/vis-timeline/docs/timeline/#Styles

Feel free to extend the docs if necessary!

Comment on lines +146 to +158

You can use html snippets to embed images within items. Check content in the example below:

```javascript
var items = new vis.DataSet([
/* Other items */
{
start: new Date(2010, 7, 23, 23, 0, 0),
content:
'<div>Mail from boss</div><img src="../resources/img/mail-icon.png" style="width:32px; height:32px;">',
},
]);
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pleas extend the existing docs if neccessary: https://visjs.github.io/vis-timeline/docs/timeline/#Templates

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could add this image to the docs, but not here in the root folder!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants