### Install TeeChart .NET Core NuGet Package
Source: https://context7.com/steema/teechart-net-pro-samples/llms.txt
Installs the core TeeChart .NET package, which is essential for most .NET applications using the TeeChart library. This package provides the fundamental charting components.
```bash
dotnet add package Steema.TeeChart.NET
```
--------------------------------
### Install TeeChart .NET Blazor NuGet Package
Source: https://context7.com/steema/teechart-net-pro-samples/llms.txt
Installs the TeeChart package for Blazor applications. This enables the integration of interactive charts into Blazor web applications, often with client-side JavaScript rendering.
```bash
dotnet add package Steema.TeeChart.NET.Blazor
```
--------------------------------
### Install TeeChart .NET WPF NuGet Package
Source: https://context7.com/steema/teechart-net-pro-samples/llms.txt
Installs the TeeChart package specifically designed for WPF (Windows Presentation Foundation) applications. This package includes components optimized for WPF integration.
```bash
dotnet add package Steema.TeeChart.WPF
```
--------------------------------
### Install TeeChart .NET Avalonia NuGet Package
Source: https://context7.com/steema/teechart-net-pro-samples/llms.txt
Installs the TeeChart package for Avalonia UI applications. This package provides charting capabilities for cross-platform desktop applications built with Avalonia.
```bash
dotnet add package Steema.TeeChart.NET.Avalonia
```
--------------------------------
### Install TeeChart .NET MAUI NuGet Package
Source: https://context7.com/steema/teechart-net-pro-samples/llms.txt
Installs the TeeChart package for MAUI (.NET Multi-platform App UI) applications. This allows developers to use TeeChart components in cross-platform .NET applications.
```bash
dotnet add package Steema.TeeChart.NET.MAUI
```
--------------------------------
### Install TeeChart .NET Xamarin.Forms NuGet Package (Legacy)
Source: https://context7.com/steema/teechart-net-pro-samples/llms.txt
Installs the TeeChart package for Xamarin.Forms applications. Note that this package is for legacy Xamarin.Forms projects and may not be recommended for new development.
```bash
dotnet add package Steema.TeeChart.NET.Xamarin.Forms
```
--------------------------------
### Setup Client Chart with Average Line and Tooltip in TeeChart.js
Source: https://github.com/steema/teechart-net-pro-samples/blob/main/Blazor/NET 8/TeeChartOnBlazor/Resources/shipJStr.txt
This function configures a TeeChart.js chart by setting up axes for datetime, creating an 'Average' line series based on existing series, and initializing a custom tooltip with specific styling and data retrieval logic. It also adds a vertical cursor tool and applies a 'minimal' theme.
```javascript
var enableCursor = false;
function setupClientChart(aChart) {
//function series
var avg = new Tee.Line();
avg.title = "Average";
var avgVals = new Array();
aChart.title.visible = false;
aChart.axes.bottom.datetime = true;
aChart.axes.bottom.labels.dateFormat = "shortDate";
aChart.series.items[0].dateFormat = "shortDate";
for (var i = 0; i < aChart.series.items[0].data.x.length; i++) {
aChart.series.items[0].data.x[i] = new Date(aChart.series.items[0].data.x[i]);
avgVals[i] = (aChart.series.items[0].data.values[i] + aChart.series.items[1].data.values[i]) / 2;
}
avg.data.values = avgVals;
avg.data.x = aChart.series.items[0].data.x;
avg.format.stroke.size = 2;
avg.smooth = 0.5;
aChart.addSeries(avg);
//tooltip
tip = new Tee.ToolTip(aChart);
tip.render = "dom";
tip.findPoint = false;
tip.domStyle = "padding-left:8px; padding-right:8px; padding-top:0px; padding-bottom:4px; margin-left:5px; margin-top:0px; ";
tip.domStyle = tip.domStyle + "background-color:#FCFCFC; border-radius:4px 4px; color:#FFF; ";
tip.domStyle = tip.domStyle + "border-style:solid;border-color:#A3A3AF;border-width:1px; z-index:1000;";
aChart.tools.add(tip);
tip.onhide = function () { scaling = 0; poindex = -1; }
var t = new Tee.CursorTool(aChart);
t.direction = "vertical";
tip.onshow = function (tool, series, index) {
if (!enableCursor) {
aChart.tools.add(t);
enableCursor = true;
}
}
tip.ongettext = function (tool, text, series, index) {
var t, s = "", ser;
for (t = 0; t < aChart.series.count(); t++) {
if (t > 0) s += " ";
ser = aChart.series.items[t];
s += '' + ser.title + ': ' + ser.data.values[index].toFixed(2) + '';
}
//console.log(index);
return s;
}
aChart.applyTheme("minimal");
//animation
animation = new Tee.SeriesAnimation();
animation.duration = 1500;
animation.kind = "each";
fadeAnimation = new Tee.FadeAnimation();
fadeAnimation.duration = 500;
fadeAnimation.fade.series = true;
fadeAnimation.fade.marks = true;
animation.mode = "linear";
fadeAnimation.mode = "linear";
animation.items.push(fadeAnimation);
animation.animate(aChart);
}
```
--------------------------------
### Generate Appointments Chart in C#
Source: https://github.com/steema/teechart-net-pro-samples/blob/main/Blazor/NET 8/TeeChartOnBlazor/Resources/apptStr.txt
This C# code snippet demonstrates the generation of an Appointments chart using the TeeChart .NET Pro library. It initializes chart data, series names, and labels, then uses the ChartTable class to load the chart configuration. The code also sets the chart title and includes a JavaScript file for potential client-side interactivity.
```csharp
if (chartType == 101) //appointments chart
{
//title
string aTitle = "Appointments";
//Year labels
string[] xLabels = new string[] { "2019", "2020", "2021", "2022", "2023" };
//Series names
string[] sNames = new string[] { "Ancillaries", "Core staff" };
//Chart data
double?[,] apptData = new double?[,] {
{ /*Ancillaries*/ 10,12,31,34,16 },
{ /*Core*/ 5,7,12,12,3 }};
MultiBars stack = MultiBars.Stacked;
int incr = 5; //left axis increment
ChartTable cGen = new ChartTable();
chartJS = await cGen.loadAppointmentsChart(aTitle, sNames, apptData,
stack, xLabels, newLineLabel(xLabels),
incr);
title = aTitle;
supportUnit = "";
}
```
--------------------------------
### Create 3D Surface Plot
Source: https://context7.com/steema/teechart-net-pro-samples/llms.txt
Generates three-dimensional surface plots for scientific data visualization. This example fills the surface with sample data and enables the 3D view. Dependencies: Steema.TeeChart.Maui, Steema.TeeChart.Styles.
```csharp
using Steema.TeeChart.Maui;
using Steema.TeeChart.Styles;
var chart = new TChart();
var surface = new Surface(chart.Chart);
// Fill with sample 3D data
surface.FillSampleValues();
// Enable 3D view
chart.Chart.Aspect.View3D = true;
```
--------------------------------
### Setup TeeChart.js Tooltip Display Format in JavaScript
Source: https://github.com/steema/teechart-net-pro-samples/blob/main/Blazor/NET 8/TeeChartOnBlazor/Resources/apptJStr.txt
This JavaScript snippet configures the tooltip display for a TeeChart.js chart. It defines the tooltip's rendering mode, delay, auto-hide behavior, and custom DOM styles for appearance. It also includes an event handler (`ongettext`) to format the tooltip content dynamically based on series data and labels.
```javascript
//tooltip
tip = new Tee.ToolTip(aChart);
tip.render = "dom";
tip.delay = 3000;
tip.autoHide = true;
//tip.findPoint = true;
tip.domStyle = "padding-left:8px; padding-right:8px; padding-top:0px; padding-bottom:4px; margin-left:5px; margin-top:0px; ";
tip.domStyle = tip.domStyle + "background-color:#FCFCFC; border-radius:4px 4px; color:#FFF; ";
tip.domStyle = tip.domStyle + "border-style:solid;border-color:#A3A3AF;border-width:1px; z-index:1000;";
aChart.tools.add(tip);
tip.onhide = function () { scaling = 0; poindex = -1; }
tip.ongettext = function (tool, text, series, index) {
var t, s = "", ser;
s += '' + aChart.series.items[0].data.labels[index] + '';
for (t = 0; t < aChart.series.count(); t++) {
ser = aChart.series.items[t];
if (!Number.isNaN(ser.data.values[index])) {
s += " ";
s += '' + ser.title + ': '
+ aChart.axes.left.labels.formatValueString(ser.data.values[index]) + '';
}
}
return s;
}
```
--------------------------------
### .NET MAUI XAML Declaration for TeeChart Integration
Source: https://context7.com/steema/teechart-net-pro-samples/llms.txt
Provides an example of declaring a TeeChart component in a .NET MAUI application's XAML. It specifies the namespace for Steema.TeeChart.Maui and binds the Drawable property. The TChart control is named 'tChart1' and is configured with height and alignment properties to fill its layout container.
```xml
```
--------------------------------
### Create MAUI Dashboard Programmatically
Source: https://context7.com/steema/teechart-net-pro-samples/llms.txt
Demonstrates how to create a multi-chart dashboard in MAUI by programmatically adding various chart types (NumericGauge, Donut, Bar) to a Grid layout. This requires the Steema.TeeChart.Maui library.
```csharp
using Steema.TeeChart.Maui;
using Steema.TeeChart.Styles;
using System.Drawing;
public class Dashboard : ContentPage
{
public Dashboard()
{
Grid grid = new()
{
RowDefinitions =
{
new RowDefinition { Height = new GridLength(100) },
new RowDefinition { Height = new GridLength(2, GridUnitType.Star) },
new RowDefinition(),
},
ColumnDefinitions =
{
new ColumnDefinition(),
new ColumnDefinition(),
new ColumnDefinition()
}
};
// Gauge chart
var gaugeChart = new TChart();
gaugeChart.Drawable = gaugeChart;
gaugeChart.Chart.Header.Visible = false;
gaugeChart.Chart.Series.Add(new NumericGauge());
gaugeChart.Chart.Series[0].FillSampleValues();
gaugeChart.HorizontalOptions = LayoutOptions.FillAndExpand;
gaugeChart.VerticalOptions = LayoutOptions.FillAndExpand;
grid.Add(gaugeChart, 0, 0);
// Donut chart
var donutChart = new TChart();
donutChart.Drawable = donutChart;
donutChart.Chart.Header.Visible = false;
donutChart.Chart.Series.Add(new Donut());
donutChart.Chart.Legend.Alignment = Steema.TeeChart.LegendAlignments.Bottom;
((Donut)donutChart.Chart.Series[0]).Marks.Visible = false;
((Donut)donutChart.Chart.Series[0]).Circled = true;
donutChart.Chart.Series[0].FillSampleValues();
grid.Add(donutChart, 0, 1);
// Bar chart
var barChart = new TChart();
barChart.Drawable = barChart;
barChart.Chart.Header.Visible = false;
barChart.Chart.Series.Add(new Bar());
barChart.Chart.Series[0].FillSampleValues();
barChart.Chart.Series[0].Marks.Visible = false;
barChart.Chart.Legend.Visible = false;
grid.Add(barChart, 2, 2);
Title = "TeeChart Dashboard";
Content = grid;
}
}
```
--------------------------------
### Create and Configure Line Chart in .NET MAUI
Source: https://context7.com/steema/teechart-net-pro-samples/llms.txt
Demonstrates how to create a Line series in a TChart for .NET MAUI. It includes adding sample data, customizing line appearance such as width, end caps, smoothing, and pointer styles, and configuring chart interaction like zooming.
```csharp
using Steema.TeeChart.Maui;
using Steema.TeeChart.Styles;
// Create TChart and add Line series
var chart = new TChart();
var line = new Line(chart.Chart);
// Fill with sample data or add points manually
line.FillSampleValues();
// Or add custom data points
line.Clear();
line.Add(DateTime.Now.ToOADate(), 25.5);
line.Add(DateTime.Now.AddDays(1).ToOADate(), 28.3);
line.Add(DateTime.Now.AddDays(2).ToOADate(), 22.1);
// Configure line appearance
line.LinePen.Width = 3;
line.LinePen.EndCap = Steema.TeeChart.Drawing.LineCap.Round;
line.Smoothed = true;
// Enable data point markers
line.Pointer.Visible = true;
line.Pointer.Style = PointerStyles.Circle;
line.Pointer.HorizSize = 6;
line.Pointer.VertSize = 6;
// Enable gradient on pointers
line.Pointer.Gradient.Visible = true;
line.Pointer.Brush.Gradient.StartColor = System.Drawing.Color.White;
line.Pointer.Brush.Gradient.EndColor = System.Drawing.Color.FromArgb(220, 53, 69);
// Configure chart interaction
chart.Chart.Panning.Active = false;
chart.Chart.Zoom.Active = true;
chart.Chart.Aspect.View3D = false;
```
--------------------------------
### Create and Configure Area Chart in .NET MAUI
Source: https://context7.com/steema/teechart-net-pro-samples/llms.txt
Demonstrates creating an Area chart in .NET MAUI with TeeChart. It includes filling with sample data, setting the area color, enabling smoothing, hiding area lines, and toggling the 3D view.
```csharp
using Steema.TeeChart.Maui;
using Steema.TeeChart.Styles;
using System.Drawing;
var chart = new TChart();
var area = new Area(chart.Chart);
// Fill with sample data
area.FillSampleValues();
// Configure area color
area.Color = Color.Blue;
// Enable smoothing
area.Smoothed = true;
area.AreaLines.Visible = false;
// Toggle 3D view
chart.Chart.Aspect.View3D = false;
```
--------------------------------
### Create Candle (Financial) Chart in .NET
Source: https://context7.com/steema/teechart-net-pro-samples/llms.txt
Shows how to create a Candle (candlestick) chart for financial data visualization using TeeChart. It includes filling with sample financial data, configuring the date-time X-axis, and adding a CursorTool for interactive inspection.
```csharp
using Steema.TeeChart;
using Steema.TeeChart.Styles;
var chart = new TChart();
var candle = new Candle(chart.Chart);
// Fill with sample financial data
candle.FillSampleValues();
// Configure date-time X-axis
candle.XValues.DateTime = true;
chart.Axes.Bottom.Labels.DateTimeFormat = "shortDate";
// Add CursorTool for interactive inspection
var cursorTool = new Steema.TeeChart.Tools.CursorTool(chart.Chart);
cursorTool.Style = CursorToolStyles.Both;
chart.Tools.Add(cursorTool);
```
--------------------------------
### Create Gantt Chart Visualization
Source: https://context7.com/steema/teechart-net-pro-samples/llms.txt
Generates a Gantt chart for project timeline and scheduling visualizations. It includes sample data, task dependency configuration, and gradient settings. Dependencies: Steema.TeeChart, Steema.TeeChart.Styles.
```csharp
using Steema.TeeChart;
using Steema.TeeChart.Styles;
var chart = new TChart();
var gantt = new Gantt(chart.Chart);
// Fill with sample task data
gantt.FillSampleValues(9);
// Configure task dependencies
gantt.NextTasks[0] = 6;
// Configure gradient
gantt.Brush.Gradient.Visible = false;
// Configure axis labels
chart.Axes.Left.Title.Text = "Task";
```
--------------------------------
### Create and Configure Bar Chart in .NET
Source: https://context7.com/steema/teechart-net-pro-samples/llms.txt
Shows how to create a Bar series in a TChart, including filling with sample data, customizing bar appearance like color, width, and gradient fills, and adding data points with labels. It also demonstrates hiding marks and configuring custom bar widths.
```csharp
using Steema.TeeChart;
using Steema.TeeChart.Styles;
using System.Drawing;
var chart = new TChart();
var bar = new Bar(chart.Chart);
// Fill with sample values
bar.FillSampleValues(10);
// Configure bar appearance
bar.ColorEach = false;
bar.Color = Color.FromArgb(52, 152, 219);
bar.BarWidthPercent = 60;
bar.BarStyle = BarStyles.RectGradient;
bar.Transparency = 20;
// Configure gradient
bar.Gradient.Visible = true;
bar.Gradient.StartColor = Color.LightBlue;
bar.Gradient.EndColor = Color.FromArgb(136, 193, 231);
bar.Gradient.Direction = Steema.TeeChart.Drawing.LinearGradientMode.ForwardDiagonal;
// Add data with labels
bar.Clear();
bar.Add(25.5, "Monday");
bar.Add(32.1, "Tuesday");
bar.Add(18.7, "Wednesday");
bar.Add(45.2, "Thursday");
bar.Add(38.9, "Friday");
// Hide marks
bar.Marks.Visible = false;
// Configure custom bar width
bar.CustomBarWidth = 45;
```
--------------------------------
### Create Pie and Donut Charts in .NET
Source: https://context7.com/steema/teechart-net-pro-samples/llms.txt
Provides code for creating both Pie and Donut charts using TeeChart. It covers filling with sample data, configuring mark visibility and appearance for Pie charts, and setting the donut hole and legend alignment.
```csharp
using Steema.TeeChart;
using Steema.TeeChart.Styles;
using System.Drawing;
var chart = new TChart();
// Pie Chart
var pie = new Pie(chart.Chart);
pie.FillSampleValues();
// Configure marks
pie.Marks.Visible = true;
pie.Marks.Arrow.Visible = false;
pie.Marks.Transparent = true;
pie.Marks.Font.Color = Color.White;
// Donut Chart
var donut = new Donut(chart.Chart);
donut.FillSampleValues();
donut.Circled = true;
donut.Pen.Visible = false;
donut.Marks.Visible = false;
// Configure legend
chart.Chart.Legend.Alignment = Steema.TeeChart.LegendAlignments.Bottom;
```
--------------------------------
### Load Raw Asset using Essentials FileSystem API
Source: https://github.com/steema/teechart-net-pro-samples/blob/main/MAUI/TeeChart.Maui.Demo/Resources/Raw/AboutAssets.txt
This C# code snippet shows how to load a raw asset that has been deployed with your .NET MAUI application. It utilizes the `FileSystem.OpenAppPackageFileAsync` method from the Essentials library to open a stream to the specified asset file. The content of the asset is then read into a string using a `StreamReader`.
```csharp
async Task LoadMauiAsset()
{
using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt");
using var reader = new StreamReader(stream);
var contents = reader.ReadToEnd();
}
```
--------------------------------
### Using Open Iconic SVGs
Source: https://github.com/steema/teechart-net-pro-samples/blob/main/MAUI/MauiBlazorApp/wwwroot/css/open-iconic/README.md
Demonstrates how to embed Open Iconic SVG files directly into HTML using the `` tag. Ensure to include an `alt` attribute for accessibility.
```html
```
--------------------------------
### Using Open Iconic SVG Sprite
Source: https://github.com/steema/teechart-net-pro-samples/blob/main/MAUI/MauiBlazorApp/wwwroot/css/open-iconic/README.md
Illustrates how to use Open Iconic's SVG sprite for efficient icon display. It shows how to reference icons using the `