This book presents a complete and comprehensive introduction to C# chart and graphics capabilities, and explains in great detail and depth how to create a variety of C# graphics and charts. It provides all the tools you need to add advanced graphics and charts to your C# applications. It provides 65 ready - to - run sample programs that allow you to explore C# chart and graphics techniques. Click here for more information.
"Practical C# Charts and Graphics" presents a complete and comprehensive introduction to C# chart and graphics capabilities, and explains in great detail and depth how to create a variety of C# graphics and charts. It provides all the tools you need to add advanced graphics and charts to your C# applications.
You can read the Introduction for an overview of the book, and the Table of Contents for more detailed information about the scope of the book. From this information, you can get a feeling of the way the book provides original and detailed materials to help you create sophisticated charts and graphics in your .NET applications using C#, GDI+, and Windows Forms.
Examples in the book teach you how to create various popular C# graphics and charts, including a US flag, 2D XY chart, stock chart, contour chart, 3D surface chart, and 4D Slice chart. The book provides about 65 ready-to-run sample programs that allow you to explore the C# chart and graphics techniques described in the book. You can modify these sample codes or add new features to them to form the basis of your own chart and graphics packages. Some of the example programs are already sophisticated chart and graphics packages that can be used directly in your own real-world C# applications.
The book also includes a chapter that shows you how to integrate Microsoft Excel chart functionality into C# applications. This chapter is designed specifically for readers who prefer not to create their own C# chart programs from scratch, and would like to take advantage of Excel wide selection of chart types.
Introduction
Overview
What this Book includes
Is This Book for You
What Do You Need to Use This Book
How This Book Is Organized
What Was Left Out
Conventions
Using Code Examples
Customer Support
Chapter 1: C# Graphics Basics
Coordinate Systems
Default Coordinates
Custom Coordinates
Window and Viewport
Zooming
Panning
Pen and Brush
Pen Class
Brush Class
Basic Graphics Shapes
Points
Lines and Curves
Rectangles, Ellipses, and Arcs
Polygons
Color
System Colors
Custom Color Map
Color Shading
Chapter 2: 2D Matrices and Transformations
Basics of Matrices and Transformations
Scaling
Reflection
Rotation
Translation
Homogeneous Coordinates
Translation in Homogeneous Coordinates
Scaling in Homogeneous Coordinates
Rotation in Homogeneous Coordinates.
Combining Transformations
Matrix Class and Transformation in C#
Matrix Definition in C#.
Matrix Operation in C#
Basic Matrix Transformations in C#
Object Transformations in C#
Basic Transformations.
Combining Transformation in C#
Transformation of Multiple Objects in C#
Text Transformation
Transformations in Graphics Class
Chapter 3: 2D Line Charts
Your First Simple Line Chart
Basic Elements of 2D Line Charts
Creating a Simple 2D Line Chart Using C#
How It Works?
Changing Chart Position
Creating Line Charts Using ArrayList
Chart Style
Data Collection
Data Series
Line Style
Form1 class
Testing Project
Gridlines and Labels
Modifying Form1 Class
Modifying Chart Style
Gridlines and Ticks
Labels and Title
Testing Project
Legends
Legend Class
Legend Layout.
Modifying Form1 Class
Testing Project.
Symbols
Defining Symbols
Symbol Style Class
Modifying Form1 Class
Modifying Data Collection
Modifying Line Style
Testing Project.
Line Charts with Two Y Axes
Why Two Y Axes
Modifying Chart Style
Modifying Form1 Class
Modifying Data Series
Modifying Data Collection
Testing Project
Sub-Charts
Layout of Sub-charts
Sub-Chart Class
Modifying Chart Style
Modifying Form1 Class
Testing Project
Creating Bar Charts
Implementation
Bar Charts
Group Bar Charts
Overlay Bar Charts.
Stacked Bar Charts
Bar Charts with Color Map
Creating Stair Step Charts
Implementation
Testing Project
Creating Stem Charts
Implementation
Testing Project
Creating Charts with Error Bars
Implementation
Testing Project
Creating Pie Charts
Implementation.
Testing Project
Creating Area Charts
Implementation
Testing Project
Creating Polar Charts
Implementation
Testing Project.
Creating Stock Charts
Implementation
Hi-Lo Chart
Hi-Lo-Open-Close Chart
Candlestick Chart
Chapter 5: 3D Matrices and Transformations
Basics of Matrices and Transformations in 3D
3D Point and Matrix Operation in C#
Scaling
Reflection
Translation.
Rotation
Projections
Parallel Projections
Orthographic Projections
Multi-View Projections
Axonometric Projections.
Orthographic Projections in C#.
Oblique Projections
Cavalier Projections
Cabinet Projections
Oblique Projections in C#
Perspective Projections
One-Point Perspective Projections
Two-Point Perspective Projections
Three-Point Perspective Projections
Perspective Projection Matrix
Perspective Projection in C#
Special Coordinate Systems in 3D
Cylindrical Coordinates
Spherical Coordinates
Euler Angles
Azimuth and Elevation View
Chapter 6: 3D Charts
3D Chart Basics
Point3 and Matrix3 Classes
Chart Style in 3D
Coordinate Axes
Gridlines
Labels
Testing Project.
3D Line Charts
Implementation
Testing Project
3D Chart Package
Chart Style
Point4 Class
Data Series.
Chart Functions
DrawChart Class
Surface Charts
Mesh Charts
Curtain Charts
Water Fall Charts
Surface Charts
Color Chart on X-Y Plane
Contour Charts
Algorithm
Implementation
Test Contour Charts
Filled Contour Charts
Combination Charts
X-Y Charts in 3D
Contour Charts in 3D
Mesh-Contour Charts
Surface-Contour Charts.
Surface-Filled-Contour Charts
3D Bar Charts
Implementation
Testing 3D Bar Charts
Slice Charts
Implementation
Testing Slice Charts
Chapter 7: Charts and User Controls
User Control Basics
Design Time Support
Event Handling
User Control for 2D Charts
Creating User Control
Using TypeConverter
ChartStyle Class
Legend Class
Chart2D Class
Testing User Control
User Control for 3D Charts
Creating User Control
ChartStyle Class
Chart3D Class
Testing User Control
3D Line Charts
Surface Charts
Contour Charts
Combination Charts
3D Bar Charts
Slice Charts
Chapter 8: DataGridView and Chart User Controls
DataGridView Basics
Unbound Mode
Data Binding
DataGridView and Chart2D Control
Creating DataGridView Application
Runtime Support
DataGridView and Chart3D Control
Creating Text Data File
Creating DataGridView Application
Runtime Support
Chapter 9: Excel Charts in C# Applications
Excel and C# Interoperability
Simple Excel Charts in C# Applications
Excel Chart Object Model
Creating Stand-Alone Excel Charts
Creating Embedded Excel Charts
More Excel Charts
Column and Bar Charts
Pie Charts
Area Charts
Doughnut Charts
Radar Charts
Stock Charts
Surface Charts
Color Map
Integrating Excel Charts into Windows Form
Stand-Alone Excel Charts on Forms
Embedding Excel Charts on Forms
Index
        Overview
        What This Book Includes
        Is This Book for You
        What Do You Need to Use This Book
        How This Book is Organized
        What is Left Out
        Using Code Examples
Overview
Welcome to Practical C# Charts and Graphics. This book is intended for C# .NET developers who want to add professional graphics and charts to their applications. My hope is to write the ultimate C# chart and graphics programming guide, useful to C# application programmers of all skill levels.
We have all heard the saying "a picture is worth a thousand words". Creating charts and graphics plays a very important role in every Windows application. Charts and graphics can make data easier to understand, can add interest to a report, and can have wide applications in our daily life. For instance, in the scientific, engineering, and mathematics community, there is always the need to present data and results graphically. Microsoft Visual C# programming language is one of the best of the few available development tools that provide the computational capability to both generate data as a simulation engine and display it in a variety of graphical representations based on its Graphical Device Interface (GDI+).
The power of the C# programming language, combined with the simplicity of implementing Windows Form applications in Visual Studio .NET, makes real-world Windows program development faster and easier than ever before. Visual C# is a versatile and flexible tool that allows users with even the most elementary programming abilities to produce sophisticated charts, graphics, and graphical user interfaces (GUIs). The level of complexity and sophistication of the graphics and charting applications you create is limited only by your needs, curiosity, and imagination.
As you may have already noticed, most bookstores offer hundreds of C# programming books. The vast majority of these books are general-purpose user guides and tutorials that explain the basics of the C# tool and how to use it to implement simple C# applications. Some of these books contain a chapter or two covering graphics and charts. None, however, provide the level of detail that you will find in this book.
This book is written with the intent of providing you with a complete and comprehensive explanation of the C# graphics and chart capability, and pays special attention to creating charts that can be used directly in your own real world C# Applications. Much of this book contains original work based on my own programming experience in developing commercial Computer Aided Design (CAD) packages. Without C# and the .NET framework, development of advanced graphics and charts can be a difficult and time-consuming task. Often, adding even simple charts or graphs to your applications requires you to waste either effort creating a chart program, or money buying commercial graphics and chart add-on packages.
Using third-party graphics and chart add-on products in your applications has several drawbacks, however:
Visual C# and its powerful GDI+ class make it possible to easily implement your own professional graphics and chart package using entirely managed C# codes. However, Visual C# provides no tools for creating three-dimensional (3D) graphics objects. Even a 3D point, the simplest 3D graphics object, must first be defined in a suitable 3D coordinate system before it can be used as a 3D graphics object.
Practical C# Charts and Graphics provides everything you need to create advanced charts and graphics in your .NET applications. In this book I will show you how to create a variety of graphics and charts that range from simple two-dimensional (2D) X-Y plots to complicated three-dimensional (3D) surface graphs using managed C# code. I try my best to introduce readers to the C# graphics program in a simple way--simple enough to be easily followed by C# beginners who have never had experience developing C# graphics and chart applications. You will learn from this book how to create a full range of color graphics applications and how to use C# controls to create impressive graphic and chart effects without having to buy expensive third-party add-ons.
Practical C# Charts and Graphics is not just a book, but a powerful 2D and 3D chart and graphics package in its own right. You may find that some of the examples in this book can be immediately used in solving your real-world problems, and that some may give you inspiration for adding advanced graphical and sophisticated chart capabilities to your own applications.
What This Book Includes
This book and its sample code listings, which are available for download at this website, provide you with:
Is This Book for You
You do not have to be an experienced C# developer or expert to use this book. I designed this book to be useful to people of all levels of C# programming experience. In fact, I believe if you have some experience with programming languages other than C#, you will be able to sit down in front of your computer, start up Microsoft Visual Studio .NET and C#, follow the examples provided in this book, and quickly become familiar with C# graphics programming. For those of you who are already experienced C# developers, I believe this book has much to offer you as well. There is much information in this book about graphics and chart programming that is not available in any other C# tutorial and reference book. In addition, most of the example programs provided in this book can be used directly in your real-world application development. This book will provide you with a level of detail, explanation, instruction, and sample program code that will enable you to do just about anything graphics and charts-related using Visual C#.
Perhaps you are a scientist, engineer, mathematician, student, or teacher instead of a professional programmer: this book is still a good bet for you. In fact, my own background is in theoretical physics, a field involving extensive numerical calculations, as well as graphical and charting representations of calculated data. I have dedicated my effort to this field for many years, starting from my undergraduate up to my Ph.D. My first computer experience was with FORTRAN. Later on, I had programming experience with Basic, C, C++, and MATLAB. I still remember how hard it was in the early days to present computational results graphically. I often spent hours creating a publication-quality chart by hand, using a ruler, graph paper, and rub-off lettering. A year later, our group bought a graphics and chart package. However, I still needed to prepare my data in a proper format in order to process the data with this package. During that time, I started paying attention to various development tools that could be used to create integrated applications. I tried to find an ideal development tool that would easily allow me to not only generate data (computation capability) but also represent data graphically (graphics and chart power). The C# and Microsoft Visual Studio .NET development environment made it possible to develop such integrated applications. Ever since Microsoft .NET 1.0 came out, I have been in love with the C# language, and have been able to use this tool to successfully create powerful graphics and chart applications, including commercial CAD packages.
The majority of the example programs in this book can be routinely used by C# developers and technical professionals. Throughout this book, I will emphasize the usefulness of C# chart and graphics programming to real-world applications. If you follow this book closely, you will be able to easily develop various practical graphics and chart applications, from simple 2D x-y plots to sophisticated 4D slice graphs. At the same time, I will not spend too much time discussing program style, execution speed, and code optimization, because there is already a plethora of books out there dealing with these topics. Most of the example programs in this book omit error handlings. This makes the code easier to understand by focusing on the key concepts.
What Do You Need to Use This Book
You will need no special equipment to make the best use of this book and understand the algorithms. To run and modify the sample programs, you will need a computer that is capable of running either the Windows 2000 or Windows XP operating system. The software installed on your computer should include Visual Studio .NET or Visual C# .NET standard edition or higher. If you want to run the samples included in Chapter 9, you will also need to have Microsoft Excel installed on your computer.
All of the example programs in this book were created and tested in the professional version of Visual Studio .NET 2005 and Microsoft Excel 2002 (which is part of Microsoft Office XP) under Windows XP. They should be able to run with little or no modification in other operating systems and in other versions of Visual Studio .NET and Excel.
How This Book Is Organized
This book is organized into nine chapters, each of which focuses on a different topic concerning creating C# graphics and chart solutions. The following summaries of each chapter will give you an overview of this book contents:
Chapter 1, C# Graphics Basics
This chapter reviews some of the fundamental aspects of C# graphics programming. If you are an experienced
C# programmer, some of this material may already be familiar to you. It includes discussions of various coordinate
systems; basic graphics shapes in the GDI+ class; the color system; and advanced custom color maps used in C#
applications.
Chapter 2, 2D Matrices and Transformations
This chapter covers the mathematical basics of 2D graphics programming. 2D matrices and transformations in
homogeneous space are discussed, including translation, scaling, reflection, and rotation. These 2D matrices and
transformations allow a C# application to perform a wide variety of graphical operations on graphics objects in a
simple and consistent manner.
Chapter 3, 2D Line Charts
This chapter contains instructions of how to create elementary 2D X-Y line charts. It introduces basic chart
elements including chart area, plot area, axes, title, labels, ticks, symbols, and legend. These basic chart elements
are common in other types of charts as well.
Chapter 4, Specialized 2D Charts
This chapter covers the specialized charts often found in commercial chart packages and spreadsheet
applications. These specialized charts include bar charts, stair-step charts, stem charts, charts with error bars,
pie charts, area charts, polar charts, and stock charts.
Chapter 5, 3D Matrices and Transformations
This chapter extends the concepts described in Chapter 2 into the third dimension. It explains how to define
3D graphics objects, and how to translate, scale, reflect, and rotate these 3D objects. It also describes the
transformation matrices that represent projections, and transformations that allow you to view 3D graphics objects
on a 2D screen. Since there is no 3D matrix class defined in C# and GDI+, this chapter includes instructions
on how to create 3D transformation matrices with C#.
Chapter 6, 3D Charts
This extensive chapter begins with a description of the coordinate system used in 3D charts and graphics,
and shows you how to create 3D coordinate axes, tick marks, axis labels, and grid lines. It then explains
techniques for creating a wide variety of 3D charts, including 3D line charts, 3D mesh and surface charts,
contour charts, 3D bar charts, 4D slice charts, and 3D combination charts. In creating these charts, a few specialized
techniques, such as Z-order, are used to manipulate the data displayed on your 2D computer screen.
Chapter 7, Charts and User Controls
This chapter shows you how to put 2D and 3D chart applications in a custom user control, and how to use such a
control in your C# applications. It begins by explaining the basics of the custom user controls in a C# Windows
application, including how to provide design-time support to the controls. Then, it describes in detail the
procedure of creating custom user controls for 2D and 3D chart applications, and demonstrates how to use
these controls in real-world C# applications.
Chapter 8, DataGridView and Chart User Controls
This chapter consists of a discussion of the basics of the DataGridView and the possibility of combining it
with chart controls to create spreadsheet-like chart applications. It shows you how to implement a spreadsheet-like
interface in which the data is displayed in the DataGridView control. The displayed data in the DataGridView is
plotted in the chart user controls, and direct interaction is allowed between the DataGridView and the chart
controls.
Chapter 9, Excel Charts in C# Applications
This chapter explains how a Microsoft Excel chart can be embedded in a C# application. It shows you how to
implement charts and graphics in C# projects by taking advantage of the Excel chart and graphics features.
What Is Left Out
This book provides an in-depth description of C# chart and graphics programming for real-world .NET applications. The background material concerning C# graphics was selected for inclusion in the book specifically according to the graphical needs of creating C# chart applications. Thus, this book does not cover image processing, such as the technique for manipulating bitmapped images and image animation. Advanced ray traced images that display reflective, shadowed, transparent, and textured objects are beyond the scope of this book and are not addressed.
Using Code Examples
You may use the code in this book in your applications and documentation. You do not need to contact me or the publisher for permission unless you are reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing the example code listings does require permission. Incorporating a significant amount of example code from this book into your applications and documentation does require permission. Integrating the example code from this book into your commercial products is not allowed without the written permission from the author.
Gincker Platform allows you to create charts/graphics, build and test machine-learning models, as well as perform technical analysis in finance without the need of writing any code. Click this link to start Gincker.