TExportChartBubbles

TExportDrawingTExportChart → [...] → TExportChartBubbles

Description

TExportChartBubbles is the bubble chart class.

Please note that Excel has some problems reading ODS charts (it can read most features, but not all)! ODS charts are correctly displayed in Calc and XLSX charts are correctly displayed in Excel.

Properties

NameTypeDescription
FormTCustomExportChartFormForm of the chart (ecf2D, ecf3D).
Please see TExportChart for inherited properties.

Code snippet

This code generates a simple bubble chart:

procedure TForm1.BtnTestClick(Sender: TObject);
var
  xExport: TOExport;
  I, L: Integer;
  xTime: Double;
begin
  xExport := TOExport.Create;
  try
    with xExport.AddWorkSheet('Bubble chart') do begin
      AddRow.AddCellString('Market share study').SetFontSize(20);

      with AddRow do begin
        AddCellString('Number of products');
        AddCellString('Sales [€]');
        AddCellString('Market share [%]');

        AddCellString('');
        AddCellString('');
        with AddCellString('').AddChart(TExportChartBubbles, 0, 0, 500, 300) do
        with TExportChartBubbles(Drawing) do begin
          Title := 'Market share study';
          Fill.Color := clWhite;
          Border.Color := clBlue;
          Shadow.FillStyle := edfColor;
          Form := ecf3D;
          Legend := eclNone;//TRY DIFFERENT SETTINGS
          XAxis.Caption := 'Number of products';
          YAxis.Caption := 'Sales [€]';
          with AddData(1, Rows.Count, 1, 4) do begin//y-axis data
            XRange.SetRange(0, Rows.Count, 1, 4);//x-axis data
            ExtraRange1.SetRange(2, Rows.Count, 1, 4);//bubble size
            Border.FillStyle := edfNone;
            ShowLabels := False;
          end;
        end;
      end;

      with AddRow do begin
        AddCellNumber(7, 0);
        AddCellNumber(12000, 0);
        AddCellPercent(0.02, 0);
      end;
      with AddRow do begin
        AddCellNumber(14, 0);
        AddCellNumber(19000, 0);
        AddCellPercent(0.10, 0);
      end;
      with AddRow do begin
        AddCellNumber(25, 0);
        AddCellNumber(21000, 0);
        AddCellPercent(0.40, 0);
      end;
      with AddRow do begin
        AddCellNumber(31, 0);
        AddCellNumber(17000, 0);
        AddCellPercent(0.77, 0);
      end;
    end;

    xExport.SaveToFileWithDialog;
  finally
    xExport.Free;
  end;
end;
Categories