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 #include "StdAfx.h" 33 #include "AxisTestsForm.h" 34 35 namespace NPlotDemo { 36 CAxisTestsForm(void)37 CAxisTestsForm::CAxisTestsForm(void) 38 { 39 InitializeComponent(); 40 41 this->Paint += gcnew PaintEventHandler(this,&NPlotDemo::CAxisTestsForm::Tests_Paint); 42 } 43 44 System::Void CAxisTestsForm::Tests_Paint(System::Object^ sender, PaintEventArgs^ e) 45 { 46 System::Drawing::Rectangle boundingBox; 47 48 NPlot::LinearAxis^ a = gcnew NPlot::LinearAxis(0, 10); 49 a->Draw( e->Graphics, (Point)gcnew Point(10,10), (Point)gcnew Point(10, 200), boundingBox ); 50 51 a->Reversed = true; 52 a->Draw( e->Graphics, (Point)gcnew Point(40,10), (Point)gcnew Point(40, 200), boundingBox ); 53 54 a->SmallTickSize = 0; 55 a->Draw( e->Graphics, (Point)gcnew Point(70,10), (Point)gcnew Point(70, 200), boundingBox ); 56 57 a->LargeTickStep = 2.5; 58 a->Draw( e->Graphics, (Point)gcnew Point(100,10), (Point)gcnew Point(100,200), boundingBox ); 59 60 a->NumberOfSmallTicks = 5; 61 a->SmallTickSize = 2; 62 a->Draw( e->Graphics, (Point)gcnew Point(130,10), (Point)gcnew Point(130,200), boundingBox ); 63 64 a->AxisColor = Color::Cyan; 65 a->Draw( e->Graphics, (Point)gcnew Point(160,10), (Point)gcnew Point(160,200), boundingBox ); 66 67 a->TickTextColor= Color::Cyan; 68 a->Draw( e->Graphics, (Point)gcnew Point(190,10), (Point)gcnew Point(190,200), boundingBox ); 69 70 a->TickTextBrush = Brushes::Black; 71 a->AxisPen = Pens::Black; 72 a->Draw( e->Graphics, (Point)gcnew Point(220,10), (Point)gcnew Point(280,200), boundingBox ); 73 74 a->WorldMax = 100000; 75 a->WorldMin = -3; 76 a->LargeTickStep = System::Double::NaN; 77 a->Draw( e->Graphics, (Point)gcnew Point(310,10), (Point)gcnew Point(310,200), boundingBox ); 78 79 a->NumberFormat = "{0:0.0E+0}"; 80 a->Draw( e->Graphics, (Point)gcnew Point(360,10), (Point)gcnew Point(360,200), boundingBox ); 81 } 82 } 83 84