Convert Figma logo to code with AI

beto-rodriguez logoLiveCharts2

Simple, flexible, interactive & powerful charts, maps and gauges for .Net, LiveCharts2 can now practically run everywhere Maui, Uno Platform, Blazor-wasm, WPF, WinForms, Xamarin, Avalonia, WinUI, UWP.

4,443
583
4,443
111

Top Related Projects

Interactive plotting library for .NET

3,305

A cross-platform plotting library for .NET

Simple, flexible, interactive & powerful charts, maps and gauges for .Net

Google's Material Design in XAML & WPF, for C# & VB.Net.

Quick Overview

LiveCharts2 is a powerful and flexible charting library for .NET. It supports multiple platforms including WPF, WinForms, Avalonia, UWP, and more. The library offers a wide range of chart types and customization options, making it suitable for various data visualization needs.

Pros

  • Cross-platform compatibility with support for multiple .NET frameworks
  • Highly customizable with a wide range of chart types and styling options
  • Responsive and interactive charts with smooth animations
  • Good documentation and active community support

Cons

  • Steeper learning curve compared to some simpler charting libraries
  • Limited built-in themes, requiring more manual customization for complex designs
  • Some advanced features may require additional setup or configuration

Code Examples

  1. Creating a basic line chart:
using LiveChartsCore;
using LiveChartsCore.SkiaSharpView;

var series = new ISeries[]
{
    new LineSeries<double>
    {
        Values = new double[] { 2, 1, 3, 5, 3, 4, 6 },
        Name = "Series 1"
    }
};

var chart = new SKCartesianChart
{
    Series = series
};
  1. Adding multiple series to a chart:
var series = new ISeries[]
{
    new LineSeries<double>
    {
        Values = new double[] { 2, 1, 3, 5, 3, 4, 6 },
        Name = "Series 1"
    },
    new LineSeries<double>
    {
        Values = new double[] { 1, 4, 2, 6, 2, 5, 3 },
        Name = "Series 2"
    }
};

var chart = new SKCartesianChart
{
    Series = series
};
  1. Customizing chart appearance:
var chart = new SKCartesianChart
{
    Series = series,
    Title = new LabelVisual
    {
        Text = "My Chart",
        TextSize = 25,
        Padding = new LiveChartsCore.Drawing.Padding(15),
        Paint = new SolidColorPaint(SKColors.DarkSlateGray)
    },
    XAxes = new[]
    {
        new Axis
        {
            Name = "X Axis",
            NamePaint = new SolidColorPaint(SKColors.Blue)
        }
    },
    YAxes = new[]
    {
        new Axis
        {
            Name = "Y Axis",
            NamePaint = new SolidColorPaint(SKColors.Red)
        }
    }
};

Getting Started

  1. Install the NuGet package for your platform (e.g., LiveChartsCore.SkiaSharpView.WPF for WPF)
  2. Add the necessary using statements:
    using LiveChartsCore;
    using LiveChartsCore.SkiaSharpView;
    
  3. Create a chart instance and add it to your view:
    var chart = new SKCartesianChart
    {
        Series = new ISeries[]
        {
            new LineSeries<double>
            {
                Values = new double[] { 2, 1, 3, 5, 3, 4, 6 }
            }
        }
    };
    // Add the chart to your view (e.g., Grid.Children.Add(chart) for WPF)
    

Competitor Comparisons

Interactive plotting library for .NET

Pros of ScottPlot

  • More extensive documentation and examples
  • Supports a wider range of plot types and customization options
  • Better performance for large datasets

Cons of ScottPlot

  • Less focus on real-time/live charting capabilities
  • Steeper learning curve for beginners

Code Comparison

ScottPlot:

var plt = new ScottPlot.Plot(600, 400);
plt.AddScatter(xs, ys);
plt.SaveFig("scatter.png");

LiveCharts2:

var chart = new CartesianChart
{
    Series = new ISeries[] { new LineSeries<double> { Values = new double[] { 3, 5, 2, 6, 1 } } }
};

Summary

ScottPlot offers more comprehensive plotting capabilities and better performance for large datasets, while LiveCharts2 excels in real-time charting and has a simpler API for basic use cases. ScottPlot's extensive documentation and examples make it easier to learn advanced features, but it may have a steeper initial learning curve. LiveCharts2 focuses on providing a straightforward API for common charting scenarios, particularly for live data visualization.

3,305

A cross-platform plotting library for .NET

Pros of OxyPlot

  • More mature and established project with a larger community
  • Supports a wider range of platforms, including Xamarin and UWP
  • Offers more advanced and customizable plotting options

Cons of OxyPlot

  • Less frequent updates and slower development cycle
  • Steeper learning curve for beginners
  • Limited real-time data visualization capabilities

Code Comparison

OxyPlot:

var model = new PlotModel { Title = "Example" };
var series = new LineSeries();
series.Points.Add(new DataPoint(0, 0));
series.Points.Add(new DataPoint(10, 10));
model.Series.Add(series);

LiveCharts2:

var series = new LineSeries<double>
{
    Values = new double[] { 0, 10 }
};
var chart = new CartesianChart
{
    Series = { series }
};

Summary

OxyPlot is a more established and feature-rich charting library with support for various platforms. It offers advanced customization options but may have a steeper learning curve. LiveCharts2, on the other hand, is designed for simplicity and real-time data visualization, making it more accessible for beginners. The choice between the two depends on the specific requirements of your project and your familiarity with charting libraries.

Simple, flexible, interactive & powerful charts, maps and gauges for .Net

Pros of Live-Charts

  • More established project with longer history and larger community
  • Supports older .NET Framework versions, offering broader compatibility
  • Provides more extensive documentation and examples

Cons of Live-Charts

  • Less actively maintained, with fewer recent updates
  • May have performance limitations compared to LiveCharts2
  • Lacks some modern features and optimizations present in LiveCharts2

Code Comparison

LiveCharts:

var chart = new LiveCharts.Wpf.CartesianChart();
chart.Series = new SeriesCollection
{
    new LineSeries
    {
        Values = new ChartValues<double> { 3, 5, 7, 4 }
    }
};

LiveCharts2:

var chart = new LiveChartsCore.SkiaSharpView.WPF.CartesianChart();
chart.Series = new ISeries[]
{
    new LineSeries<double> { Values = new double[] { 3, 5, 7, 4 } }
};

Both libraries offer similar syntax for creating charts, but LiveCharts2 uses more modern C# features and has a slightly different structure for defining series and values.

LiveCharts2 is a complete rewrite of the original LiveCharts, aiming to address performance issues and provide a more flexible and maintainable codebase. It leverages SkiaSharp for rendering, which can lead to improved performance, especially for larger datasets or more complex visualizations.

While LiveCharts has a larger existing user base and more comprehensive documentation, LiveCharts2 is actively developed and offers potential advantages in terms of performance and future support.

Google's Material Design in XAML & WPF, for C# & VB.Net.

Pros of MaterialDesignInXamlToolkit

  • Comprehensive UI component library with a wide range of controls and styles
  • Follows Material Design guidelines, providing a modern and consistent look
  • Active community and frequent updates

Cons of MaterialDesignInXamlToolkit

  • Focused on UI components, not specialized for data visualization
  • May require additional customization for specific charting needs
  • Larger footprint due to its comprehensive nature

Code Comparison

MaterialDesignInXamlToolkit (XAML):

<materialDesign:Card Padding="32" Margin="16">
    <TextBlock Style="{DynamicResource MaterialDesignHeadline6TextBlock}">
        Hello World
    </TextBlock>
</materialDesign:Card>

LiveCharts2 (C#):

var chart = new CartesianChart
{
    Series = new ISeries[] { new LineSeries<double> { Values = new[] { 2.0, 1.0, 3.0 } } }
};

Summary

MaterialDesignInXamlToolkit is a comprehensive UI toolkit following Material Design principles, offering a wide range of components and styles. It's ideal for creating modern, consistent UIs across WPF applications. However, it's not specialized for data visualization like LiveCharts2.

LiveCharts2, on the other hand, focuses specifically on creating interactive and customizable charts. It provides a more targeted solution for data visualization needs but doesn't offer the broad UI component library that MaterialDesignInXamlToolkit does.

Choose MaterialDesignInXamlToolkit for overall UI design and LiveCharts2 for specialized charting capabilities. They can be used together in a project to leverage the strengths of both libraries.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

LiveCharts2

CodeFactor Unit tests SkiaSharp Views

Watch Blazor WASM demo (only designed for desktop devices for now)

LiveCharts2 (v2) is the evolution of LiveCharts (v0), it fixes the main design issues of its predecessor, it's focused to run everywhere, improves flexibility without losing what we already had in v0.

Extremely flexible data visualization library

The following image is a preview, v2.0 is beta now.

Here is a preview (1.4MB gif, wait for it to load if you see a blank space bellow this text...):

lv2

Get started

Live charts is a cross platforms charting library for .Net, to get started go to https://livecharts.dev and take a look at the instalation guide of your target platform, the web site contains all the samples provided in this repo, docs and more.

LiveCharts supports:

  • Maui
  • Uno Platform
  • Wpf
  • WinUI
  • Xamarin.Forms
  • WindowsForms
  • BlazorWasm
  • Avalonia
  • Eto Forms
  • Uwp

You can also use LiveCharts 2 on a console app or on the server side installing only the core packages, take a look at this guide.

The Errors of v0

V0 is built on top of WPF, this has many problems, WPF is not designed for the purposes of the library, it is always tricky to find a solution for the problems of the library.

How Flexible is v2?

When we were on v0 and tried to take the library to UWP, we noticed it required a huge effort with the architecture the library had in v0. V2 is designed to work on multiple platforms, it requires minimal effort to take the library to a new platform.

Then LiveCharts2 requires SkiaSharp?

Not necessarily, The SkiaAPI makes it much easier to take the library everywhere, but that does not means that LiveCharts2 requires it to work we could easily move to any other drawing engine.