Inheriting from Line serie

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
longhin
Newbie
Newbie
Posts: 2
Joined: Fri Apr 08, 2022 12:00 am

Inheriting from Line serie

Post by longhin » Fri Apr 08, 2022 2:33 pm

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);
} ....
Attachments
PotentialBugInChartEditor.rar
PDF with screenshot sequence
(181.71 KiB) Downloaded 572 times

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Inheriting from Line serie

Post by Christopher » Tue Apr 12, 2022 12:21 pm

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 6148 times
Screenshot from 2022-04-12 14-18-48.png
Screenshot from 2022-04-12 14-18-48.png (53.07 KiB) Viewed 6148 times
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

longhin
Newbie
Newbie
Posts: 2
Joined: Fri Apr 08, 2022 12:00 am

Re: Inheriting from Line serie

Post by longhin » Tue Apr 12, 2022 2:12 pm

Perfect! Thanks a lot!

Post Reply