Changing position of legend - license

750 views
Skip to first unread message

Daniela

unread,
Jul 23, 2019, 9:12:52 AM7/23/19
to Google Visualization API
Hello guys,

I need to customize Chart Legend position to align it vertically.

I would like to ask you - is what is described here allowed by Google Charts license?

Jon Orwant

unread,
Jul 23, 2019, 10:05:26 AM7/23/19
to google-visua...@googlegroups.com
Yes.

Jon

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/586db069-3387-4ead-9819-3dfd1de7f041%40googlegroups.com.

Daniela

unread,
Jul 23, 2019, 10:13:37 AM7/23/19
to Google Visualization API
Thank you, Jon!

Just to be sure - I was asking about this part. Are we allowed to change the position of the elements, using their coordinates?

google.visualization.events.addListener(chartErrorDetails, 'ready', function () {
    var circles = container.getElementsByTagName('circle');
    var labels = container.getElementsByTagName('text');
    var labelIndex = -1;
    var fontSize;
    var radius;
    var xCoordCircle;
    var xCoordLabel;
    var yCoordLabel;
    var yCoordCircle;
    Array.prototype.forEach.call(labels, function(label) {
      if ((label.getAttribute('text-anchor') === 'start') && (label.getAttribute('fill') !== '#ffffff')) {
        labelIndex++;
        if (labelIndex === 0) {
          radius = parseFloat(circles[labelIndex].getAttribute('r'));
          xCoordCircle = circles[labelIndex].getAttribute('cx');
          xCoordLabel = label.getAttribute('x');
        } else {
          fontSize = parseFloat(label.getAttribute('font-size')) * labelIndex;
          yCoordLabel = parseFloat(label.getAttribute('y'));
          label.setAttribute('x', xCoordLabel);
          label.setAttribute('y', (yCoordLabel - fontSize - (radius * labelIndex)));
          yCoordCircle = parseFloat(circles[labelIndex].getAttribute('cy'));
          circles[labelIndex].setAttribute('cx', xCoordCircle);
          circles[labelIndex].setAttribute('cy', yCoordCircle - fontSize - (radius * labelIndex));
        }
      }
    });
  });


вторник, 23 юли 2019 г., 17:05:26 UTC+3, orw...@google.com написа:
Yes.

Jon

On Tue, Jul 23, 2019 at 9:13 AM Daniela <trying...@gmail.com> wrote:
Hello guys,

I need to customize Chart Legend position to align it vertically.

I would like to ask you - is what is described here allowed by Google Charts license?

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.

Daniel LaLiberte

unread,
Jul 23, 2019, 10:31:58 AM7/23/19
to Google Visualization API
You are *allowed* to do such things, in terms of license restrictions, but be aware that this is not a reliable practice in the long term.  We are allowed to change the implementation details such as the precise order and type of elements and associated attributes used in generating visualizations.  We are even allowed to change the API completely, though we try hard to only do that when necessary to resolve undesirable complications.

You may want to freeze the version you are using, rather than always using 'current', to avoid being exposed to such changes.   But even frozen versions may be forced to update (via redirection) if necessary.  So effectively, nothing is permanent.

Yes.

Jon

To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/9327ce80-c2ed-48cb-80cf-35b79a902907%40googlegroups.com.


--
Reply all
Reply to author
Forward
0 new messages