Using TAQChart purely by code lazarus / 55-TAChart ---------------------------------------------------------------------- MISV · 2016-08-16 10:47 I am trying to maintain compability with teechart/delphi/windows when using aqchar/lazarus/mac. One of the few things still nagging is that using the chart functionality. Here is my current constructor code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   F_HistoryChart := TChart.Create(pnl_HistoryChart);  F_HistoryChart.Parent := pnl_HistoryChart;  F_HistoryChart.Align := alClient;  F_HistoryChart.Color := clWindow;  F_HistoryChart.LeftAxis.Inverted := True;  F_HistoryChart.LeftAxis.Logarithmic := True;{$IFDEF mymsDELPHI}  F_HistoryChart.LeftAxis.Maximum := 1000;  F_HistoryChart.LeftAxis.Minimum := 1;  F_HistoryChart.LeftAxis.Automatic := False;  F_HistoryChart.DepthAxis.Automatic := False;  F_HistoryChart.DepthAxis.AutomaticMaximum := False;  F_HistoryChart.DepthAxis.AutomaticMinimum := False;  F_HistoryChart.DepthAxis.Maximum := 0.5;  F_HistoryChart.DepthAxis.Minimum := -0.5;  F_HistoryChart.DepthTopAxis.Automatic := False;  F_HistoryChart.DepthTopAxis.AutomaticMaximum := False;  F_HistoryChart.DepthTopAxis.AutomaticMinimum := False;  F_HistoryChart.DepthTopAxis.Maximum := 0.5;  F_HistoryChart.DepthTopAxis.Minimum := -0.5;  F_HistoryChart.RightAxis.Automatic := False;  F_HistoryChart.BackWall.Brush.Color := clWhite;  F_HistoryChart.BackWall.Brush.Style := bsClear;  F_HistoryChart.Zoom.Allow := False;  F_HistoryChart.Legend.LegendStyle := lsSeries;  F_HistoryChart.View3D := False;{$ENDIF}  F_HistoryChart.Foot.Text.Text := '';  F_HistoryChart.Foot.Visible := False;  //--  //  //--{$IFDEF mymsFPCDevTool}  F_HistoryChart_LinearAxisTransform := TLinearAxisTransform.Create(F_HistoryChart);  F_HistoryChart_LogarithmAxisTransform := TLogarithmAxisTransform.Create(F_HistoryChart);  if    (F_HistoryChart.LeftAxis <> nil)  then    begin      F_HistoryChart.LeftAxis.Transformations := TChartAxisTransformations.Create(nil);      if        (F_HistoryChart.LeftAxis.Transformations <> nil)      then        begin          if            (F_HistoryChart.LeftAxis.Transformations.List <> nil)          then          begin              F_HistoryChart.LeftAxis.Transformations.Lis t.Add(F_HistoryChart_LinearAxisTransform);              F_HistoryChart .LeftAxis.Transformations.List.Add(F_HistoryChart_LogarithmAxisTransfo rm);            end          ;        end      ;    end  ;  F_HistoryChart.Legend.Alignment := laBottomCenter;{$ENDIF}{$IFDEF mymsDELPHI}  F_HistoryChart.Legend.Alignment := laBottom;{$ENDIF}  Here is my current addxy code. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i       S := Sub_S + ' / ' + S;{$IFDEF mymsFPCDevTool}      S := 'runtime_' + msPhraseCleanAllow(S, CmsStandardCharsBase);{$ENDIF}      TmpSeries := nil;      if TmpSeries = nil then        begin          Crt_E := F_HistoryChart.SeriesCount - 1;          for Crt_I := 0 to Crt_E do        begin            TmpTitle := '';{$IFDEF mymsDELPHI}            TmpTitle := F_HistoryChart.Series[Crt_I].Title;{$ENDIF}{$IFDEF mymsFPCDevTool}            TmpTitle := F_HistoryChart.Series[Crt_I].Name;{$ENDIF}            if TmpTitle = S then              begin                TmpSeries := F_HistoryChart.Series[Crt_I];                Break;              end;          end;        end      ;      if TmpSeries = nil then        begin          TmpSeries := TLineSeries.Create(F_HistoryChart);        TLineSeries(TmpSeries).Pointer.Visible := True;{$IFDEF mymsDELPHI}        TmpSeries.Title := S;          TmpSeries.XValues.DateTime := True;          TmpSeries.ParentChart := F_HistoryChart;{$ENDIF}{$IFDEF mymsFPCDevTool}          TmpSeries.Name := S;          F_HistoryChart.AddSeries(TmpSeries);{$ENDIF}        end      ;      if Assigned(TmpSeries) then        begin{$IFDEF mymsFPCDevTool}          if TmpSeries is TLineSeries then            begin              TLineSeries(TmpSeries).AddXY(D, Sub_V);            end          ;{$ENDIF}{$IFDEF mymsDELPHI}          TmpSeries.AddXY(D, Sub_V);{$ENDIF}        end;    end;  Where D is a datetime variable and Sub_V is an Integer and S is a String The problem? Nothing is actually drawn on the chart. The x/y axises seem to have relevant labels so the data is in there (i.e. I can see y and x axis ranges mach input data) As a future improvement, the x datetime labels should probably have oher labels than a pure number, but I believe that can be solved. For now I am mos worried about I don't see any points in the chart. ---------------------------------------------------------------------- wp · 2016-08-16 14:51 I did not attempt to understand every detail in your code (what's that "S" about?) , but wrote a rather general run-time example - see attached demo. Just these comments: TAchart axes don't have a property "Logarithmic" - you need a LogAxisTransform for that. See demo.Axis range is frozen by setting its Range.Min, .Max, .UseMin and .UseMax values appropriately (or by using Chart.Extent.XMin, .XMax, .YMin, .YMax, .UseMin, .UseXMax, .UseYMin, .UseYMax).Don't add an AxisTransform to the Transformations list by calling List.Add but by "Axistransform.Transformations := Transformations".Like in Delphi, a TAChart series has a Title property to define the text for the legend. No need to use the Name for that.Series pointers are not shown by setting the Pointer.Visible to true but by series.ShowPointer (looks like a bug to me...). ---------------------------------------------------------------------- MISV · 2016-08-18 22:55 Thanks! I will check it all out now