mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-19 15:30:03 +02:00
Try to fix gantt diagram
This commit is contained in:
@@ -60,7 +60,7 @@ export const draw = function (text, id) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Set timescale
|
// Set timescale
|
||||||
const timeScale = d3.time.scale()
|
const timeScale = d3.scaleTime()
|
||||||
.domain([d3.min(taskArray, function (d) {
|
.domain([d3.min(taskArray, function (d) {
|
||||||
return d.startTime
|
return d.startTime
|
||||||
}),
|
}),
|
||||||
@@ -98,7 +98,7 @@ export const draw = function (text, id) {
|
|||||||
const topPadding = conf.topPadding
|
const topPadding = conf.topPadding
|
||||||
const leftPadding = conf.leftPadding
|
const leftPadding = conf.leftPadding
|
||||||
|
|
||||||
const colorScale = d3.scale.linear()
|
const colorScale = d3.scaleLinear()
|
||||||
.domain([0, categories.length])
|
.domain([0, categories.length])
|
||||||
.range(['#00B9FA', '#F95002'])
|
.range(['#00B9FA', '#F95002'])
|
||||||
.interpolate(d3.interpolateHcl)
|
.interpolate(d3.interpolateHcl)
|
||||||
@@ -300,20 +300,20 @@ export const draw = function (text, id) {
|
|||||||
}
|
}
|
||||||
formatter = pre.concat(mid).concat(post)
|
formatter = pre.concat(mid).concat(post)
|
||||||
|
|
||||||
let xAxis = d3.svg.axis()
|
// let xAxis = d3.svg.axis()
|
||||||
.scale(timeScale)
|
// .scale(timeScale)
|
||||||
.orient('bottom')
|
// .orient('bottom')
|
||||||
.tickSize(-h + theTopPad + conf.gridLineStartPadding, 0, 0)
|
// .tickSize(-h + theTopPad + conf.gridLineStartPadding, 0, 0)
|
||||||
.tickFormat(d3.time.format.multi(formatter))
|
// .tickFormat(d3.time.format.multi(formatter))
|
||||||
|
|
||||||
if (daysInChart > 7 && daysInChart < 230) {
|
// if (daysInChart > 7 && daysInChart < 230) {
|
||||||
xAxis = xAxis.ticks(d3.time.monday.range)
|
// xAxis = xAxis.ticks(d3.timeMonday.range)
|
||||||
}
|
// }
|
||||||
|
|
||||||
svg.append('g')
|
svg.append('g')
|
||||||
.attr('class', 'grid')
|
.attr('class', 'grid')
|
||||||
.attr('transform', 'translate(' + theSidePad + ', ' + (h - 50) + ')')
|
.attr('transform', 'translate(' + theSidePad + ', ' + (h - 50) + ')')
|
||||||
.call(xAxis)
|
// .call(xAxis) // todo: fix this instead of commentting out
|
||||||
.selectAll('text')
|
.selectAll('text')
|
||||||
.style('text-anchor', 'middle')
|
.style('text-anchor', 'middle')
|
||||||
.attr('fill', '#000')
|
.attr('fill', '#000')
|
||||||
|
Reference in New Issue
Block a user