Displaying one curve and a specific point.
Moderator: DPlotAdmin
Displaying one curve and a specific point.
Do you have a small code snipplet (in C++) on how to draw an arrow that points on a spot (point) on a graph?
With the arrow, dotted lines that goes on the respective coordinates (X,Y) of that specefic point on the graph .
THX!
With the arrow, dotted lines that goes on the respective coordinates (X,Y) of that specefic point on the graph .
THX!
Here is some code but i get processing error [Activate(2)] and does not work at all i get a striaight line,instaed of a curve and the doted lines are supposed to be "square" on the axis'.
P.S. X array and Y array are valid
Code: Select all
memset(&dplot_,0,sizeof(dplot_));
dplot_.Version = DPLOT_DDE_VERSION;
dplot_.DataFormat = DATA_DXY;
dplot_.hwnd=(DWORD)GetDlgItem(hwnd_,id_);
dplot_.MaxCurves = 2; // Must be >= number of curves we plot
dplot_.MaxPoints = 2*calcul->GetNbPoints(); // Anything >= NP will do
dplot_.NumCurves = 2;
dplot_.Scale = SCALE_LINEARX_LINEARY;
dplot_.LegendX = 0;
dplot_.LegendY = 0;
dplot_.NP[0] = 3;
//legend stuff no problem there....
strcpy(dplot_.Title[0],info->name);
strcpy(dplot_.XAxis,info->unit);
strcpy(dplot_.YAxis,"Celscius");
sprintf(szExec,"[Color(2,255,0,0)][LineWidth(2,20)]");
dplot_.NP[1]= calcul->GetNbPoints();
dplot_.LineType[1] = LINESTYLE_SOLID;
for (int i=0;i<calcul->GetNbPoints();++i)
{
y[i+3]=tab[i].Y;
x[i+3]=calcul->GetX(i)*1000;
}
char guedille=34;
//guedille=34;
x[0] =2600;
y[0] = 0;
x[1] =2600;
y[1] = Value;
x[2]=0;
y[2]=Value;
strcat(szExec,"[Color(1,0,0,0)] [LineWidth(1,20)]");
dplot_.LineType[0] =LINESTYLE_DOTTED;
strcat(szExec,"[SelectCurve(1)][TextPointLabel(2,1000,50,0,0,8,");
strcat(szExec,"\"1500\"");
strcat(szExec,")]");
strcat(szExec,"[LegendParams(0.1,5,1");
if(CalculManager::GetInstance().IsLegendOpaqueShown())
strcat(szExec,",1)]");
else
strcat(szExec,",0)]");
strcat(szExec,"[ClearEditFlag()]");
Ok i have fixed the Activate(2) problem. I have a plot of 3 points.
it should give me a rectangle with the axis instead i have this:
aaa/--------------
aa/
a /
/
With this code:
it should give me a rectangle with the axis instead i have this:
aaa/--------------
aa/
a /
/
With this code:
Code: Select all
memset(&dplot_,0,sizeof(dplot_));
dplot_.Version = DPLOT_DDE_VERSION;
dplot_.DataFormat = DATA_DXY;
dplot_.hwnd=(DWORD)GetDlgItem(hwnd_,id_);
dplot_.MaxCurves = 1; // Must be >= number of curves we plot
dplot_.MaxPoints = 3;//2*calcul->GetNbPoints(); // Anything >= NP will do
dplot_.NumCurves = 1;
dplot_.Scale = SCALE_LINEARX_LINEARY;
dplot_.LegendX = 0;
dplot_.LegendY = 0;
dplot_.NP[0] = 3;
x[0] =2600.0;
y[0] = 0;
x[1] =2600.0;
y[1] = PPRTable->Value;
x[2]=2500;
y[2]=PPRTable->Value;
dplot_.LineType[0] =LINESTYLE_DOTTED;
sprintf(szExec,"[Color(1,0,255,0)]");
strcat(szExec,"[ClearEditFlag()]");
- DPlotAdmin
- Posts: 2312
- Joined: Tue Jun 24, 2003 9:34 pm
- Location: Vicksburg, Mississippi
- Contact:
"if i want a graph with my custom points do i need to use XY macro?"
I'm not sure I understand your question. If your points are not even spaced in X, use DataFormat = DATA_XYXY.
"Is there a way to to point out a specific point ,like put a dot on the curve and have (doted) lines that point to it's respective XY coordinates? "
Other than point labels, no - at least not easily. You can always duplicate the important points, placing them in a different curve with a different symbol/color/size.
I'm not sure I understand your question. If your points are not even spaced in X, use DataFormat = DATA_XYXY.
"Is there a way to to point out a specific point ,like put a dot on the curve and have (doted) lines that point to it's respective XY coordinates? "
Other than point labels, no - at least not easily. You can always duplicate the important points, placing them in a different curve with a different symbol/color/size.
Visualize Your Data
support@dplot.com
support@dplot.com
- DPlotAdmin
- Posts: 2312
- Joined: Tue Jun 24, 2003 9:34 pm
- Location: Vicksburg, Mississippi
- Contact:
If you're talking about dplotlib.dll... I'm working on it, and I do see the importance of this. For dplot.exe I don't, so much. I don't see much value in plotting more points than the 32-bit version will handle.
Visualize Your Data
support@dplot.com
support@dplot.com
Hi,
I add my question to this post because it looks quite similar.
I would like to add one dot on a specific point in a curve - just one.
The problem is that I always keep getting point (0,0) besides my defined point.
Do you have any suggestion on how to get rid of it?
I attach a piece of code.
Thanks!
Max
DPlot.Version = DPLOT_DDE_VERSION;
DPlot.DataFormat = DATA_XYXY;
DPlot.MaxCurves = 2;
DPlot.MaxPoints = NP;
DPlot.NumCurves = 2;
DPlot.Scale = SCALE_LINEARX_LINEARY;
DPlot.LegendX = 0.01f;
DPlot.LegendY = 0.02f;
DPlot.NP[0] = NP;
DPlot.NP[1] = 1;
DPlot.LineType[0] = LINESTYLE_SOLID;
DPlot.LineType[1] = LINESTYLE_NONE;
DPlot.SymbolType[0] = SYMBOLSTYLE_NONE;
DPlot.SymbolType[1] = SYMBOLSTYLE_ASTERISK;
//First curve
DocNum = dPlot_Plot8(&DPlot,x,y,"[DocMaximize()]""[ClearEditFlag()]");
DPlot_Command(DocNum, total_string);
DPlot_Command(DocNum,"[ManualScale(0,,27,,)][ClearEditFlag()]");
//just one point
x1[0]=5.0;
y1[0]=8;
ret = DPlot_AddData8(DocNum, DATA_XYXY, 1, 2, x1, y1);
I add my question to this post because it looks quite similar.
I would like to add one dot on a specific point in a curve - just one.
The problem is that I always keep getting point (0,0) besides my defined point.
Do you have any suggestion on how to get rid of it?
I attach a piece of code.
Thanks!
Max
DPlot.Version = DPLOT_DDE_VERSION;
DPlot.DataFormat = DATA_XYXY;
DPlot.MaxCurves = 2;
DPlot.MaxPoints = NP;
DPlot.NumCurves = 2;
DPlot.Scale = SCALE_LINEARX_LINEARY;
DPlot.LegendX = 0.01f;
DPlot.LegendY = 0.02f;
DPlot.NP[0] = NP;
DPlot.NP[1] = 1;
DPlot.LineType[0] = LINESTYLE_SOLID;
DPlot.LineType[1] = LINESTYLE_NONE;
DPlot.SymbolType[0] = SYMBOLSTYLE_NONE;
DPlot.SymbolType[1] = SYMBOLSTYLE_ASTERISK;
//First curve
DocNum = dPlot_Plot8(&DPlot,x,y,"[DocMaximize()]""[ClearEditFlag()]");
DPlot_Command(DocNum, total_string);
DPlot_Command(DocNum,"[ManualScale(0,,27,,)][ClearEditFlag()]");
//just one point
x1[0]=5.0;
y1[0]=8;
ret = DPlot_AddData8(DocNum, DATA_XYXY, 1, 2, x1, y1);
- DPlotAdmin
- Posts: 2312
- Joined: Tue Jun 24, 2003 9:34 pm
- Location: Vicksburg, Mississippi
- Contact:
Your initial call to dPlot_Plot8 has DPlot.NumCurves=2, but you don't have the 2nd "curve" to add yet. dPlot_Plot8 will add a curve with whatever values happen to be stored in your x and y arrays after the end of your first curve - in this case 0,0.
Set DPlot.NumCurves=1 and I think you'll get the expected results.
Set DPlot.NumCurves=1 and I think you'll get the expected results.
Visualize Your Data
support@dplot.com
support@dplot.com