Page 1 of 1

Inheriting from Line serie

Posted: Fri Apr 08, 2022 2:33 pm
by 15693565
I need to inherit my OwnLine series from Line series. It works perfectly except when selected in ChartEditor dialog.
Any override I'm missing?
Thanks a lot.

public class TSWXLineSerie : Line
{
public TSWXLineSerie() : base()
{
}
public TSWXLineSerie(TChart chart) : base(chart.Chart)
{
this.VertAxis = VerticalAxis.Left;
this.HorizAxis= HorizontalAxis.Bottom;

}
public TSWXLineSerie(TChart chart, HorizontalAxis x, VerticalAxis y) : base(chart.Chart)
{
//this.ChartType = SeriesChartType.Line;
this.HorizAxis = x;
this.VertAxis = y;
}
public TSWXLineSerie(TChart chart, string sName) :base(chart.Chart)
{
//this.ChartType = SeriesChartType.Line;
this.Title = sName;
}
public TSWXLineSerie(TChart chart, string sName, HorizontalAxis x, VerticalAxis y) : base(chart.Chart)
{
//this.ChartType = SeriesChartType.Line;
this.HorizAxis = x;
this.VertAxis = y;
this.Title = sName;
}
public override string ToString()
{
return "TSWXLineSerie|Unit Enabled Series";
}
public override string Description
{
get
{
return "SimWorx Line Series";
}
}

public override ObjRef CreateObjRef(Type requestedType)
{
return base.CreateObjRef(requestedType);
} ....

Re: Inheriting from Line serie

Posted: Tue Apr 12, 2022 12:21 pm
by Christopher
Hello,

you can register your overridden series so it appears in the Chart Editor, e.g.

Code: Select all

  public partial class Form1 : Form
  {
    public Form1()
    {
      Utils.RegisterSeries(typeof(MyLine), typeof(MyLineEditor), 7 /*Other*/, 1);
      InitializeComponent();
      var line = new Line(tChart1.Chart);
      line.FillSampleValues();

      var myline = new MyLine(tChart1.Chart);
      myline.FillSampleValues();

    }


    private void button1_Click(object sender, System.EventArgs e)
    {
      tChart1.ShowEditor();
    }
  }

  public class MyLine : Line
  {
    public MyLine(Chart c) : base(c)
    {
      
    }

    public MyLine() : this(null)
    {

    }

    public override string Description => "My New Line";
  }

  public class MyLineEditor : Steema.TeeChart.Editors.Series.CustomSeries
  {
     public MyLineEditor(Series series, Control parent) : base(series, parent)
     {

     }

     public MyLineEditor(Series series) : base(series)
     {

     }

     public MyLineEditor() : base()
     {

     }
  }
Which gives us:
Screenshot from 2022-04-12 14-18-28.png
Screenshot from 2022-04-12 14-18-28.png (41 KiB) Viewed 6175 times
Screenshot from 2022-04-12 14-18-48.png
Screenshot from 2022-04-12 14-18-48.png (53.07 KiB) Viewed 6175 times

Re: Inheriting from Line serie

Posted: Tue Apr 12, 2022 2:12 pm
by 15693565
Perfect! Thanks a lot!