现有一公式,x=3×ch(6t)-4sh(2t),其中t为自变量,x为因变量,如何用chart图表来显示?还请高手指点,能否提供些现成的代码提示一下,没用过chart图表,感到很茫然。

解决方案 »

  1.   

    參考
    procedure TCellPlotFrame.Chart_CellPlotMouseDown(Sender: TObject;
      Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
    var
      HintStr: string;
      TmpRect: TRect;
      i, YAxis: Integer;
      TmpSeries: TCustomSeries;
      XValue, YValue: double;
    begin
      for i := 0 to FSeriesList.Count - 1 do
      begin
        TmpSeries := PTCellSeries(FSeriesList.Items[i])^.FCellSeries;
        with TmpSeries do
        begin
          { 判断曲线与竖线相交 }
          if (CalcXPosValue(MinXValue) > X) or (CalcXPosValue(MaxXValue) < X) then
            Continue;
          { 从小到大判断相交点 }
          for YAxis := Chart_CellPlot.ChartRect.Top to Chart_CellPlot.ChartRect.Bottom do
          begin
            if Clicked(X, YAxis) > -1 then
              HintStr := HintStr + Format('%s:%.1f ', [TmpSeries.Title, YScreenToValue(YAxis)]);
          end;
        end;
      end;  if HintStr <> '' then
      begin
        TmpRect := Rect(Mouse.CursorPos.X - Length(HintStr) * 6, Mouse.CursorPos.Y - 18,
          Mouse.CursorPos.X, Mouse.CursorPos.Y - 4);
        FHintWindow.ActivateHint(TmpRect, HintStr); {此处显示hint}
      end;
    end;
      

  2.   

    ch和sh是什么?把你的公式解释清楚