react-vis icon indicating copy to clipboard operation
react-vis copied to clipboard

Tree Map is not working as expected

Open ankit6373 opened this issue 7 years ago • 4 comments

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:

FireShot Capture 050 - React App - localhost

ankit6373 avatar Apr 22 '19 08:04 ankit6373

Your styles import looks a little funny. Try import 'react-vis/dist/style.css';

iryhor avatar Apr 22 '19 20:04 iryhor

@iryhor It still did not work. Displaying the same thing again

ankit6373 avatar Apr 25 '19 12:04 ankit6373

Same.

barrymcgee avatar Jul 11 '19 15:07 barrymcgee

@iryhor I don't this it is style-related. Look at the console: image

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

aviadhahami avatar Aug 04 '19 14:08 aviadhahami