Is it possible to draw a graph without passing values to other charts just by doing RenderableSeries.Add?
in WPF C#
- SEONG JEONGWOO asked 4 months ago
- Hi there, I’m not sure what you need. Can you explain?
- You must login to post comments
Yes,
you have to draw a graph in WPF by adding a RenderableSeries directly to the SciChartSurface, without passing values to other charts explicitly. Just create a DataSeries, add data points to it, create a RenderableSeries (e.g., LineRenderableSeries), set its data series, and add it to the RenderableSeries collection of the SciChartSurface.
That’s it – the graph will be displayed based on the provided data series.
using System.Windows;
using SciChart.Charting.Model.DataSeries;
using SciChart.Charting.Visuals;
using SciChart.Charting.Visuals.RenderableSeries;
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
var sciChartSurface = new SciChartSurface();
chartContainer.Children.Add(sciChartSurface);
// Create a new XyDataSeries<double, double> to hold your data points
var dataSeries = new XyDataSeries<double, double>();
// Add data points to the data series (x, y) coordinates
dataSeries.Append(1.0, 10.0);
dataSeries.Append(2.0, 20.0);
dataSeries.Append(3.0, 15.0);
// Add more data points as needed...
// Create a new LineRenderableSeries and add the data series to it
var renderableSeries = new LineRenderableSeries()
{
DataSeries = dataSeries,
Stroke = System.Windows.Media.Colors.Blue, // Set the line color
StrokeThickness = 2 // Set the line thickness
};
// Add the LineRenderableSeries to the SciChartSurface
sciChartSurface.RenderableSeries.Add(renderableSeries);
}
}
- Albina Aguerette answered 4 months ago
- last edited 4 months ago
- You must login to post comments
As far as I know, you can indeed create and draw a graph by using the RenderableSeries.Add method without explicitly passing values to other charts. However, to display any meaningful data on the graph, you still need to provide data points to the chart’s DataSeries before adding the RenderableSeries.
- Ijeta Anar answered 4 months ago
- last edited 4 months ago
- You must login to post comments
Please login first to submit.