ucolor.cpp

来自「TeeChart Pro ActiveX是西班牙Steema SL公司开发的图表」· C++ 代码 · 共 44 行

CPP
44
字号
/*********************************************/
/* TeeChart Delphi Component Library 4.0     */
/* Demo                                      */
/* Copyright (c) 1995-1998 by David Berneda  */
/* All rights reserved                       */
/*********************************************/
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop

#include "UColor.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TColoredForm *ColoredForm;
//---------------------------------------------------------------------------
__fastcall TColoredForm::TColoredForm(TComponent* Owner)
  : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void TColoredForm::AddColors(TChartSeries* Series)
{
  double step = (Series->GetVertAxis->Maximum - Series->GetVertAxis->Minimum)/10.0;
  for (int t=0;t<Series->Count();t++)
    Series->ValueColor[t] = GetDefaultColor(
      (Series->YValue[t] - (int)(Series->GetVertAxis->Minimum) / step));
}

void __fastcall TColoredForm::FormCreate(TObject *Sender)
{
  LineSeries1->FillSampleValues(100);
  PointSeries1->FillSampleValues(100);
  Chart1->LeftAxis->AdjustMaxMin();
  AddColors(LineSeries1);
  AddColors(PointSeries1);
}
//---------------------------------------------------------------------------
void __fastcall TColoredForm::CheckBox1Click(TObject *Sender)
{
  Chart1->LeftAxis->Inverted = CheckBox1->Checked;
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?