mirror of
https://github.com/mhowlett/nplot.git
synced 2026-09-15 05:03:06 +00:00
200 lines
7.4 KiB
C++
200 lines
7.4 KiB
C++
/*
|
|
* NPlot - A charting library for .NET
|
|
*
|
|
* PlotSurface2DDemo.cs
|
|
* Copyright (C) 2003-2006 Matt Howlett, Jamie McQuay.
|
|
* All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without modification,
|
|
* are permitted provided that the following conditions are met:
|
|
*
|
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
* list of conditions and the following disclaimer.
|
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
* this list of conditions and the following disclaimer in the documentation
|
|
* and/or other materials provided with the distribution.
|
|
* 3. Neither the name of NPlot nor the names of its contributors may
|
|
* be used to endorse or promote products derived from this software without
|
|
* specific prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
* IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
|
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
using namespace System;
|
|
using namespace System::ComponentModel;
|
|
using namespace System::Collections;
|
|
using namespace System::Windows::Forms;
|
|
using namespace System::Data;
|
|
using namespace System::Drawing;
|
|
|
|
using namespace NPlot;
|
|
|
|
namespace NPlotDemo {
|
|
|
|
/// <summary>
|
|
/// Summary for FinancialDemo
|
|
///
|
|
/// WARNING: If you change the name of this class, you will need to change the
|
|
/// 'Resource File Name' property for the managed resource compiler tool
|
|
/// associated with all .resx files this class depends on. Otherwise,
|
|
/// the designers will not be able to interact properly with localized
|
|
/// resources associated with this form.
|
|
/// </summary>
|
|
public ref class CFinancialDemo : public System::Windows::Forms::Form
|
|
{
|
|
public:
|
|
CFinancialDemo(void);
|
|
|
|
protected:
|
|
/// <summary>
|
|
/// Clean up any resources being used.
|
|
/// </summary>
|
|
~CFinancialDemo()
|
|
{
|
|
if (components)
|
|
{
|
|
delete components;
|
|
}
|
|
}
|
|
|
|
private:
|
|
System::Void costPS_InteractionOccured(System::Object^ sender);
|
|
System::Void volumePS_InteractionOccured(System::Object^ sender);
|
|
System::Void volumePS_PreRefresh(System::Object^ sender);
|
|
|
|
|
|
private: System::Windows::Forms::Button^ closeButton;
|
|
private: NPlot::Windows::PlotSurface2D^ costPS;
|
|
private: NPlot::Windows::PlotSurface2D^ volumePS;
|
|
protected:
|
|
|
|
private:
|
|
/// <summary>
|
|
/// Required designer variable.
|
|
/// </summary>
|
|
System::ComponentModel::Container ^components;
|
|
|
|
#pragma region Windows Form Designer generated code
|
|
/// <summary>
|
|
/// Required method for Designer support - do not modify
|
|
/// the contents of this method with the code editor.
|
|
/// </summary>
|
|
void InitializeComponent(void)
|
|
{
|
|
this->closeButton = (gcnew System::Windows::Forms::Button());
|
|
this->costPS = (gcnew NPlot::Windows::PlotSurface2D());
|
|
this->volumePS = (gcnew NPlot::Windows::PlotSurface2D());
|
|
this->SuspendLayout();
|
|
//
|
|
// closeButton
|
|
//
|
|
this->closeButton->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left));
|
|
this->closeButton->Location = System::Drawing::Point(13, 421);
|
|
this->closeButton->Name = L"closeButton";
|
|
this->closeButton->Size = System::Drawing::Size(75, 23);
|
|
this->closeButton->TabIndex = 0;
|
|
this->closeButton->Text = L"Close";
|
|
this->closeButton->UseVisualStyleBackColor = true;
|
|
this->closeButton->Click += gcnew System::EventHandler(this, &CFinancialDemo::closeButton_Click);
|
|
//
|
|
// costPS
|
|
//
|
|
this->costPS->AutoScaleAutoGeneratedAxes = false;
|
|
this->costPS->AutoScaleTitle = false;
|
|
this->costPS->BackColor = System::Drawing::SystemColors::ControlLightLight;
|
|
this->costPS->DateTimeToolTip = false;
|
|
this->costPS->Legend = nullptr;
|
|
this->costPS->LegendZOrder = 1;
|
|
this->costPS->Location = System::Drawing::Point(13, 13);
|
|
this->costPS->Name = L"costPS";
|
|
this->costPS->RightMenu = nullptr;
|
|
this->costPS->ShowCoordinates = true;
|
|
this->costPS->Size = System::Drawing::Size(606, 285);
|
|
this->costPS->SmoothingMode = System::Drawing::Drawing2D::SmoothingMode::None;
|
|
this->costPS->TabIndex = 1;
|
|
this->costPS->Text = L"plotSurface2D1";
|
|
this->costPS->Title = L"";
|
|
this->costPS->TitleFont = (gcnew System::Drawing::Font(L"Arial", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Pixel));
|
|
this->costPS->XAxis1 = nullptr;
|
|
this->costPS->XAxis2 = nullptr;
|
|
this->costPS->YAxis1 = nullptr;
|
|
this->costPS->YAxis2 = nullptr;
|
|
//
|
|
// volumePS
|
|
//
|
|
this->volumePS->AutoScaleAutoGeneratedAxes = false;
|
|
this->volumePS->AutoScaleTitle = false;
|
|
this->volumePS->BackColor = System::Drawing::SystemColors::ControlLightLight;
|
|
this->volumePS->DateTimeToolTip = false;
|
|
this->volumePS->Legend = nullptr;
|
|
this->volumePS->LegendZOrder = 1;
|
|
this->volumePS->Location = System::Drawing::Point(13, 305);
|
|
this->volumePS->Name = L"volumePS";
|
|
this->volumePS->RightMenu = nullptr;
|
|
this->volumePS->ShowCoordinates = true;
|
|
this->volumePS->Size = System::Drawing::Size(606, 109);
|
|
this->volumePS->SmoothingMode = System::Drawing::Drawing2D::SmoothingMode::None;
|
|
this->volumePS->TabIndex = 2;
|
|
this->volumePS->Text = L"plotSurface2D1";
|
|
this->volumePS->Title = L"";
|
|
this->volumePS->TitleFont = (gcnew System::Drawing::Font(L"Arial", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Pixel));
|
|
this->volumePS->XAxis1 = nullptr;
|
|
this->volumePS->XAxis2 = nullptr;
|
|
this->volumePS->YAxis1 = nullptr;
|
|
this->volumePS->YAxis2 = nullptr;
|
|
//
|
|
// CFinancialDemo
|
|
//
|
|
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
|
|
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
|
|
this->ClientSize = System::Drawing::Size(631, 450);
|
|
this->Controls->Add(this->volumePS);
|
|
this->Controls->Add(this->costPS);
|
|
this->Controls->Add(this->closeButton);
|
|
this->Name = L"CFinancialDemo";
|
|
this->Text = L"FinancialDemo";
|
|
this->Resize += gcnew System::EventHandler(this, &CFinancialDemo::CFinancialDemo_Resize);
|
|
this->ResumeLayout(false);
|
|
|
|
}
|
|
#pragma endregion
|
|
private: System::Void closeButton_Click(System::Object^ sender, System::EventArgs^ e);
|
|
private: System::Void CFinancialDemo_Resize(System::Object^ sender, System::EventArgs^ e);
|
|
};
|
|
|
|
/// <summary>
|
|
/// Right context menu with non-default functionality. Just take out some functionality. Could also have added some.
|
|
/// </summary>
|
|
public ref class ReducedContextMenu : NPlot::Windows::PlotSurface2D::PlotContextMenu
|
|
{
|
|
|
|
/// <summary>
|
|
/// Constructor
|
|
/// </summary>
|
|
public:
|
|
ReducedContextMenu()
|
|
{
|
|
ArrayList^ menuItems = MenuItems;
|
|
|
|
// remove show coordinates, and print functionality
|
|
menuItems->RemoveAt(4);
|
|
menuItems->RemoveAt(3);
|
|
menuItems->RemoveAt(1);
|
|
|
|
SetMenuItems(menuItems);
|
|
}
|
|
|
|
};
|
|
}
|