1 /*
2  * NPlot - A charting library for .NET
3  *
4  * PlotSurface2DDemo.cs
5  * Copyright (C) 2003-2006 Matt Howlett, Jamie McQuay.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without modification,
9  * are permitted provided that the following conditions are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright notice, this
12  *    list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright notice,
14  *    this list of conditions and the following disclaimer in the documentation
15  *    and/or other materials provided with the distribution.
16  * 3. Neither the name of NPlot nor the names of its contributors may
17  *    be used to endorse or promote products derived from this software without
18  *    specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23  * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29  * OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #pragma once
33 
34 using namespace System;
35 using namespace System::ComponentModel;
36 using namespace System::Collections;
37 using namespace System::Windows::Forms;
38 using namespace System::Data;
39 using namespace System::Drawing;
40 
41 using namespace NPlot;
42 
43 namespace NPlotDemo {
44 
45 	/// <summary>
46 	/// Summary for FinancialDemo
47 	///
48 	/// WARNING: If you change the name of this class, you will need to change the
49 	///          'Resource File Name' property for the managed resource compiler tool
50 	///          associated with all .resx files this class depends on.  Otherwise,
51 	///          the designers will not be able to interact properly with localized
52 	///          resources associated with this form.
53 	/// </summary>
54 	public ref class CFinancialDemo : public System::Windows::Forms::Form
55 	{
56 	public:
57 		CFinancialDemo(void);
58 
59 	protected:
60 		/// <summary>
61 		/// Clean up any resources being used.
62 		/// </summary>
~CFinancialDemo()63 		~CFinancialDemo()
64 		{
65 			if (components)
66 			{
67 				delete components;
68 			}
69 		}
70 
71 	private:
72 		System::Void costPS_InteractionOccured(System::Object^ sender);
73 		System::Void volumePS_InteractionOccured(System::Object^ sender);
74 		System::Void volumePS_PreRefresh(System::Object^ sender);
75 
76 
77 	private: System::Windows::Forms::Button^  closeButton;
78 	private: NPlot::Windows::PlotSurface2D^  costPS;
79 	private: NPlot::Windows::PlotSurface2D^  volumePS;
80 	protected:
81 
82 	private:
83 		/// <summary>
84 		/// Required designer variable.
85 		/// </summary>
86 		System::ComponentModel::Container ^components;
87 
88 #pragma region Windows Form Designer generated code
89 		/// <summary>
90 		/// Required method for Designer support - do not modify
91 		/// the contents of this method with the code editor.
92 		/// </summary>
InitializeComponent(void)93 		void InitializeComponent(void)
94 		{
95 			this->closeButton = (gcnew System::Windows::Forms::Button());
96 			this->costPS = (gcnew NPlot::Windows::PlotSurface2D());
97 			this->volumePS = (gcnew NPlot::Windows::PlotSurface2D());
98 			this->SuspendLayout();
99 			//
100 			// closeButton
101 			//
102 			this->closeButton->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left));
103 			this->closeButton->Location = System::Drawing::Point(13, 421);
104 			this->closeButton->Name = L"closeButton";
105 			this->closeButton->Size = System::Drawing::Size(75, 23);
106 			this->closeButton->TabIndex = 0;
107 			this->closeButton->Text = L"Close";
108 			this->closeButton->UseVisualStyleBackColor = true;
109 			this->closeButton->Click += gcnew System::EventHandler(this, &CFinancialDemo::closeButton_Click);
110 			//
111 			// costPS
112 			//
113 			this->costPS->AutoScaleAutoGeneratedAxes = false;
114 			this->costPS->AutoScaleTitle = false;
115 			this->costPS->BackColor = System::Drawing::SystemColors::ControlLightLight;
116 			this->costPS->DateTimeToolTip = false;
117 			this->costPS->Legend = nullptr;
118 			this->costPS->LegendZOrder = 1;
119 			this->costPS->Location = System::Drawing::Point(13, 13);
120 			this->costPS->Name = L"costPS";
121 			this->costPS->RightMenu = nullptr;
122 			this->costPS->ShowCoordinates = true;
123 			this->costPS->Size = System::Drawing::Size(606, 285);
124 			this->costPS->SmoothingMode = System::Drawing::Drawing2D::SmoothingMode::None;
125 			this->costPS->TabIndex = 1;
126 			this->costPS->Text = L"plotSurface2D1";
127 			this->costPS->Title = L"";
128 			this->costPS->TitleFont = (gcnew System::Drawing::Font(L"Arial", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Pixel));
129 			this->costPS->XAxis1 = nullptr;
130 			this->costPS->XAxis2 = nullptr;
131 			this->costPS->YAxis1 = nullptr;
132 			this->costPS->YAxis2 = nullptr;
133 			//
134 			// volumePS
135 			//
136 			this->volumePS->AutoScaleAutoGeneratedAxes = false;
137 			this->volumePS->AutoScaleTitle = false;
138 			this->volumePS->BackColor = System::Drawing::SystemColors::ControlLightLight;
139 			this->volumePS->DateTimeToolTip = false;
140 			this->volumePS->Legend = nullptr;
141 			this->volumePS->LegendZOrder = 1;
142 			this->volumePS->Location = System::Drawing::Point(13, 305);
143 			this->volumePS->Name = L"volumePS";
144 			this->volumePS->RightMenu = nullptr;
145 			this->volumePS->ShowCoordinates = true;
146 			this->volumePS->Size = System::Drawing::Size(606, 109);
147 			this->volumePS->SmoothingMode = System::Drawing::Drawing2D::SmoothingMode::None;
148 			this->volumePS->TabIndex = 2;
149 			this->volumePS->Text = L"plotSurface2D1";
150 			this->volumePS->Title = L"";
151 			this->volumePS->TitleFont = (gcnew System::Drawing::Font(L"Arial", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Pixel));
152 			this->volumePS->XAxis1 = nullptr;
153 			this->volumePS->XAxis2 = nullptr;
154 			this->volumePS->YAxis1 = nullptr;
155 			this->volumePS->YAxis2 = nullptr;
156 			//
157 			// CFinancialDemo
158 			//
159 			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
160 			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
161 			this->ClientSize = System::Drawing::Size(631, 450);
162 			this->Controls->Add(this->volumePS);
163 			this->Controls->Add(this->costPS);
164 			this->Controls->Add(this->closeButton);
165 			this->Name = L"CFinancialDemo";
166 			this->Text = L"FinancialDemo";
167 			this->Resize += gcnew System::EventHandler(this, &CFinancialDemo::CFinancialDemo_Resize);
168 			this->ResumeLayout(false);
169 
170 		}
171 #pragma endregion
172 	private: System::Void closeButton_Click(System::Object^  sender, System::EventArgs^  e);
173 	private: System::Void CFinancialDemo_Resize(System::Object^  sender, System::EventArgs^  e);
174 };
175 
176 	/// <summary>
177 	/// Right context menu with non-default functionality. Just take out some functionality. Could also have added some.
178 	/// </summary>
179 	public ref class ReducedContextMenu : NPlot::Windows::PlotSurface2D::PlotContextMenu
180 	{
181 
182 		/// <summary>
183 		/// Constructor
184 		/// </summary>
185 	public:
ReducedContextMenu()186 		ReducedContextMenu()
187 		{
188 			ArrayList^ menuItems = MenuItems;
189 
190 			// remove show coordinates, and print functionality
191 			menuItems->RemoveAt(4);
192 			menuItems->RemoveAt(3);
193 			menuItems->RemoveAt(1);
194 
195            SetMenuItems(menuItems);
196 		}
197 
198 	};
199 }
200