Skip to content
This repository was archived by the owner on Jul 29, 2019. It is now read-only.

Graph3d tooltip styling #2780

Merged
merged 5 commits into from
Mar 9, 2017
Merged

Conversation

p-a
Copy link
Contributor

@p-a p-a commented Feb 23, 2017

PR for issue #2769

Graph3D's option can now take a 'tooltipStyle' object with styling properties for 'content', 'line' and 'dot'.

@Tooa
Copy link
Contributor

Tooa commented Feb 23, 2017

Thanks for your pull request! The network module uses a class name network-tooltip in the tooltip code. See here. Is there any benefit providing the styling as option parameter instead of using a css based approach like in the network module?

@p-a
Copy link
Contributor Author

p-a commented Feb 24, 2017

Well, my first thought was to just replace all hard coded styling altogether with a class, but then I realised that none of the Graph3D examples loads the bundled css file and doing such as thing would break things. Therefore I aimed for a more backwards compatible solution.

But yes, for a new major version a better solution would be to introduce a graph3d-tooltip class.
I can of course submit a new PR for such a change.

Any chance that the current PR could be applied for a new minor release since it doesn't break things?

@Tooa
Copy link
Contributor

Tooa commented Feb 24, 2017

I see - good point. Then this approach is absolute fine for a minor/major version update. Let's keep it as it is and we include it in the next minor release.

I can of course submit a new PR for such a change.

I would love to see another pull request, which adds the same feature with the class thing. We are then able to merge this into our 5.0 branch.

@Tooa Tooa added this to the Minor Release v4.19 milestone Feb 24, 2017
@Tooa Tooa added the Graph3D label Feb 24, 2017
/**
* Merge fields from src to dst
*/
function mergeFields(src, dst, fields) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think something like this already exists in the utils here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!. Used the util's methods instead

document.getElementById('style').onchange = drawVisualization;
}
</script>
<script src="../googleAnalytics.js"></script>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know, we don't want googleAnalytics anymore (reference). Can you remove it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please remove the analytics.

Copy link
Contributor Author

@p-a p-a Feb 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this was probably due to me branching of master initially... But this file is now removed altogether.

showShadow: false,

// Option tooltip can be true, false, or a function returning a string with HTML contents
//tooltip: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove tooltip: true,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

@@ -0,0 +1,132 @@
<!doctype html>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example is basically just a copy of this one. Maybe it is better to adapt the other example for such a small change. What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so too. Feel free to adopt the existing example to your needs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. removed "my" example and altered the original a bit

<td>tooltipStyle</td>
<td>Object</td>
<td>{<br>
content&nbsp;:<br>{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need No-break spaces here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@p-a Better use a

 block here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

<td>tooltipStyle</td>
<td>Object</td>
<td>{<br>
content&nbsp;:<br>{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@p-a Better use a

 block here.

@@ -0,0 +1,132 @@
<!doctype html>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so too. Feel free to adopt the existing example to your needs.

document.getElementById('style').onchange = drawVisualization;
}
</script>
<script src="../googleAnalytics.js"></script>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please remove the analytics.

@@ -67,6 +67,29 @@ var DEFAULTS = {

style : Graph3d.STYLE.DOT,
tooltip : false,

tooltipStyle : {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tested it yet. Please make sure the existing tooltips are basically not changed, or we have to consider this as a breaking change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested all combos, if no tooltipStyle is provided the tooltips are not changed and are exactly as before.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mojoaxel changes ok?

Copy link
Contributor

@Tooa Tooa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me now. Thank you very much! I would love to see another pull request from you for the same feature with the class approach. We can then merge the latter appraoch in v5.0.

@yotamberk yotamberk merged commit a9e14d3 into visjs:develop Mar 9, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants