Page 1 of 1

axis labels and title overlaping for many vertical axes

Posted: Wed Mar 30, 2016 9:25 am
by 15675274
hello
I hava two Problems,please help me.
Frist,Look the picture axis labels and title overlaping for many vertical axes.I want title on the left all the time,What should I do ?
Second,I want to draw a curve.when I set line.Smoothed = true; the Interface is not refresh. What should I do ?

Re: axis labels and title overlaping for many vertical axes

Posted: Wed Mar 30, 2016 1:14 pm
by Christopher
Chinfot wrote: Frist,Look the picture axis labels and title overlaping for many vertical axes.I want title on the left all the time,What should I do ?
You can use the CustomSize property, e.g.

Code: Select all

    private void InitializeChart()
    {
      tChart1.Series.Add(typeof(Line)).FillSampleValues();

      tChart1.Axes.Left.Title.Text = "Left Title";
      tChart1.Axes.Left.Title.Angle = 90;
      tChart1.Axes.Left.Labels.CustomSize = 100;
    }
Chinfot wrote: Second,I want to draw a curve.when I set line.Smoothed = true; the Interface is not refresh. What should I do ?
This seems to work as expected here, e.g.

Code: Select all

	Line line;
    private void InitializeChart()
    {
      line = new Line(tChart1.Chart);
      line.FillSampleValues();
    }

    private void button4_Click(object sender, EventArgs e)
    {
      line.Smoothed = true;
    }
Can you please post some code with which we can reproduce your problem?

Re: axis labels and title overlaping for many vertical axes

Posted: Thu Mar 31, 2016 9:48 am
by 15675274
the Line's Datasource is not fixed.when I set line.Smoothed = true; Interface cannot refresh. The following code.

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
line = new Line(tChart1.Chart);
timer1 = new Timer();
timer1.Interval = 2000;
timer1.Tick += new System.EventHandler(this.timer1_Tick_1);
timer1.Enabled = true;
timer1.Start();
}
Random rd = new Random(400);
Line line;
Timer timer1;

private void timer1_Tick_1(object sender, EventArgs e)
{
PointModel buffer = new PointModel();
for (int i = 0; i < 50; i++)
{
buffer.X = i;
if (i % 2 == 0)
{
buffer.Y = i + Convert.ToDouble(rd.Next(10, 50).ToString());
}
else
{
buffer.Y = i + Convert.ToDouble(rd.Next(10, 50).ToString());
}
}
line.Add(buffer.X, buffer.Y);
}

private void simpleButton1_Click(object sender, EventArgs e)
{
line.Smoothed = true;
}
}
public class PointModel
{
public double[] X=new double[50];

public double[] Y = new double[50];
}

Re: axis labels and title overlaping for many vertical axes

Posted: Thu Mar 31, 2016 10:18 am
by Christopher
Chinfot wrote:the Line's Datasource is not fixed.when I set line.Smoothed = true; Interface cannot refresh.
Okay, I can now see the problem, thank you. The solution is to set Smoothed to true every time you make a change to the series data, e.g.

Code: Select all

    private void timer1_Tick(object sender, EventArgs e)
    {
      PointModel buffer = new PointModel();
      for (int i = 0; i < 50; i++)
      {
        buffer.X[i] = i;
        if (i % 2 == 0)
        {
          buffer.Y[i] = i + Convert.ToDouble(rd.Next(10, 50).ToString());
        }
        else
        {
          buffer.Y[i] = i + Convert.ToDouble(rd.Next(10, 50).ToString());
        }
      }

      line.Smoothed = false;
      line.DataSource = null;
      line.Add(buffer.X, buffer.Y);
      line.Smoothed = true;
    }

Re: axis labels and title overlaping for many vertical axes

Posted: Tue Apr 05, 2016 3:06 am
by 15675274
OK,thank you!