public static void main(String[] args) { JFrame frame = new JFrame(); frame.setSize(400, 300); frame.setLocation(400, 300); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); JPanel content = new JPanel(); DendrogramPanel dp = new DendrogramPanel(); frame.setContentPane(content); content.setBackground(Color.red); content.setLayout(new BorderLayout()); content.add(dp, BorderLayout.CENTER); dp.setBackground(Color.WHITE); dp.setLineColor(Color.BLACK); dp.setScaleValueDecimals(0); dp.setScaleValueInterval(1); dp.setShowDistances(false); Cluster cluster = createSampleCluster(); dp.setModel(cluster); frame.setVisible(true); }
public void setModel(Cluster model) { this.model = model; component = createComponent(model); updateModelMetrics(); }
private ClusterComponent createComponent(Cluster model) { double virtualModelHeight = 1; VCoord initCoord = new VCoord(0, virtualModelHeight / 2); ClusterComponent comp = createComponent(model, initCoord, virtualModelHeight); comp.setLinkPoint(initCoord); return comp; }
private ClusterComponent createComponent(Cluster model) { double virtualModelHeight = 1; VCoord initCoord = new VCoord(0, virtualModelHeight / 2); ClusterComponent comp = createComponent(model, initCoord, virtualModelHeight); comp.setLinkPoint(initCoord); return comp; }
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setSize(400, 300); frame.setLocation(400, 300); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); JPanel content = new JPanel(); DendrogramPanel dp = new DendrogramPanel(); frame.setContentPane(content); content.setBackground(Color.red); content.setLayout(new BorderLayout()); content.add(dp, BorderLayout.CENTER); dp.setBackground(Color.WHITE); dp.setLineColor(Color.BLACK); dp.setScaleValueDecimals(0); dp.setScaleValueInterval(1); dp.setShowDistances(false); Cluster cluster = createSampleCluster(); dp.setModel(cluster); frame.setVisible(true); }
public void setModel(Cluster model) { this.model = model; component = createComponent(model); updateModelMetrics(); }
private ClusterComponent createComponent(Cluster model) { double virtualModelHeight = 1; VCoord initCoord = new VCoord(0, virtualModelHeight / 2); ClusterComponent comp = createComponent(model, initCoord, virtualModelHeight); comp.setLinkPoint(initCoord); return comp; }
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setSize(400, 300); frame.setLocation(400, 300); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); JPanel content = new JPanel(); DendrogramPanel dp = new DendrogramPanel(); frame.setContentPane(content); content.setBackground(Color.red); content.setLayout(new BorderLayout()); content.add(dp, BorderLayout.CENTER); dp.setBackground(Color.WHITE); dp.setLineColor(Color.BLACK); dp.setScaleValueDecimals(0); dp.setScaleValueInterval(1); dp.setShowDistances(false); Cluster cluster = createSampleCluster(); dp.setModel(cluster); frame.setVisible(true); }
public void setModel(Cluster model) { this.model = model; component = createComponent(model); updateModelMetrics(); }
private ClusterComponent createComponent(Cluster cluster, VCoord initCoord, double clusterHeight) { ClusterComponent comp = null; if (cluster != null) { comp = new ClusterComponent(cluster, cluster.isLeaf(), initCoord); double leafHeight = clusterHeight / cluster.countLeafs(); double yChild = initCoord.getY() - (clusterHeight / 2); double distance = cluster.getDistanceValue() == null ? 0 : cluster.getDistanceValue(); for (Cluster child : cluster.getChildren()) { int childLeafCount = child.countLeafs(); double childHeight = childLeafCount * leafHeight; double childDistance = child.getDistanceValue() == null ? 0 : child.getDistanceValue(); VCoord childInitCoord = new VCoord(initCoord.getX() + (distance - childDistance), yChild + childHeight / 2.0); yChild += childHeight; /* Traverse cluster node tree */ ClusterComponent childComp = createComponent(child, childInitCoord, childHeight); childComp.setLinkPoint(initCoord); comp.getChildren().add(childComp); } } return comp; }
private ClusterComponent createComponent(Cluster cluster, VCoord initCoord, double clusterHeight) { ClusterComponent comp = null; if (cluster != null) { comp = new ClusterComponent(cluster, cluster.isLeaf(), initCoord); double leafHeight = clusterHeight / cluster.countLeafs(); double yChild = initCoord.getY() - (clusterHeight / 2); double distance = cluster.getDistanceValue() == null ? 0 : cluster.getDistanceValue(); for (Cluster child : cluster.getChildren()) { int childLeafCount = child.countLeafs(); double childHeight = childLeafCount * leafHeight; double childDistance = child.getDistanceValue() == null ? 0 : child.getDistanceValue(); VCoord childInitCoord = new VCoord(initCoord.getX() + (distance - childDistance), yChild + childHeight / 2.0); yChild += childHeight; /* Traverse cluster node tree */ ClusterComponent childComp = createComponent(child, childInitCoord, childHeight); childComp.setLinkPoint(initCoord); comp.getChildren().add(childComp); } } return comp; }
private ClusterComponent createComponent(Cluster<T> cluster, VCoord initCoord, double clusterHeight) { ClusterComponent comp = null; if (cluster != null) { comp = new ClusterComponent(cluster, cluster.isLeaf(), initCoord); double leafHeight = clusterHeight / cluster.countLeafs(); double yChild = initCoord.getY() - (clusterHeight / 2); double distance = cluster.getDistance() == null ? 0 : cluster.getDistance(); for (Cluster<T> child : cluster.getChildren()) { int childLeafCount = child.countLeafs(); double childHeight = childLeafCount * leafHeight; double childDistance = child.getDistance() == null ? 0 : child.getDistance(); VCoord childInitCoord = new VCoord(initCoord.getX() + (distance - childDistance), yChild + childHeight / 2.0); yChild += childHeight; /* Traverse cluster node tree */ ClusterComponent childComp = createComponent(child, childInitCoord, childHeight); childComp.setLinkPoint(initCoord); comp.getChildren().add(childComp); } } return comp; }