Giter VIP home page Giter VIP logo

lcu-tutorial-simple2dchart-01's Introduction

Simple 2D Chart with PointLineSeries

With LightningCharts DLLs included in your project, you are ready to create your first chart. We will begin with creating a simple line chart for WinForms and WPF platforms without MVVM implementation.

chart with pointline series 2d winforms wpf

The chart can be added to a designer e.g. (Form, Window, Grid, Panel, etc.) and configured by using Properties window. However, this tutorial series shows how to create everything in code, thereby providing the best way for maintainability in further project development.

1. Create chart.
// Create chart.
var chart = new LightningChart();
2. Set the parent container of the chart where it will be rendered.

WinForms:

// Set chart control into the parent container.
chart.Parent = this; 
chart.Dock = DockStyle.Fill;

WPF:

// Set chart control into the parent container.
(Content as Grid).Children.Add(chart);
3. Generate data for series.
// Generate data for series.
var rand = new Random();
int pointCounter = 70;

var data = new SeriesPoint[pointCounter];
for (int i = 0; i < pointCounter; i++) 
{
      data[i].X = (double)i;
      data[i].Y = rand.Next(0, 100);
}
4. Define variables for X- and Y-axis.
// Define variables for X- and Y-axis.
var axisX = chart.ViewXY.XAxes[0];
var axisY = chart.ViewXY.YAxes[0];
5. Create linear series, e.g. PointLineSeries.
// Create a new PointLineSeries.
var series = new PointLineSeries(chart.ViewXY, axisX, axisY);
series.LineStyle.Color = Color.Orange;
6. Set generated data-points into series.
// Set data-points into series.
series.Points = data;
7. Add series to chart.
// Add series to chart.
chart.ViewXY.PointLineSeries.Add(series);
8. Auto-scale axes to show all series data.
// Auto-scale X- and Y-axes.
chart.ViewXY.ZoomToFit();

lcu-tutorial-simple2dchart-01's People

Contributors

arctionjuuso avatar arctionkestutis avatar arctionltd avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

ngreenla battyone

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.