almende / vis

⚠️ This project is not maintained anymore! Please go to https://github.com/visjs
7.85k stars 1.48k forks source link

render not in the center of the div #4173

Closed baisijian closed 5 years ago

baisijian commented 5 years ago

I use this div as container

<div ref="right" style={{ border: '1px solid lightgray', width:"300px",float: 'left', height:"300px"}}></div>

and render code is

var nodes = new vis.DataSet([
        {id: 1, label: 'Node 1'},
        {id: 2, label: 'Node 2'},
        {id: 3, label: 'Node 3'},
        {id: 4, label: 'Node 4'},
        {id: 5, label: 'Node 5'}
]);
// create an array with edges
var edges = new vis.DataSet([
        {from: 1, to: 3},
        {from: 1, to: 2},
        {from: 2, to: 4},
        {from: 2, to: 5}
]);
var data = {
        nodes: nodes,
        edges: edges
};
var options = {};
const {right} = this.refs;
this.$el = new vis.Network(right, data, options);

sometimes graph render in the center, sometimes render hide in the left corner.

mojoaxel commented 5 years ago

This issue tracker is not supposed to be used for questions on how to use visjs. It is intended to be used for bug reports and feature requests! In case you face yourself with a usage question, then post your question e.g. on stackoverflow tagged with "vis.js". Have you already used the github search, read the documentation and looked at the examples?

Please provide a minimal code example that demonstrates your issue. We recommend using jsbin for that.