GithubHelp home page GithubHelp logo

Comments (11)

neuronetio avatar neuronetio commented on June 1, 2024 1

Can you give me some example code to work with? @Kendzi-x
I can't reproduce it

from gantt-schedule-timeline-calendar.

Kendzi-x avatar Kendzi-x commented on June 1, 2024 1

Thank you for a quick response!
For example we can take this example: https://github.com/neuronetio/gantt-schedule-timeline-calendar/blob/master/examples/simple/index.js
with this data:

const itemsFromDB = [
  {
    id: '1',
    label: 'Item 1',
    rowId: '1',
    time: {
      start: GSTC.api.date('2020-01-06').startOf('day').valueOf(),
      end: GSTC.api.date('2020-01-20').endOf('day').valueOf(),
    },
  },
  {
    id: '2',
    label: 'Item 2',
    rowId: '1',
    time: {
      start: GSTC.api.date('2020-01-06').startOf('day').valueOf(),
      end: GSTC.api.date('2020-01-09').endOf('day').valueOf(),
    },
  },
  {
    id: '3',
    label: 'Item 3',
    rowId: '1',
    time: {
      start: GSTC.api.date('2020-01-11').startOf('day').valueOf(),
      end: GSTC.api.date('2020-01-14').endOf('day').valueOf(),
    },
  },
  {
    id: '4',
    label: 'Item 4',
    rowId: '1',
    time: {
      start: GSTC.api.date('2020-01-11').startOf('day').valueOf(),
      end: GSTC.api.date('2020-01-14').endOf('day').valueOf(),
    },
  },
  {
    id: '5',
    label: 'Item 5',
    rowId: '1',
    time: {
      start: GSTC.api.date('2020-01-08').startOf('day').valueOf(),
      end: GSTC.api.date('2020-01-12').endOf('day').valueOf(),
    },
  },
  {
    id: '6',
    label: 'Item 6',
    rowId: '1',
    time: {
      start: GSTC.api.date('2020-01-08').startOf('day').valueOf(),
      end: GSTC.api.date('2020-01-12').endOf('day').valueOf(),
    },
  },
  {
    id: '7',
    label: 'Item 7',
    rowId: '1',
    time: {
      start: GSTC.api.date('2020-01-11').startOf('day').valueOf(),
      end: GSTC.api.date('2020-01-15').endOf('day').valueOf(),
    },
  },
];

As you can see on the right part of the screenshot, if item 2 present, then items 5 and 6 are on the same position
example

from gantt-schedule-timeline-calendar.

neuronetio avatar neuronetio commented on June 1, 2024 1

That is, Items will always be arranged in the way they were added to the configuration. No matter how you move them on the chart. So as you add them, in that order they will go lower and lower. If it is very important for you to have more control over how items are arranged, I can add some option to the configuration with a function that will arrange these items. Then you will be able to implement your own arrangement mechanism - I will show you what the standard mechanism looks like and you will be able to modify it according to your needs and add it to the configuration. It just has to be really needed - because each new configuration makes the code more difficult to maintain and may cause errors. So if you really need it, let me know - if not, let's leave it as is 🙂

from gantt-schedule-timeline-calendar.

neuronetio avatar neuronetio commented on June 1, 2024

fixed in 3.33.17

from gantt-schedule-timeline-calendar.

Kendzi-x avatar Kendzi-x commented on June 1, 2024

@neuronetio Unfortunately version 3.33.17 works not correct.
I faked the labels but it's the same bars (no changes in the code, just lib version upgrade)

Version 3.33.16
image

Version 3.33.17
image

from gantt-schedule-timeline-calendar.

neuronetio avatar neuronetio commented on June 1, 2024

in 3.34.1 it looks like this:

image

from gantt-schedule-timeline-calendar.

neuronetio avatar neuronetio commented on June 1, 2024

In version 3.34.2 I also added an improvement so that the order of items is preserved even after constantly moving them around the timeline.

from gantt-schedule-timeline-calendar.

Kendzi-x avatar Kendzi-x commented on June 1, 2024

@neuronetio Thank you, now everything is shown correctly.
But I have one question about moving: As I think if tasks have the same start date, then we should preserve their order. But if one task starts before another, then it should be higher. What do you think?
Here is the "complex-1" example with the version 3.34.2:
before mov
after mov

from gantt-schedule-timeline-calendar.

neuronetio avatar neuronetio commented on June 1, 2024

@Kendzi-x I think it will be better to leave the order according to the way of adding items - then the user will be able to sort them according to his own idea. Additionally, by having one way of arranging elements, the code is easier to maintain.

from gantt-schedule-timeline-calendar.

Kendzi-x avatar Kendzi-x commented on June 1, 2024

Ah, I see. Then we can sort items after moving/resizing as we want. Good!

from gantt-schedule-timeline-calendar.

Kendzi-x avatar Kendzi-x commented on June 1, 2024

Yep, I got it. In our case I update all items after resize/move, so it's not a big deal to sort them also.
So sure it's okay to leave it as it is:)

from gantt-schedule-timeline-calendar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.