google / google-visualization-issues

288 stars 35 forks source link

Org Chart display issue - lines fly away from nodes #2784

Open zhuohanl opened 4 years ago

zhuohanl commented 4 years ago

I am using google org chart (https://developers.google.com/chart/interactive/docs/gallery/orgchart) to convert my employee spreadsheet to organisation chart.

I have many nodes and lines. The chart displays well at the beginning but as I scroll to the right, lines and nodes are not displayed properly:

Screen Shot 2020-01-06 at 2 35 13 pm Screen Shot 2020-01-06 at 2 35 36 pm Screen Shot 2020-01-06 at 2 35 48 pm

data.csv:

heading1,heading2,heading3,heading4,heading5,heading6
value1_1,value2_1,value3_1,value4_1,value5_1,value6_1
value1_2,value2_2,value3_2,value4_2,value5_2,value6_2

My code:

<html>
  <head>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-csv/0.71/jquery.csv-0.71.min.js"></script>
    <script type="text/javascript">
      google.charts.load('current', {packages:["orgchart"]});
      google.charts.setOnLoadCallback(drawChart);

      function drawChart() {

        $.get("data.csv", function(csv) {
          var csv_data = $.csv.toObjects(csv);

          var data = new google.visualization.DataTable();
          data.addColumn('string', 'Name');
          data.addColumn('string', 'Manager');
          data.addColumn('string', 'ToolTip');

          csv_data.forEach(function(item){
            var value1 = item['heading1'].trim();
            var value2 = item['heading2'].trim();
            var value3 = item['heading3'].trim();
            var value4 = item['heading4'].trim();
            var value5 = item['heading5'].trim();
            var value6 = item['heading6'].trim();

            data.addRows([
              [{'v':value1, 'f':`${value1}<div style="color:blue; font-style:italic">${value2} ${value3}</div><div style="color:red; font-style:italic">${value4}</div><div style="color:green; font-style:italic">${value5}</div>`},
              value6, '']
              ]);
          })

          // Create the chart.
          var chart = new google.visualization.OrgChart(document.getElementById('chart_div'));
          // Draw the chart, setting the allowHtml option to true for the tooltips.
          chart.draw(data, {'allowHtml':true});

        })
      }
   </script>
  </head>
  <body>
    <div id="chart_div"></div>
  </body>
</html>

One possible reason is that I have too many nodes and lines. Things are working good at the first beginning. But when I scroll to the right and have more nodes and lines, lines start flying away from nodes.

Any ideas?

hustontrevor commented 2 years ago

MAJOR BUG

I am also seeing this issue (in Chrome). The issue starts with the nodes being slightly too far right. Later nodes and node lines to the far right or near the bottom of the OrgChart visualization end up totally lost.

Removing the divs and span in the formatted value does not prevent the issue.

Reproduced here with junk data https://jsfiddle.net/su47cwj2/

dlaliberte commented 2 years ago

Thanks for reporting this problem, and especially for creating a jsfiddle to repro the problem. I'll check whether this still exists in the development version, which includes some layout changes that might avoid this problem.

hustontrevor commented 2 years ago

great, thank you!!

zjacobs23 commented 1 year ago

@dlaliberte were you able to figure this out?

dlaliberte commented 1 year ago

Sorry, I haven't had time to address this.

zjacobs23 commented 1 year ago

@dlaliberte okay. Do you anticipate when you would be able to. This has been such a time saver for a project I have and this is the last piece of the puzzle. Your help thus far is much appreciated!

zjacobs23 commented 1 year ago

@dlaliberte Following up to see if you had any progress on this

dlaliberte commented 1 year ago

Sorry, not yet. But more people are needing a new release, so I will try to start the release process in the next couple weeks.

zjacobs23 commented 1 year ago

@dlaliberte just wanted to follow up and see if there was anything new to report on this?

dlaliberte commented 1 year ago

We are working towards making a new release, which includes a new algorithm for rendering orgcharts, as mentioned above. But we are currently blocked by conflicting bugs (some need it fixed, and some need it not fixed).

zjacobs23 commented 1 year ago

@dlaliberte Just a follow up to see if there was any movement on this new algorithm? Thanks again!

dlaliberte commented 1 year ago

The conflicting bugs have been resolved, so we can move forward with pushing out a release. I'll try to start that process this week. This will be available as an 'upcoming' version, and it will probably stay that way for a longer period of time since it has been a long time since the previous release, and there have been a moderately large number of internal refactorings.

zjacobs23 commented 1 year ago

@dlaliberte good to hear! Thanks so much for keeping me in the loop. I will touch base with you next week and see where we need to point to for the 'upcoming' version package

zjacobs23 commented 1 year ago

@dlaliberte Just following up again to see the update on the release?

dlaliberte commented 1 year ago

I have pushed out a test release which is rather awkward to use, in its current form, and if I remember correctly it should not be visible outside of google. The purpose of this test is just to do more of an internal smoke test before making an public 'upcoming' release.

The smoke testing did expose a problem regarding the charteditor, due to auto-refactoring changes that had been made over a year ago. So I had to figure out how to fix that problem, which I have done. So I'll try again with another smoke test release, and if that goes well, I can move ahead with the 'upcoming' release.

zjacobs23 commented 1 year ago

@dlaliberte if the smoke test passes do you envision the release to come out by end of this week? Thanks again for your help. THis is hugely helpful for my team and I

dlaliberte commented 1 year ago

Yes, if not other issues come up, I should be able to make the public 'upcoming' release this weekend.

zjacobs23 commented 1 year ago

@dlaliberte wanted to see if you were able to do this release? If so is there a new url I need to point our plugin to?

dlaliberte commented 1 year ago

The 'upcoming' release is available now. Please try it and let me know if it helps. See https://groups.google.com/g/google-visualization-api/c/Pju2Lryn55k/m/76rmRyiEFQAJ?utm_medium=email&utm_source=footer

zjacobs23 commented 1 year ago

@dlaliberte it fixed the original jsfiddle link but we added another complex hiearchy to here: https://jsfiddle.net/zjacobs23/62mqvsLr/ and its breaking again. If possible we have a potential for 20 layers deep in the parent child hierarchy. I appreciate your work on this. Not sure if that will help you. Let me know if you have any questions

zjacobs23 commented 1 year ago

@dlaliberte Let me know if I can send you another jsfiddle link for additional cases. Just wanted to see what your thoughts were on this.

dlaliberte commented 1 year ago

We have a fix for the general problem of generating tables with colspan greater than 1000, which was the case for these large org chart structures. This fix will be in the update of the 'upcoming' release, which I should be able to rollout this weekend. I'll probably extend the testing period for this release as well.

zjacobs23 commented 1 year ago

@dlaliberte Awesome. Thanks so much

zjacobs23 commented 1 year ago

@dlaliberte Thank you so much for fixing. This worked great! Your help was much appreciated. Is there somewhere I can submit how great you were to work with? I am so grateful you were able to get this done and all the time you spend on it

dlaliberte commented 1 year ago

Thanks. I'm glad it worked out for you. However, other than coordinating this work by another volunteer Googler, and pushing out the release, I had little to do with making this enhancement to the OrgChart or fixing the bug. I'll be sure to let him know his work is appreciated.

On Mon, Mar 13, 2023 at 12:41 PM zjacobs23 @.***> wrote:

@dlaliberte https://github.com/dlaliberte Thank you so much for fixing. This worked great! Your help was much appreciated. Is there somewhere I can submit how great you were to work with? I am so grateful you were able to get this done and all the time you spend on it

— Reply to this email directly, view it on GitHub https://github.com/google/google-visualization-issues/issues/2784#issuecomment-1466498747, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAELGDNHHXSJXJL6IDYWZKLW35E5LANCNFSM4KC7PQ4A . You are receiving this because you were mentioned.Message ID: @.***>

--

• Daniel LaLiberte

• SWE

• Cambridge MA

@. @.>