erwan
Posts: 11
Joined: Fri Nov 27, 2020 7:26 am

Using setData instead of addPoint

Hi all,

We want to add many tasks on the same action.
Our script works well for one task usins addPoint.

Code: Select all

#
var series = chart.series[0],
    name = addTask,
    undef,
    y = 10
    )
    maxEnd = reduce(series.points, function (acc, point) {
        return point.y === y && point.end ? Math.max(acc, point.end) : acc;
    }
    , 0)
if (maxEnd === 0) {
    maxEnd = today;
}
#Add point
series.addPoint({
    start: addDateA,
    end: addDateB,
    user: '',
    affair: '',
    y: y,
    color: thecolor,
    name: addTask
});
We want first use setData for one. No error but the task is not created in the gantt:

Code: Select all

series.setData[{
    start: addDateA,
    end: addDateB,
    user: '',
    affair: '',
    y: y,
    color: thecolor,
    name: addTask
}];
Do you have an idea of the problem?
User avatar
sebastian.h
Posts: 1734
Joined: Fri Aug 07, 2020 7:08 am

Re: Using setData instead of addPoint

Hi erwan,
We appreciate you reaching out to us again.

It's hard to say without a working example, could you replicate your issue on an online code editor?

Here is a solution from documentation and is about adding points, have you seen?
https://www.highcharts.com/demo/gantt/interactive-gantt
We want to add many tasks on the same action.
Please explain more preciously, I don't get your point.

I'm waiting for news from you.
Best regards.
Sebastian Hajdus
Highcharts Developer

Return to “Highcharts Gantt”