delete to highlow data

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
dove
Newbie
Newbie
Posts: 3
Joined: Tue Jun 27, 2006 12:00 am

delete to highlow data

Post by dove » Thu Aug 17, 2006 12:28 am

Hi.

I'm trying to delete first point in highlow chart. but the highlow chart is displayed strange

line chart is good.


I used the following code to delete

Code: Select all

private void btnDelete_Click(object sender, System.EventArgs e)
{
	for (int index1 = 0; index1 < tChart1.Series.Count; index1++)
	{
		if (tChart1.Series.Count > 0)
		{
			tChart1.Series[index1].Delete(0);
			tChart1.Series[index1].RefreshSeries();
			tChart1.Series[index1].Repaint();
		}
	}

	tChart1.Refresh();
	tChart1.Update();
}
Thanks,

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Thu Aug 17, 2006 7:13 am

Hello,

This seems to work ok with code similar to the following:

Code: Select all

    public Form1()
    {
      InitializeComponent();
      InitializeChart();
    }

    private void InitializeChart()
    {
      tChart1.Series.Add(new Steema.TeeChart.Styles.HighLow());
      tChart1.Series.Add(new Steema.TeeChart.Styles.Line());
      tChart1[0].FillSampleValues();
      tChart1[1].FillSampleValues();
    }

    private void button1_Click(object sender, EventArgs e)
    {
      for (int index1 = 0; index1 < tChart1.Series.Count; index1++)
      {
        if (tChart1.Series.Count > 0)
        {
          tChart1.Series[index1].Delete(0);
          tChart1.Series[index1].RefreshSeries();
          tChart1.Series[index1].Repaint();
        }
      }
      tChart1.Refresh();
      tChart1.Update(); 
    }
Could you please modify the above code and send it back to me so that I can reproduce the problem here?

Many thanks!!
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

dove
Newbie
Newbie
Posts: 3
Joined: Tue Jun 27, 2006 12:00 am

Post by dove » Thu Aug 17, 2006 11:07 am

Thanks!
but I can't see correct data in my chart...

please see the following code :

Code: Select all


private void btnChart_Click(object sender, System.EventArgs e)
{
	chartUtil.ChartClear(tChart1);
	Line lineSeries = chartUtil.AddLineSeries(tChart1, "TEST", VerticalAxis.Left, Color.Blue, false, true);
	lineSeries.Add(lineSeries.Count, 0, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 1, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 2, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 3, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 4, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 5, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 5, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 5, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 5, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 5, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 5, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 4, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 3, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 2, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 1, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 0, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 1, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 2, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 3, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 4, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 5, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 5, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 5, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 5, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 5, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 5, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 4, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 3, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 2, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 1, "", lineSeries.Color);
	lineSeries.Add(lineSeries.Count, 0, "", lineSeries.Color);

	HighLow highLowSeries = chartUtil.AddHighLowSeries(tChart1, "SPEC", VerticalAxis.Left, Color.Green, false, false);
	for (int index1 = 0; index1 < lineSeries.Count; index1++)
	{
		highLowSeries.Add(lineSeries.XValues[index1], lineSeries.YValues[index1] - 0.5, lineSeries.YValues[index1] + 0.5, "", highLowSeries.Color);
	}

	highLowSeries.Pen.Visible = true; 
	highLowSeries.HighBrush.Visible = true; 
	highLowSeries.LowBrush.Visible = true; 
	highLowSeries.HighPen.Color = Color.Green; 
	highLowSeries.LowPen.Color = Color.Blue; 
	highLowSeries.ShowInLegend = false; 

	chartUtil.LegendInitialize(tChart1, LegendStyles.Series, LegendTextStyles.Plain, true);
	chartUtil.SetAxisMinMax(tChart1.Axes.Left, 30, 30);
	chartUtil.SetAxisLabel(tChart1.Axes.Left, AxisLabelStyle.Value);
	chartUtil.SetAxisLabel(tChart1.Axes.Bottom, AxisLabelStyle.Value);
}


private void btnDelete_Click(object sender, System.EventArgs e)
{
	for (int index1 = 0; index1 < tChart1.Series.Count; index1++)
	{
		if (tChart1.Series.Count > 0)
		{
			tChart1.Series[index1].Delete(0);
			tChart1.Series[index1].RefreshSeries();
			tChart1.Series[index1].Repaint();
		}
	}
	tChart1.Refresh();
	tChart1.Update();
}


Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Thu Aug 17, 2006 2:16 pm

Hello,

OK, I've been able to reproduce your problem here. It's an interesting defect, as it only seems to occur because of a specific characteristic of your data combined with the use of the Series.Delete() function. You can work around the problem by re-adding in your data, e.g.

Code: Select all

 public Form1()
    {
      InitializeComponent();
      InitializeArrays();
      InitializeChart();
    }

    private int[] xValues;
    private int[] yValues;
    private void InitializeArrays()
    {
      xValues = new int[31];
      yValues = new int[31];

      int length = 31;
      int val = 0;
      for (int i = 0; i < length; i++)
      {
        xValues[i] = i;
        val = i % 15;
        if (val > 6)
        {
          val = 15 - val;
        }
        if (val > 4)
        {
          val = 5;
        }
        yValues[i] = val;
      }
    }

    private Steema.TeeChart.Styles.HighLow highLowSeries;
    private Steema.TeeChart.Styles.Line lineSeries;
    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;
      lineSeries = new Steema.TeeChart.Styles.Line(tChart1.Chart);
      highLowSeries = new Steema.TeeChart.Styles.HighLow(tChart1.Chart);
      for (int index1 = 0; index1 < yValues.Length; index1++)
      {
        lineSeries.Add(xValues[index1], yValues[index1]);
        highLowSeries.Add(xValues[index1], yValues[index1] + 0.5, yValues[index1] - 0.5, "", highLowSeries.Color);
      }
    }

    private void button1_Click(object sender, EventArgs e)
    {
      highLowSeries.Clear();
      lineSeries.Clear();

      for (int index1 = 1; index1 < yValues.Length; index1++)
      {
        lineSeries.Add(xValues[index1], yValues[index1]);
        highLowSeries.Add(xValues[index1], yValues[index1] + 0.5, yValues[index1] - 0.5, "", highLowSeries.Color);
      }
    }
I have added this issue to our list of defects meaning that a fix to it will be considered for inclusion into our next maintenance release.
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Thu Aug 17, 2006 2:24 pm

Hello,

In fact, a better work around is to use your original code and to replace the code in the button with:

Code: Select all

  private void button1_Click(object sender, EventArgs e)
    {
      for (int index1 = 0; index1 < tChart1.Series.Count; index1++)
      {
        if (tChart1.Series.Count > 0)
        {
          tChart1.Series[index1].Delete(0);
          if (tChart1.Series[index1] is Steema.TeeChart.Styles.HighLow)
          {
            (tChart1.Series[index1] as Steema.TeeChart.Styles.HighLow).LowValues.RemoveAt(0);
          }
        }
      }
    }
I've now fixed this for the upcoming maintenance release.
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

dove
Newbie
Newbie
Posts: 3
Joined: Tue Jun 27, 2006 12:00 am

Post by dove » Fri Aug 18, 2006 12:41 am

Hi,

Thank you very much~

This seems to work ok with following:

Code: Select all

if (tChart1.Series[index1] is Steema.TeeChart.Styles.HighLow) 
{ 
	(tChart1.Series[index1] as Steema.TeeChart.Styles.HighLow).LowValues.RemoveAt(0); 
} 

Post Reply