Page 1 of 1

Teechart for WPF

Posted: Thu May 05, 2016 5:59 pm
by 15677525
1) i want to do real time chart with Different Point styles( Fast Pen with Point style). do you got any examples in wpf
2) i had to draw vertical cursor on X axis(Date time). when i append the values, Cursor seems to be moving with time. is there any fixed cursor position examples
3) MarkTip for Pen does not get closed some times randomly. is there any examples to share on how to use them

i use Teechart 2015(TeeChartNET2015_4.1.2015.05140.exe)

Re: Teechart for WPF

Posted: Mon May 09, 2016 2:48 pm
by Christopher
Hello,

If I may, I have created some code examples which I will detail after each question:
Axcelis-Siva wrote:1) i want to do real time chart with Different Point styles( Fast Pen with Point style). do you got any examples in wpf

Code: Select all

    public MainWindow()
    {
      Utils.CalcFramesPerSecond = true;
      InitializeComponent();
      InitializeChart();
    }

    Steema.TeeChart.WPF.Styles.Line line1, line2;
    DispatcherTimer timer = new DispatcherTimer();
    Random rnd = new Random();
    int counter = 0;
    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;
      timer.Interval = new TimeSpan(10000);
      timer.Tick += Timer_Tick;

      line1 = new Steema.TeeChart.WPF.Styles.Line(tChart1.Chart);
      line1.Pointer.Visible = true;

      line2 = new Steema.TeeChart.WPF.Styles.Line(tChart1.Chart);
      line2.Pointer.Visible = true;
      line2.Pointer.Style = PointerStyles.Diamond;


      timer.Start();
    }

    private void Timer_Tick(object sender, EventArgs e)
    {

      line1.Add(counter, rnd.Next(100));
      line2.Add(counter, rnd.Next(100));
      counter++;

      tChart1.Axes.Bottom.SetMinMax(counter - 50, counter);

      if(line1.Count > 200)
      {
        line1.Delete(0, 100);
        line2.Delete(0, 100);
      }

      tChart1.Header.Text = Utils.FramesPerSecond.ToString();
    }
Here this runs at about 65 fps.
Axcelis-Siva wrote: 2) i had to draw vertical cursor on X axis(Date time). when i append the values, Cursor seems to be moving with time. is there any fixed cursor position examples

Code: Select all

    Steema.TeeChart.WPF.Styles.Line line1;
    private void InitializeChart()
    {

      tChart1.Aspect.View3D = false;

      line1 = new Steema.TeeChart.WPF.Styles.Line(tChart1.Chart);
      line1.Pointer.Visible = true;

      DateTime today = DateTime.Today;
      Random rnd = new Random();

      for (int i = 0; i < 40; i++)
      {
        line1.Add(today, rnd.Next(100));
        today = today.AddDays(1);
      }

      tChart1.AfterDraw += TChart1_AfterDraw;
    }

    private void TChart1_AfterDraw(object sender, Graphics3D g)
    {
      DateTime date = DateTime.Today.AddDays(10);
      g.Pen.Width = 5;
      g.Pen.Color = Colors.Red;
      g.VerticalLine(line1.CalcXPosValue(date.ToOADate()), tChart1.Axes.Left.IStartPos, tChart1.Axes.Left.IEndPos);  
    }
Axcelis-Siva wrote: 3) MarkTip for Pen does not get closed some times randomly. is there any examples to share on how to use them

Code: Select all

    Steema.TeeChart.WPF.Styles.Line line1;
    MarksTip tool1;

    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;

      line1 = new Steema.TeeChart.WPF.Styles.Line(tChart1.Chart);
      line1.Pointer.Visible = true;
      line1.FillSampleValues();
      line1.Marks.Visible = true;

      tool1 = new MarksTip(tChart1.Chart);
      tool1.Series = line1;
    }

Re: Teechart for WPF

Posted: Wed Nov 09, 2016 8:09 pm
by 15677525
i have one more question

i use MarksTip for tool tip for a line

var series = new Line(tChart1.Chart);

MarksTip tooltip = new Steema.TeeChart.WPF.Tools.MarksTip(tChart1.Chart);

tooltip.Series = series;
tooltip.Active = true;

series.GetSeriesMark += getCurserValue;

when i leave the screen for , some times tooltip sticks around.

i am trying to close tooltip by setting


tooltip.Active = false;

still tooltip sticks around some times . is there any way to close it programmatically

Re: Teechart for WPF

Posted: Thu Nov 10, 2016 9:43 am
by Christopher
Axcelis-Siva wrote: when i leave the screen for , some times tooltip sticks around.
Using the same code for the MarksTip tool I posted in my last message in this thread, could you please tell me how I can reliably reproduce this problem? I can't seem to be able to reproduce it here having playing around with it for ten minutes or so.