热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

奇怪的Chart使用错误!

我在一个FORM上放了四个Chart控件,当改换点击一个菜单时,界面上根据需要画出最多四个图(动态的,有时只三个图),我现在已经完成对三个点击菜单动作的编程,但是当我轮换点击三个菜单时,会随机性
我在一个FORM上放了四个Chart控件, 当改换点击一个菜单时, 界面上根据需要画出最多四个图(动态的,有时只三个图),我现在已经完成对三个点击菜单动作的编程, 但是当我轮换点击三个菜单时,会随机性的出现错误信息"轴界限最大值Axis Maximum小于最小值Axis Minimum", 请注意是随机的,即有时有这个错误,有时没有, 有时是点击这个键(某四个组图)出问题,有时则是其它图出问题(有个规律是总出在Ch3上, 当屏蔽了Ch3时,又出现在Ch4上), 而我也检查了坐标轴最大最小值(程序中是axmax, axmin),不存在那种可能(axmax 太长发不完, 只附上一个菜单点击事件(某些语句精简了)并做了并行处理, 如果需要其它几个可以给我EMAIL:luchj@isu.edu

7 个解决方案

#1


程序下续:
void __fastcall TMainform::ViewP_plot2Click(TObject *Sender)
{   int i,j;
    double ax,ay,axmax,axmin,aymax,aymin;
    double tmp1[21],tmp2[21],tmp3[21],tmp4[21];
    Ch1->Left=Splitter->Left+Splitter->Width;
    Ch1->Top=Splitter->Top;
    Ch1->Height=Splitter->Height/2;
    Ch1->Width=(Mainform->ClientWidth-PControl->Width-Splitter->Width)/2;
    Ch2->Left  =Ch1->Left+Ch1->Width;
    Ch2->Top   =Ch1->Top;
    Ch2->Height=Ch1->Height;
    Ch2->Width =Mainform->ClientWidth-PControl->Width-Splitter->Width - Ch1->Width;
    Ch3->Left  =Ch1->Left;
    Ch3->Top   =Splitter->Height/2;
    Ch3->Height=Mainform->ClientHeight-Ch1->Height;
    Ch3->Width =Ch1->Width;
    Ch4->Left  =Ch2->Left;      Ch4->Top   =Ch3->Top;
    Ch4->Height=Ch3->Height;    Ch4->Width =Ch2->Width;
    Ch1->Visible=true;    Ch2->Visible=true;    Ch3->Visible=true;    Ch4->Visible=true;
    Ch1->FreeAllSeries();    Ch2->FreeAllSeries();    Ch3->FreeAllSeries();
    Ch4->FreeAllSeries();
    //此处略去对tmp1~tmp4的赋值;
    axmax=-1000000;    axmin= 1000000;    aymax=-1000000;    aymin= 1000000;
    for(j=0;j     {   axmax=max(axmax,tmp1[j]);        axmin=min(axmin,tmp1[j]);
        aymax=max(aymax,tmp2[j]);        aymin=min(aymin,tmp2[j]);
        axmax=max(axmax,tmp3[j]);        axmin=min(axmin,tmp3[j]);
        aymax=max(aymax,tmp4[j]);        aymin=min(aymin,tmp4[j]);
        axmax=max(axmax,XSTN[j]);        axmin=min(axmin,XSTN[j]);
        aymax=max(aymax,RSTN[j]);        aymin=min(aymin,RSTN[j]);
        axmax=max(axmax,XGCN[j]);        axmin=min(axmin,XGCN[j]);
        aymax=max(aymax,RGCN[j]);        aymin=min(aymin,RGCN[j]);
    }
    ax=axmax-axmin;    ay=aymax-aymin;
    axmax=axmax+ax*0.02;    axmin=axmin-ax*0.02;
    aymax=aymax+ay*0.10;    aymin=aymin-ay*0.02;
    Ch1->Title->Text->SetText("Blade Meridional Projection");
    Ch1->BottomAxis->Title->Caption="X(m)";
    Ch1->LeftAxis->Title->Caption ="R(m)";
    Ch1->LeftAxis->Maximum=aymax;
    Ch1->LeftAxis->Minimum=aymin;
    Ch1->BottomAxis->Maximum=axmax;
    Ch1->BottomAxis->Minimum=axmin;
    Ch1->Legend->Visible=true;
    Ch1->Legend->Color=clBtnFace;
    Ch1->Legend->ColorWidth = 40;
    Ch1->Legend->Frame->Visible = false;
    Ch1->Legend->HorizMargin = 2;
    Ch1->Legend->ResizeChart = false;
    Ch1->Legend->ShadowSize = 0;
    Ch1->Legend->TextStyle = ltsPlain;
    Ch1->Legend->TopPos = 14;
    Ch1->Legend->VertMargin = 2 ;
    s_1[0] = new TLineSeries(this);
    s_1[0]->Title = "LE";
    s_1[0]->VertAxis = aLeftAxis;
    s_1[0]->XValues->Order = loNone;
    s_1[0]->YValues->Order = loNone;
    s_1[0]->SeriesColor = clRed;                //线的颜色
    s_1[0]->Pointer->Brush->Color =clRed;   //标注的填充颜色
    s_1[0]->Pointer->InflateMargins = true;
    s_1[0]->Pointer->Pen->Color = clRed;      //标注的外圈颜色
    s_1[0]->Pointer->Style = psRectangle;
    s_1[0]->Pointer->HorizSize= 3;
    s_1[0]->Pointer->VertSize = 3;
    s_1[0]->Pointer->Visible = true;
    for(i=0;i     {   s_1[0]->AddXY(tmp1[i]+STACKX,tmp2[i],"",clRed);
    }
    s_1[1] = new TLineSeries(this);
    s_1[1]->Title = "STK";
    s_1[1]->VertAxis = aLeftAxis;
    s_1[1]->XValues->Order = loNone;
    s_1[1]->YValues->Order = loNone;
    s_1[1]->SeriesColor = clRed;
    s_1[1]->Pointer->Brush->Color = clBtnFace;
    s_1[1]->Pointer->InflateMargins = true;
    s_1[1]->Pointer->Pen->Color = clRed;
    s_1[1]->Pointer->Style = psCircle;
    s_1[1]->Pointer->HorizSize= 4;
    s_1[1]->Pointer->VertSize = 4;
    s_1[1]->Pointer->Visible = true;
    for(i=0;i     {   s_1[1]->AddXY(XSTN[i]+STACKX,RSTN[i],"",clRed);
    }
    s_1[2] = new TLineSeries(this);
    s_1[2]->Title = "CG";
    s_1[2]->VertAxis = aLeftAxis;
    s_1[2]->XValues->Order = loNone;
    s_1[2]->YValues->Order = loNone;
    s_1[2]->SeriesColor = clRed;                //线的颜色
    s_1[2]->Pointer->Brush->Color =clBtnFace;   //标注的填充颜色
    s_1[2]->Pointer->InflateMargins = true;
    s_1[2]->Pointer->Pen->Color = clRed;      //标注的外圈颜色
    s_1[2]->Pointer->Style = psRectangle;
    s_1[2]->Pointer->HorizSize= 3;
    s_1[2]->Pointer->VertSize = 3;
    s_1[2]->Pointer->Visible = true;
    for(i=0;i     {   s_1[2]->AddXY(XGCN[i]+STACKX,RGCN[i],"",clRed);
    }
    s_1[3] = new TLineSeries(this);
    s_1[3]->Title = "TE";
    s_1[3]->VertAxis = aLeftAxis;
    s_1[3]->XValues->Order = loNone;
    s_1[3]->YValues->Order = loNone;
    s_1[3]->SeriesColor = clRed;
    s_1[3]->Pointer->Brush->Color = clRed;
    s_1[3]->Pointer->InflateMargins = true;
    s_1[3]->Pointer->Pen->Color = clRed;
    s_1[3]->Pointer->Style = psCircle;
    s_1[3]->Pointer->HorizSize= 4;
    s_1[3]->Pointer->VertSize = 4;
    s_1[3]->Pointer->Visible = true;
    for(i=0;i     {   s_1[3]->AddXY(tmp3[i]+STACKX,tmp4[i],"",clRed);
    }
    for(j=0;j<4;j++)
    {   Ch1->AddSeries(s_1[j]);
    }

#2



    axmax=-1000000;    axmin= 1000000;    aymax=-1000000;    aymin= 1000000;
    for(j=0;j     {   axmax=max(axmax,tmp1[j]);        axmin=min(axmin,tmp1[j]);
        aymax=max(aymax,tmp2[j]);        aymin=min(aymin,tmp2[j]);
        axmax=max(axmax,tmp3[j]);        axmin=min(axmin,tmp3[j]);
        aymax=max(aymax,tmp4[j]);        aymin=min(aymin,tmp4[j]);
        axmax=max(axmax,YSTN[j]);        axmin=min(axmin,YSTN[j]);
        aymax=max(aymax,ZSTN[j]);        aymin=min(aymin,ZSTN[j]);
        axmax=max(axmax,YGCN[j]);        axmin=min(axmin,YGCN[j]);
        aymax=max(aymax,ZGCN[j]);        aymin=min(aymin,ZGCN[j]);
    }

    ax=axmax-axmin;
    ay=aymax-aymin;
    axmax=axmax+ax*0.02;
    axmin=axmin-ax*0.02;
    aymax=aymax+ay*0.10;
    aymin=aymin-ay*0.02;
    Ch2->Title->Text->SetText("Blade Axial Projection");
    Ch2->BottomAxis->Title->Caption="Y(m)";
    Ch2->LeftAxis->Title->Caption ="Z(m)" ;
    Ch2->LeftAxis->Maximum=aymax;
    Ch2->LeftAxis->Minimum=aymin;
    Ch2->BottomAxis->Minimum=axmin;
    Ch2->BottomAxis->Maximum=axmax;
    Ch2->Legend->Visible=true;
    Ch2->Legend->Color=clBtnFace;
    Ch2->Legend->ColorWidth = 40;
    Ch2->Legend->Frame->Visible = false;
    Ch2->Legend->HorizMargin = 2;
    Ch2->Legend->ResizeChart = false;
    Ch2->Legend->ShadowSize = 0;
    Ch2->Legend->TextStyle = ltsPlain;
    Ch2->Legend->TopPos = 14;
    Ch2->Legend->VertMargin = 2 ;
    s_2[0] = new TLineSeries(this);
    s_2[0]->Title = "LE";
    s_2[0]->VertAxis = aLeftAxis;
    s_2[0]->XValues->Order = loNone;
    s_2[0]->YValues->Order = loNone;
    s_2[0]->SeriesColor = clRed;                //线的颜色
    s_2[0]->Pointer->Brush->Color =clRed;   //标注的填充颜色
    s_2[0]->Pointer->InflateMargins = true;
    s_2[0]->Pointer->Pen->Color = clRed;      //标注的外圈颜色
    s_2[0]->Pointer->Style = psRectangle;
    s_2[0]->Pointer->HorizSize= 3;
    s_2[0]->Pointer->VertSize = 3;
    s_2[0]->Pointer->Visible = true;
    for(i=0;i     {   s_2[0]->AddXY(tmp1[i],tmp2[i],"",clRed);
    }
    s_2[1] = new TLineSeries(this);
    s_2[1]->Title = "STK";
    s_2[1]->VertAxis = aLeftAxis;
    s_2[1]->XValues->Order = loNone;
    s_2[1]->YValues->Order = loNone;
    s_2[1]->SeriesColor = clRed;
    s_2[1]->Pointer->Brush->Color = clBtnFace;
    s_2[1]->Pointer->InflateMargins = true;
    s_2[1]->Pointer->Pen->Color = clRed;
    s_2[1]->Pointer->Style = psCircle;
    s_2[1]->Pointer->HorizSize= 4;
    s_2[1]->Pointer->VertSize = 4;
    s_2[1]->Pointer->Visible = true;
    for(i=0;i     {   s_2[1]->AddXY(YSTN[i],ZSTN[i],"",clRed);
    }
    s_2[2] = new TLineSeries(this);
    s_2[2]->Title = "CG";
    s_2[2]->VertAxis = aLeftAxis;
    s_2[2]->XValues->Order = loNone;
    s_2[2]->YValues->Order = loNone;
    s_2[2]->SeriesColor = clRed;                //线的颜色
    s_2[2]->Pointer->Brush->Color =clBtnFace;   //标注的填充颜色
    s_2[2]->Pointer->InflateMargins = true;
    s_2[2]->Pointer->Pen->Color = clRed;      //标注的外圈颜色
    s_2[2]->Pointer->Style = psRectangle;
    s_2[2]->Pointer->HorizSize= 3;
    s_2[2]->Pointer->VertSize = 3;
    s_2[2]->Pointer->Visible = true;
    for(i=0;i     {   s_2[2]->AddXY(YGCN[i],ZGCN[i],"",clRed);
    }
    s_2[3] = new TLineSeries(this);
    s_2[3]->Title = "TE";
    s_2[3]->VertAxis = aLeftAxis;
    s_2[3]->XValues->Order = loNone;
    s_2[3]->YValues->Order = loNone;
    s_2[3]->SeriesColor = clRed;
    s_2[3]->Pointer->Brush->Color = clRed;
    s_2[3]->Pointer->InflateMargins = true;
    s_2[3]->Pointer->Pen->Color = clRed;
    s_2[3]->Pointer->Style = psCircle;
    s_2[3]->Pointer->HorizSize= 4;
    s_2[3]->Pointer->VertSize = 4;
    s_2[3]->Pointer->Visible = true;
    for(i=0;i     {   s_2[3]->AddXY(tmp3[i],tmp4[i],"",clRed);
    }
    for(j=0;j<4;j++)
    {   Ch2->AddSeries(s_2[j]);
    }

    axmax=-1000000.0;    axmin= 1000000.0;
    for(j=0;j     {   axmax=max(axmax,fabs(STAGGER[j]));        axmin=min(axmin,fabs(STAGGER[j]));
    }
    ax=axmax-axmin;
    axmax=axmax+ax*0.02;    axmin=axmin-ax*0.02;
    Memolist->Lines->Add("axmax="+FloatToStr(axmax));
    Memolist->Lines->Add("axmin="+FloatToStr(axmin));
    Ch3->Repaint();
    Ch3->Title->Text->SetText("Stagger Angle Distribution");
    Ch3->LeftAxis->Minimum=double(0.0);
    Ch3->LeftAxis->Maximum=double(NLINES+2);
    Ch3->LeftAxis->Title->Caption ="Radial Station No.J";
    Ch3->BottomAxis->Automatic=false;
  /*  if(axmax>axmin)                           //此段是为了看是否仅是Ch3出问题了
    {   Ch3->BottomAxis->Maximum=axmax;
        Ch3->BottomAxis->Minimum=axmin;
    }
    Ch3->BottomAxis->Title->Caption="Stagger Angle(deg)";
    Ch3->Legend->Visible=true;
    Ch3->Legend->Color=clBtnFace;
    Ch3->Legend->ColorWidth = 40;
    Ch3->Legend->Frame->Visible = false;
    Ch3->Legend->HorizMargin = 2;
    Ch3->Legend->ResizeChart = false;
    Ch3->Legend->ShadowSize = 0;
    Ch3->Legend->TextStyle = ltsPlain;
    Ch3->Legend->TopPos = 14;
    Ch3->Legend->VertMargin = 2 ;
    s_3[0] = new TLineSeries(this);
    s_3[0]->Title ="Stagger Angle";
    s_3[0]->VertAxis = aLeftAxis;
    s_3[0]->XValues->Order = loNone;
    s_3[0]->YValues->Order = loNone;
    s_3[0]->SeriesColor = clRed;                //线的颜色
    s_3[0]->Pointer->Brush->Color =clBtnFace;   //标注的填充颜色
    s_3[0]->Pointer->InflateMargins = true;
    s_3[0]->Pointer->Pen->Color = clRed;
    s_3[0]->Pointer->Style = psCircle;
    s_3[0]->Pointer->HorizSize= 4;
    s_3[0]->Pointer->VertSize = 4;
    s_3[0]->Pointer->Visible = true;
    for(i=0;i     {   s_3[0]->AddXY(fabs(STAGGER[i]),i+1,"",clRed);
    }
    Ch3->AddSeries(s_3[0]);       */

    axmax=-1000000;    axmin= 1000000;
    for(j=0;j     {   axmax=max(axmax,tmp1[j]);        axmin=min(axmin,tmp1[j]);
    }
    ax=axmax-axmin;
    axmax=axmax+ax*0.02;
    axmin=axmin-ax*0.02;
    Ch4->Title->Text->SetText("Camber Angle Distribution");
    Ch4->BottomAxis->Title->Caption="Camber Angle(deg)";
    Ch4->LeftAxis->Title->Caption ="Radial Station No.J";
    Ch4->LeftAxis->Maximum=double(NLINES+2);
    Ch4->LeftAxis->Minimum=double(0.0);
    Ch4->BottomAxis->Maximum=axmax;
    Ch4->BottomAxis->Minimum=axmin;
    Ch4->Legend->Visible=true;
    Ch4->Legend->Color=clBtnFace;
    Ch4->Legend->ColorWidth = 40;
    Ch4->Legend->Frame->Visible = false;
    Ch4->Legend->HorizMargin = 2;
    Ch4->Legend->ResizeChart = false;
    Ch4->Legend->ShadowSize = 0;
    Ch4->Legend->TextStyle = ltsPlain;
    Ch4->Legend->TopPos = 14;
    Ch4->Legend->VertMargin = 2 ;
    s_4[0] = new TLineSeries(this);
    s_4[0]->Title = "Camber Angle";
    s_4[0]->VertAxis = aLeftAxis;
    s_4[0]->XValues->Order = loNone;
    s_4[0]->YValues->Order = loNone;
    s_4[0]->SeriesColor = clRed;                //线的颜色
    s_4[0]->Pointer->Brush->Color =clBtnFace;   //标注的填充颜色
    s_4[0]->Pointer->InflateMargins = true;
    s_4[0]->Pointer->Pen->Color = clRed;
    s_4[0]->Pointer->Style = psCircle;
    s_4[0]->Pointer->HorizSize= 4;
    s_4[0]->Pointer->VertSize = 4;
    s_4[0]->Pointer->Visible = true;
    for(i=0;i     {   s_4[0]->AddXY(tmp1[i],i+1,"",clRed);
    }
    Ch4->AddSeries(s_4[0]);
}

#3


这个问题搞死我了, 真怀疑是C++B调用控件, 以及控件本身的问题

#4


@_@ ......晕啊

#5


自己解决了.打扰

#6


自己解决了,这分却不好拿回, 真遗憾, 怎么办>

#7


那就给大伙分了吧!

推荐阅读
  • 本文介绍了为什么要使用多进程处理TCP服务端,多进程的好处包括可靠性高和处理大量数据时速度快。然而,多进程不能共享进程空间,因此有一些变量不能共享。文章还提供了使用多进程实现TCP服务端的代码,并对代码进行了详细注释。 ... [详细]
  • 计算机存储系统的层次结构及其优势
    本文介绍了计算机存储系统的层次结构,包括高速缓存、主存储器和辅助存储器三个层次。通过分层存储数据可以提高程序的执行效率。计算机存储系统的层次结构将各种不同存储容量、存取速度和价格的存储器有机组合成整体,形成可寻址存储空间比主存储器空间大得多的存储整体。由于辅助存储器容量大、价格低,使得整体存储系统的平均价格降低。同时,高速缓存的存取速度可以和CPU的工作速度相匹配,进一步提高程序执行效率。 ... [详细]
  • 关键词:Golang, Cookie, 跟踪位置, net/http/cookiejar, package main, golang.org/x/net/publicsuffix, io/ioutil, log, net/http, net/http/cookiejar ... [详细]
  • Nginx使用(server参数配置)
    本文介绍了Nginx的使用,重点讲解了server参数配置,包括端口号、主机名、根目录等内容。同时,还介绍了Nginx的反向代理功能。 ... [详细]
  • 本文分享了一个关于在C#中使用异步代码的问题,作者在控制台中运行时代码正常工作,但在Windows窗体中却无法正常工作。作者尝试搜索局域网上的主机,但在窗体中计数器没有减少。文章提供了相关的代码和解决思路。 ... [详细]
  • Java容器中的compareto方法排序原理解析
    本文从源码解析Java容器中的compareto方法的排序原理,讲解了在使用数组存储数据时的限制以及存储效率的问题。同时提到了Redis的五大数据结构和list、set等知识点,回忆了作者大学时代的Java学习经历。文章以作者做的思维导图作为目录,展示了整个讲解过程。 ... [详细]
  • 本文介绍了C++中省略号类型和参数个数不确定函数参数的使用方法,并提供了一个范例。通过宏定义的方式,可以方便地处理不定参数的情况。文章中给出了具体的代码实现,并对代码进行了解释和说明。这对于需要处理不定参数的情况的程序员来说,是一个很有用的参考资料。 ... [详细]
  • JavaSE笔试题-接口、抽象类、多态等问题解答
    本文解答了JavaSE笔试题中关于接口、抽象类、多态等问题。包括Math类的取整数方法、接口是否可继承、抽象类是否可实现接口、抽象类是否可继承具体类、抽象类中是否可以有静态main方法等问题。同时介绍了面向对象的特征,以及Java中实现多态的机制。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • 个人学习使用:谨慎参考1Client类importcom.thoughtworks.gauge.Step;importcom.thoughtworks.gauge.T ... [详细]
  • Linux环境变量函数getenv、putenv、setenv和unsetenv详解
    本文详细解释了Linux中的环境变量函数getenv、putenv、setenv和unsetenv的用法和功能。通过使用这些函数,可以获取、设置和删除环境变量的值。同时给出了相应的函数原型、参数说明和返回值。通过示例代码演示了如何使用getenv函数获取环境变量的值,并打印出来。 ... [详细]
  • 本文介绍了PE文件结构中的导出表的解析方法,包括获取区段头表、遍历查找所在的区段等步骤。通过该方法可以准确地解析PE文件中的导出表信息。 ... [详细]
  • [大整数乘法] java代码实现
    本文介绍了使用java代码实现大整数乘法的过程,同时也涉及到大整数加法和大整数减法的计算方法。通过分治算法来提高计算效率,并对算法的时间复杂度进行了研究。详细代码实现请参考文章链接。 ... [详细]
  • iOS Swift中如何实现自动登录?
    本文介绍了在iOS Swift中如何实现自动登录的方法,包括使用故事板、SWRevealViewController等技术,以及解决用户注销后重新登录自动跳转到主页的问题。 ... [详细]
  • 移动端常用单位——rem的使用方法和注意事项
    本文介绍了移动端常用的单位rem的使用方法和注意事项,包括px、%、em、vw、vh等其他常用单位的比较。同时还介绍了如何通过JS获取视口宽度并动态调整rem的值,以适应不同设备的屏幕大小。此外,还提到了rem目前在移动端的主流地位。 ... [详细]
author-avatar
手机用户2602880745
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有