Ejemplo n.º 1
0
 public void createControl(Composite parent) {
   parent.setLayout(ExampleUtil.createMainLayout(2));
   dataSet = ExampleData.BROWSER_QUARTERLY_EUROPE;
   colors = Colors.cat10Colors(parent.getDisplay()).loop();
   createChartPart(parent);
   createControlPart(parent);
 }
Ejemplo n.º 2
0
  /**
   * 데이터베이스 통계 bar chart를 생성합니다.
   *
   * @param composite
   * @param listData
   */
  private void makeBarChart(Composite compositeCursor, List listData) {
    try {
      ColorStream colors = Colors.cat20Colors(compositeCursor.getDisplay()).loop();

      BarChart barChart = new BarChart(compositeCursor, SWT.NONE);
      GridLayout gl_grpConnectionInfo = new GridLayout(1, true);
      gl_grpConnectionInfo.verticalSpacing = 0;
      gl_grpConnectionInfo.horizontalSpacing = 0;
      gl_grpConnectionInfo.marginHeight = 0;
      gl_grpConnectionInfo.marginWidth = 0;
      barChart.setLayout(gl_grpConnectionInfo);
      barChart.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
      barChart.setBarWidth(10);

      for (Object element : listData) {
        Map<String, Object> retMap = (HashMap<String, Object>) element;

        ChartItem item = new ChartItem(barChart);
        item.setText(
            retMap.get("dbms_type")
                + " ("
                + retMap.get("tot")
                + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
        item.setColor(colors.next());

        float floatVal =
            Float.parseFloat("" + retMap.get("tot")) / 300; // $NON-NLS-1$ //$NON-NLS-2$
        item.setValue(floatVal);
      }

      barChart.layout();
      barChart.getParent().layout();
    } catch (Exception e) {
      logger.error("Get registered DB", e); // $NON-NLS-1$
    }
  }