but i think the method is complicated or something wrong, for example when i use this Eto.OxyPlot.Plot()
i got this error
Runtime error (ArgumentOutOfRangeException): Specified argument was out of the range of valid values.
Parameter name: Type for 'Eto.OxyPlot.Plot' could not be found in this platform
Traceback:
line 13, in script
I will try to find a way to make windows chart work with eto form, i donât think oxyplot work with ironpython
IronPython is just C# with Python syntax. Again, you can try to directly use WPF. That definitely works. I think its just that you are missing some reference. Do you see any dll I mentioned? They are about 600kb in total
This created with windows form, but Eto looks better and many examples and tutorials available in Rhino website, also windows form loaded very slowly when i open the gh file.
Thank you , i use python , c# is very complicated
I tried to design windows form in visual studio and than use the code with Ghpython , i hope Rhino developers add a tool to create design forms like in visual studio
import clr
basePath = "c:\\path\\to\\your\\lib\\folder\\"
clr.AddReferenceToFileAndPath(basePath + "OxyPlot.dll")
clr.AddReferenceToFileAndPath(basePath + "OxyPlot.Wpf.dll")
clr.AddReferenceToFileAndPath(basePath + "OxyPlotExample.exe")
from OxyPlotExample import MainWindow
import System.Windows as sw
import Rhino
import OxyPlot as oxy
import System
from System.Collections.Generic import List
exWnd = MainWindow();
# Populate with example points
exWnd.DrawExample(50)
# Create a series from Rhino and pass it over
list = List[oxy.DataPoint]()
list.Add(oxy.DataPoint(1,5))
list.Add(oxy.DataPoint(1,6))
list.Add(oxy.DataPoint(1,7))
list.Add(oxy.DataPoint(1,8))
exWnd.Draw(list)
exWnd.ShowDialog()
In Visual Studio create a WPF Application targeting Net Framework 4.5 (not Core!!!).
Get the nuget package OxyPlot.Wpf (downloads OxyPlot.Core).
using OxyPlot;
using OxyPlot.Axes;
using OxyPlot.Series;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace OxyPlotExample
{
/// <summary>
/// Interaktionslogik fĂźr MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private PlotModel _model;
public MainWindow()
{
InitializeComponent();
InitOxy();
//DrawExample(30);
}
/// <summary>
/// Initializes Oxyplot (Non-MVVM)
/// </summary>
private void InitOxy()
{
_model = new OxyPlot.PlotModel();
_model.Axes.Add(new LinearAxis() { Title = "X", Minimum = 0.0, Maximum = 10.0 });
_model.Axes.Add(new LinearAxis() { Title = "Y", Minimum = 0.0, Maximum = 10.0 });
_plotView.Model = _model;
DrawExample(50);
}
public void Draw(IEnumerable<DataPoint> points)
{
var series = new LineSeries(); // cache it if frequently changed
series.Points.AddRange(points);
_model.Series.Add(series);
_model.InvalidatePlot(true); // Redraw
}
public void DrawExample(int n)
{
DataPoint[] points = new DataPoint[n];
Random rnd = new Random(42);
for (int i = 0; i < n; i++)
{
points[i] = new DataPoint(i*0.1, rnd.NextDouble() * 10);
}
Draw(points);
}
}
}
And compile⌠Donât forget to reference the path to these files in the Python script.
If you donât want to do the VS part, take the following example compilation: