| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. All rights reserved. | 2 * Copyright 2015 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style | 4 * Use of this source code is governed by a BSD-style |
| 5 * license that can be found in the LICENSE file or at | 5 * license that can be found in the LICENSE file or at |
| 6 * https://developers.google.com/open-source/licenses/bsd | 6 * https://developers.google.com/open-source/licenses/bsd |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 library charted.demo.treemap; | 9 library charted.demo.treemap; |
| 10 | 10 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 var treemap = root.select(host); | 52 var treemap = root.select(host); |
| 53 var div = treemap.append('div') | 53 var div = treemap.append('div') |
| 54 ..style('position', 'relative') | 54 ..style('position', 'relative') |
| 55 ..style('width', '${width}px') | 55 ..style('width', '${width}px') |
| 56 ..style('height', '${height}px'); | 56 ..style('height', '${height}px'); |
| 57 | 57 |
| 58 var node = div.selectAll(".node").data(nodes); | 58 var node = div.selectAll(".node").data(nodes); |
| 59 node.enter.append("div") | 59 node.enter.append("div") |
| 60 ..styleWithCallback('left', (d, i, e) => '${d.x}px') | 60 ..styleWithCallback('left', (d, i, e) => '${d.x}px') |
| 61 ..styleWithCallback('top', (d, i, e) => '${d.y}px') | 61 ..styleWithCallback('top', (d, i, e) => '${d.y}px') |
| 62 ..styleWithCallback('width', (d, i, e) => '${max(0, d.dx - 1)}px') | 62 ..styleWithCallback('width', (d, i, e) => '${max(0, (d.dx as int) - 1)}px'
) |
| 63 ..styleWithCallback('height', (d, i, e) => '${max(0, d.dy - 1)}px') | 63 ..styleWithCallback('height', (d, i, e) => '${max(0, (d.dy as int) - 1)}px
') |
| 64 ..styleWithCallback('background', (d, i, e) => d.children.isNotEmpty ? | 64 ..styleWithCallback('background', (d, i, e) => d.children.isNotEmpty ? |
| 65 theme.getColorForKey(d.label, ChartTheme.STATE_NORMAL) : null) | 65 theme.getColorForKey(d.label, ChartTheme.STATE_NORMAL) : null) |
| 66 ..textWithCallback((d, i, e) => d.children.isNotEmpty ? null : d.label) | 66 ..textWithCallback((d, i, e) => d.children.isNotEmpty ? null : d.label) |
| 67 ..classed('node'); | 67 ..classed('node'); |
| 68 | 68 |
| 69 } | 69 } |
| 70 _createTreeMap('.squarify', TreeMapLayout.TREEMAP_LAYOUT_SQUARIFY); | 70 _createTreeMap('.squarify', TreeMapLayout.TREEMAP_LAYOUT_SQUARIFY); |
| 71 _createTreeMap('.slice', TreeMapLayout.TREEMAP_LAYOUT_SLICE); | 71 _createTreeMap('.slice', TreeMapLayout.TREEMAP_LAYOUT_SLICE); |
| 72 _createTreeMap('.dice', TreeMapLayout.TREEMAP_LAYOUT_DICE); | 72 _createTreeMap('.dice', TreeMapLayout.TREEMAP_LAYOUT_DICE); |
| 73 _createTreeMap('.slicedice', TreeMapLayout.TREEMAP_LAYOUT_SLICE_DICE); | 73 _createTreeMap('.slicedice', TreeMapLayout.TREEMAP_LAYOUT_SLICE_DICE); |
| 74 } | 74 } |
| 75 | 75 |
| 76 | 76 |
| OLD | NEW |