ZoomControl and Series.TextLeft/TextRight.Text

Hi,

it's possible to hide Series.TextLeft.Text / TextRight:text in ZoomControl?

Thanks

Hi, 


You can hide it, but it will also be hidden in the main chart if you are using the same serie with serieType to both.
You will need to create a copy of the serie and use it only in the zoomcontrol, and set the TextLeft.Text and TextRight.Text to an empty string value.

Kind Regards, 
Pieter

Hi, 

a "dummy" series works (thanks), but there is a empty space in chart when series is used only for ZoomControl. When series visibility is set to False, the empty space disapear, but series are invisible in ZoomControl (logically).

I use "ctBar" series.

Any soulution?

Thanks, SaLIk.

Hi, 


You need to create 2 series, one for the zoomcontrol, and one for the normal view with the exact same properties.

If you have created the first serie for the normal view, you can assign the serie with:

AdvChartViewGDIP1.panes[0].Series.Add.Assign(AdvChartViewGDIP1.panes[0].Series[0]);

then change the serietype to zoomcontrol:

AdvChartViewGDIP1.panes[0].Series[1].SerieType := stZoomControl

 Hi,

i do it exactly same way but please look at the picture below:

 

SaLIk

Hi, 


You can solve this by implementing the OnGetCountChartType event and return 2 for the remaining visible series on the view.

procedure TForm1.AdvGDIPChartView1GetCountChartType(Sender: TObject;
  AChartType: TChartType; var ACount: Integer);
begin
  if AChartType = ctBar then
    ACount := 2;
end;

Kind Regards, 
Scheldeman Pieter

Hi,

no effect .. even if i don't check ChartType and simply use "ACount := 2"

btw: it's possible to set width of the bar?

SaLIk

Can you perhaps send us a sample so we can investigate here, the GetcountChartType approach is working here

as expected with our sample.

Kind Regards, 
Pieter

 Part of code:

var
  Pane: TAdvGDIPChartPane;
  Ser, SerZoom: TAdvGDIPChartSerie;
  I: Integer;  

ChartTMS.BeginUpdate;
try
  ChartTMS.Panes.Clear;
  
  Pane := ChartTMS.Panes.Add;
  Pane.HeightType := htAuto;
  Pane.Title.Text := 'title text';
  Pane.XAxis.Text := 'x axe text';
  
  //series in graph
  Ser := Graf.Series.Add;
  Ser.ChartType := ctBar;
  Ser.AutoRange := arEnabledZeroBased;
  Ser.YAxis.TextLeft.Text := 'text';
  Ser.YAxis.TextLeft.Angle := 90;
  Ser.YAxis.TextLeft.Position := ctCenter;    
  Ser.SerieType := stNormal; //charrt
  Ser.BorderWidth := 0;
  Ser.BorderColor := clNone;
  Ser.Color := clRed;
  Ser.ColorTo := clWhite;
  Ser.Opacity := 255;
  Ser.OpacityTo := 180;
  Ser.GradientType := gtSolid;  
  // --  
  ResultSet.First;
  I := 0;
  while (not ResultSet.Eof) do begin
    Ser.AddSingleXYPoint(
      I,
      ResultSet.FieldByName('data_field').AsFloat,
      ResultSet.FieldByName('label_field').AsString);
    // --
    I := I + 1;
    ResultSet.Next;
  end;  
  
  //series in zoomcontrol
  SerZoom := Graf.Series.Add;
  SerZoom.ChartType := ctBar;  
  SerZoom.AutoRange := arEnabledZeroBased;
  SerZoom.XAxis.Visible := False;
  SerZoom.YAxis.TextLeft.Text := 'text';
  SerZoom.YAxis.TextLeft.Angle := 90;
  SerZoom.YAxis.TextLeft.Position := ctCenter;    
  SerZoom.SerieType := stZoomControl; //zoom control
  SerZoom.BorderWidth := 0;
  SerZoom.BorderColor := clNone;
  SerZoom.Color := clRed;
  SerZoom.ColorTo := clWhite;
  SerZoom.Opacity := 255;
  SerZoom.OpacityTo := 180;
  SerZoom.GradientType := gtSolid;  
  // --  
  ResultSet.First;
  I := 0;
  while (not ResultSet.Eof) do begin
    SerZoom.AddSingleXYPoint(
      I,
      ResultSet.FieldByName('data_field').AsFloat,
      ResultSet.FieldByName('label_field').AsString);
    // --
    I := I + 1;
    ResultSet.Next;
  end;  
  
  
  //chart parameters
  Pane.AxisMode := amXAxisFullWidth;
  // --
  Pane.Title.Position := tTop;
  Pane.Title.Alignment := taCenter;
  Pane.Title.Font.Style := [fsBold];
  // --
  Pane.Background.Color := clWhite;
  Pane.Background.GradientType := gtSolid;
  // --
  Pane.XGrid.MajorLineStyle := psDot;
  Pane.XGrid.MinorLineStyle := psDot;
  Pane.XGrid.Visible := True;
  // --
  Pane.YGrid.MajorLineStyle := psDot;
  Pane.YGrid.MinorLineStyle := psDot;
  Pane.YGrid.Visible := True;
  // --
  Pane.XAxis.Position := xBottom;
  Pane.XAxis.AutoSize := True;
  // --
  Pane.YAxis.Position := yBoth;
  Pane.YAxis.AutoSize := True;  
  
                            
finally
  ChartTMS.EndUpdate;
end;


Graf = ChartTMS = TAdvGDIPChartPane

We have tested this here and have implemented the OnGetCountChartType. In your sample you are only adding 2 series which means that one is for the zoomcontrol and one for the main view, in the OnGetCountChartType you must return 1 for the bar chart. In your sample screenshot you show 3 series, 1 one for the zoomcontrol and 2 for the main view which means that the original code with OnGetcountChartType returning 2 was valid for the screenshot sample, but invalid for the sample code in your previous post. Included is a demo project that demonstrates this:


http://www.tmssoftware.net/public/Demo_3.zip

thanks for help - problem solved

i use GetCountChartType event for ctBar and ctLineBar charttypes simply like

if (AChartType = ctBar) then begin
ACount := 2;
end else if (AChartType = ctLineBar) then begin
ACount := 2;
end;


but when i have in chart only the "ctBar" series, variable "AChartType" also get "ctLineBar" value and then i set the wrong ACount

after correction:

 case SeriesTypeUsedInGraph of
 ctBar: begin
   if (AChartType = ctBar) then begin
      ACount := 2;
   end;
 end;
 ctLineBar: begin
    if (AChartType = ctLineBar) then begin
      ACount := 2;
    end;
 end;
end;


SaLIk