Thanks to visit codestin.com
Credit goes to github.com

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

Conversation

@ephraimberkovitch
Copy link
Contributor

In Graph3D 'dot-color' mode, an addition option has been added - to explicitly set the data point color:

Now the color may be set as a string representation of HTML color, like #ff00ff,
or calculated from a number, for example, distance from this point
The first option is useful when we have some pre-given legend, to which we have to adjust ourselves
The second option is useful when we are interested in automatically setting the color, from some value,
using some color scale

Copy link
Member

@yotamberk yotamberk left a comment

Choose a reason for hiding this comment

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

Nice! Thank you for this addition =)

@ephraimberkovitch
Copy link
Contributor Author

Thanks, I will be glad to contribute to the library also in the future :)

@ephraimberkovitch
Copy link
Contributor Author

Please, pay an attention to a new feature - onclick callback

var y = pow(random(), 2);
var z = pow(random(), 2);
var dist = sqrt(pow(x, 2) + pow(y, 2) + pow(z, 2));
var style;
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this is better written as:

var style = (i%2==0) ? sqrt(pow(x, 2) + pow(y, 2) + pow(z, 2)) : "#00ffff";

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

this.emit('cameraPositionChange', parameters);

util.preventDefault(event);
//event.stopPropagation();
Copy link
Member

Choose a reason for hiding this comment

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

we better do not include unused code

* @param {event} event The event
*/
Graph3d.prototype._onMouseUp = function (event) {
//this.moving = false;
Copy link
Member

Choose a reason for hiding this comment

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

we better do not include unused code

var mouseY = getMouseY(event) - boundingRect.top;
var dataPoint = this._dataPointFromXY(mouseX, mouseY);
this.onclick_callback(dataPoint.point.data);
}
Copy link
Member

Choose a reason for hiding this comment

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

please add the curly braces.

borderColor = point.point.value;
}
else {
var hue = (1 - (point.point.value - this.valueRange.min) * this.scale.value) * 240;
Copy link
Member

Choose a reason for hiding this comment

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

it looks like the ident is not correct here.

var ontouchstart = function (event) {me._onTouchStart(event);};
var onmousewheel = function (event) {me._onWheel(event);};
var ontooltip = function (event) {me._onTooltip(event);};
var onclick = function(event) {me._onClick(event);}
Copy link
Member

Choose a reason for hiding this comment

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

missing semicolon at the end of the line.

var graph = null;

function onclick(point) {
console.log(point);
Copy link
Member

Choose a reason for hiding this comment

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

sometimes point is null is you click outside the chart. This should be handled in the example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this case, it locates the closest point and returns it.

Copy link
Member

Choose a reason for hiding this comment

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

There seems to be a problem than:
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have fixed this issue - sorry for not noticing that case before

var graph = null;

function onclick(point) {
console.log(point);
Copy link
Member

Choose a reason for hiding this comment

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

There seems to be a problem than:
image

@yotamberk
Copy link
Member

@mojoaxel Can you review this again? The error has been solved



/**
* Get legend width
Copy link
Member

Choose a reason for hiding this comment

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

Just a comment for the next time: Please do not change code-style of other people. This messes up the "git blame".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, it was done automatically by my WebStorm, sorry for that

Copy link
Member

Choose a reason for hiding this comment

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

Absolutely no problem! I actually had the same problem with my last commit. :-)

var boundingRect = this.frame.getBoundingClientRect();
var mouseX = getMouseX(event) - boundingRect.left;
var mouseY = getMouseY(event) - boundingRect.top;
var dataPoint = this._dataPointFromXY(mouseX, mouseY);
Copy link
Member

Choose a reason for hiding this comment

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

As I said before. Please use curly brackets next time to improve readability and security.

@mojoaxel mojoaxel merged commit d9cdcb8 into visjs:develop Dec 31, 2016
@mojoaxel mojoaxel added this to the Minor Release v4.18 milestone Jan 14, 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.

3 participants