In the following example Weibull probabilities plot is built from "scratch" - without adding any series to chart at design time.
Uses MtxVec, MtxVecTee, StatSeries, Math387; var Data, XVec, YVec: Vector; x1,y1,x2,y2: double; begin Chart1.FreeAllSeries(nil); Chart1.AddSeries(TStatProbSeries.Create(Chart1)); // generate some random values for Data vec Data.Size(100); RandomWeibull(1.2,3,Data); // Random Weibull with a=1.2, b=3.0 StatWeibullPlot(Data,XVec,YVec,x1,x2,y1,y2,false); With TStatProbSeries(Chart1.Series[0]) do begin ProbSeriesType := stWeibullSeries; MinX := x1; MinY := y1; MaxX := x2; MaxY := y2; end; DrawValues(XVec,YVec,Chart1.Series[0]); end;
#include "MtxExpr.hpp" #include "Math387.hpp" #include "MtxVecTee.hpp" #include "StatSeries.hpp" void __fastcall WeibullPlot(); { sVector Data,XVec,YVec; double x1,y1,x2,y2; Chart1->FreeAllSeries(NULL); Chart1->AddSeries(new TStatProbSeries(Chart1)); // generate some random values for Data vec Data.Size(100,false); RandomWeibull(1.2, 3, Data); // Random Weibull with a=1.2, b=3.0 StatWeibullPlot(Data,XVec,YVec,x1,x2,y1,y2,false); TStatProbSeries *s = dynamic_cast<TStatProbSeries*> (Chart1->Series[0]); s->ProbSeriesType = stWeibullSeries; s->MinX = x1; s->MinY = y1; s->MaxX = x2; s->MaxY = y2; DrawValues(XVec,YVec,s,false); }
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
|