Hello friends,
i have a problem in my Gantt Chart. I would like to show the data from the actual date.
I tried min and max on the xAxis but this didn't work. I also tried a pointStart for the series( i only got 1 series) but this didn't work as well.
Here is my code:
Highcharts.setOptions({
lang:{
months:[
'January', 'February', 'March', 'April',
'May', 'June', 'July', 'August',
'September', 'October', 'November', 'December'
],
weekdays:[
'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'
]
}
});
{% if projekte %}
var chart = Highcharts.ganttChart('highcharts_container', {
time: {
useUTC: true
},
navigator: {
enabled: true,
},
rangeSelector: {
enabled: true,
selected: 5,
},
plotOptions: {
series:{
//showInNavigator: false,
cursor: 'pointer',
compare: 'percent',
pointStart: new Date().toUTCString(),
pointInterval: 24 * 3600 * 1000
/*
point:{
events:{
click: function(event){
//console.log(event);
//console.log(event.point.id)
var v = event.point.id
console.log(v)
var url_delete = "{% url 'service_roadmap_delete' 1 %}";
url_delete = url_delete.replace('1',v);
window.location.href = url_delete
},
}
}*/
},
animation: true,
dataLabels:{
enabled: true
}
},
column:{
grouping: false
},
title: {
text: 'Service Roadmap Projectstages Overview',
},
xAxis: {
uniqueNames: false,
labels: {
format: '{value}',
formatter: function() {
var format = this.dateTimeLabelFormat === 'Week %W' ? 'W%W' : this.dateTimeLabelFormat;
return Highcharts.dateFormat(format, this.value);
}
},
},
yAxis: {
uniqueNames: false
},
series: [{
tooltip: {
xDateFormat: '%a %d %b %y | Week %q'
},
data: [
{% for projekt in projekte %}
{
id: '{{ projekt.id }}',
name: "{{ projekt.projekt_nummer | safe }}|{{ projekt.maschinen_typ }} {{ projekt.kunde | safe }}",
pointWidth: 15,
collapsed: true
},
{% for project in project_stage %}
{% if project.stage_project.projekt_nummer == projekt.projekt_nummer %}
{
parent: '{{ projekt.id }}',
id: '{{ forloop.counter }} ',
name: '{{ project.auftrag_art }}',
start: {{ project.start_date|jsdate }},
end: {{ project.end_date|jsdate }}
},
{% endif %}
{% endfor %}
{% endfor %}
],
},
],
});
{% else %}
$(document).ready(function() {
$('#container').html("<h1>No Projects found!</h1>");
})
{% endif %}
/*$(document).ready(function() {
chart.xAxis[0].setExtremes(new Date().toUTCString());
})*/
The
/*$(document).ready(function() {
chart.xAxis[0].setExtremes(new Date().toUTCString());
function works for the date, but then highcharts isn't showing the data.
I would appreciate your comments !!
Best regards
Dominik