mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-14 21:09:50 +02:00
Added support for millisecond and second to gantt tickInterval
This commit is contained in:
@@ -1048,7 +1048,7 @@ export interface GanttDiagramConfig extends BaseDiagramConfig {
|
|||||||
* Pattern is:
|
* Pattern is:
|
||||||
*
|
*
|
||||||
* ```javascript
|
* ```javascript
|
||||||
* /^([1-9][0-9]*)(minute|hour|day|week|month)$/
|
* /^([1-9][0-9]*)(millisecond|second|minute|hour|day|week|month)$/
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@@ -10,6 +10,8 @@ import {
|
|||||||
axisBottom,
|
axisBottom,
|
||||||
axisTop,
|
axisTop,
|
||||||
timeFormat,
|
timeFormat,
|
||||||
|
timeMillisecond,
|
||||||
|
timeSecond,
|
||||||
timeMinute,
|
timeMinute,
|
||||||
timeHour,
|
timeHour,
|
||||||
timeDay,
|
timeDay,
|
||||||
@@ -573,7 +575,7 @@ export const draw = function (text, id, version, diagObj) {
|
|||||||
.tickSize(-h + theTopPad + conf.gridLineStartPadding)
|
.tickSize(-h + theTopPad + conf.gridLineStartPadding)
|
||||||
.tickFormat(timeFormat(diagObj.db.getAxisFormat() || conf.axisFormat || '%Y-%m-%d'));
|
.tickFormat(timeFormat(diagObj.db.getAxisFormat() || conf.axisFormat || '%Y-%m-%d'));
|
||||||
|
|
||||||
const reTickInterval = /^([1-9]\d*)(minute|hour|day|week|month)$/;
|
const reTickInterval = /^([1-9]\d*)(millisecond|second|minute|hour|day|week|month)$/;
|
||||||
const resultTickInterval = reTickInterval.exec(
|
const resultTickInterval = reTickInterval.exec(
|
||||||
diagObj.db.getTickInterval() || conf.tickInterval
|
diagObj.db.getTickInterval() || conf.tickInterval
|
||||||
);
|
);
|
||||||
@@ -584,6 +586,12 @@ export const draw = function (text, id, version, diagObj) {
|
|||||||
const weekday = diagObj.db.getWeekday() || conf.weekday;
|
const weekday = diagObj.db.getWeekday() || conf.weekday;
|
||||||
|
|
||||||
switch (interval) {
|
switch (interval) {
|
||||||
|
case 'millisecond':
|
||||||
|
bottomXAxis.ticks(timeMillisecond.every(every));
|
||||||
|
break;
|
||||||
|
case 'second':
|
||||||
|
bottomXAxis.ticks(timeSecond.every(every));
|
||||||
|
break;
|
||||||
case 'minute':
|
case 'minute':
|
||||||
bottomXAxis.ticks(timeMinute.every(every));
|
bottomXAxis.ticks(timeMinute.every(every));
|
||||||
break;
|
break;
|
||||||
@@ -625,6 +633,12 @@ export const draw = function (text, id, version, diagObj) {
|
|||||||
const weekday = diagObj.db.getWeekday() || conf.weekday;
|
const weekday = diagObj.db.getWeekday() || conf.weekday;
|
||||||
|
|
||||||
switch (interval) {
|
switch (interval) {
|
||||||
|
case 'millisecond':
|
||||||
|
topXAxis.ticks(timeMillisecond.every(every));
|
||||||
|
break;
|
||||||
|
case 'second':
|
||||||
|
topXAxis.ticks(timeSecond.every(every));
|
||||||
|
break;
|
||||||
case 'minute':
|
case 'minute':
|
||||||
topXAxis.ticks(timeMinute.every(every));
|
topXAxis.ticks(timeMinute.every(every));
|
||||||
break;
|
break;
|
||||||
|
@@ -184,7 +184,7 @@ tickInterval 1day
|
|||||||
The pattern is:
|
The pattern is:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
/^([1-9][0-9]*)(minute|hour|day|week|month)$/;
|
/^([1-9][0-9]*)(millisecond|second|minute|hour|day|week|month)$/;
|
||||||
```
|
```
|
||||||
|
|
||||||
More info in: [https://github.com/d3/d3-time#interval_every](https://github.com/d3/d3-time#interval_every)
|
More info in: [https://github.com/d3/d3-time#interval_every](https://github.com/d3/d3-time#interval_every)
|
||||||
|
@@ -1524,10 +1524,10 @@ $defs: # JSON Schema definition (maybe we should move these to a seperate file)
|
|||||||
Pattern is:
|
Pattern is:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
/^([1-9][0-9]*)(minute|hour|day|week|month)$/
|
/^([1-9][0-9]*)(millisecond|second|minute|hour|day|week|month)$/
|
||||||
```
|
```
|
||||||
type: string
|
type: string
|
||||||
pattern: ^([1-9][0-9]*)(minute|hour|day|week|month)$
|
pattern: ^([1-9][0-9]*)(millisecond|second|minute|hour|day|week|month)$
|
||||||
topAxis:
|
topAxis:
|
||||||
description: |
|
description: |
|
||||||
When this flag is set, date labels will be added to the top of the chart
|
When this flag is set, date labels will be added to the top of the chart
|
||||||
|
Reference in New Issue
Block a user