react-vis
react-vis copied to clipboard
Tree Map is not working as expected
I tried to create a new treemap but it is not loading as expected. See My Component code: ` import React, { Component } from 'react'; import {Treemap} from 'react-vis'; import '../node_modules/react-vis/dist/style.css';
class App extends Component {
state = {
data : {
"title": "analytics",
"color": "#12939A",
"children": [
{
"title": "cluster",
"children": [
{"title": "AgglomerativeCluster", "color": "#12939A", "size": 3938},
{"title": "CommunityStructure", "color": "#12939A", "size": 3812},
{"title": "HierarchicalCluster", "color": "#12939A", "size": 6714},
{"title": "MergeEdge", "color": "#12939A", "size": 743}
]
},
{
"title": "graph",
"children": [
{"title": "BetweennessCentrality", "color": "#12939A", "size": 3534},
{"title": "LinkDistance", "color": "#12939A", "size": 5731},
{"title": "MaxFlowMinCut", "color": "#12939A", "size": 7840},
{"title": "ShortestPaths", "color": "#12939A", "size": 5914},
{"title": "SpanningTree", "color": "#12939A", "size": 3416}
]
},
{
"title": "optimization",
"children": [
{"title": "AspectRatioBanker", "color": "#12939A", "size": 7074}
]
}
]
}
}
render() {
return (
<div className="">
<Treemap
title={'My New Treemap'}
width={1000}
height={700}
data={this.state.data}
/>
</div>
);
}
}
export default App;
` It is displaying this:

Your styles import looks a little funny. Try import 'react-vis/dist/style.css';
@iryhor It still did not work. Displaying the same thing again
Same.
@iryhor I don't this it is style-related. Look at the console:

We're missing some (x,y) somewhere...