Bottom and Custom Vertical Axis Label Start Position

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Priyanka
Newbie
Newbie
Posts: 19
Joined: Mon Nov 16, 2015 12:00 am

Re: Bottom and Custom Vertical Axis Label Start Position

Post by Priyanka » Thu Jun 09, 2016 9:23 am

Hi Christopher,

Actually I am reading minimum and maximum value from database. So I need to pass that value instead of calculating it. Please suggest.

Also, like to know how to increase image (exporting chart to png format) resolution. How to store the chart/image in database?

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

Re: Bottom and Custom Vertical Axis Label Start Position

Post by Christopher » Thu Jun 09, 2016 11:50 am

Priyanka wrote: Actually I am reading minimum and maximum value from database. So I need to pass that value instead of calculating it. Please suggest.
I'm afraid I don't know what to suggest because I don't know what you are expecting to see. Axis.SetMinMax works as expected, of that there is no doubt. That the values you pass to it do not produce results that you expect is a different matter. What are you expecting to see from the values you pass to Axis.SetMinMax?
Priyanka wrote: Also, like to know how to increase image (exporting chart to png format) resolution.
You can do this with the following:

Code: Select all

        PNGFormat png = tChart1.Chart.Export.Image.PNG;
        png.Height = 2000;
        png.Width = 5000;
        png.Save(@"D:\Trend.png");
Priyanka wrote: How to store the chart/image in database?
I'm not sure how I can help you here, as TeeChart has no code which interacts with databases.
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

Priyanka
Newbie
Newbie
Posts: 19
Joined: Mon Nov 16, 2015 12:00 am

Re: Bottom and Custom Vertical Axis Label Start Position

Post by Priyanka » Thu Jun 09, 2016 12:03 pm

Hi Christopher,

In the earlier trend image Y-axis is showing minimum value as 500. Even if I have set it to 0.3 in code. I am expecting Y-axis should be started from 0.3 (min) to 7500 (no issue with max value it is setting correctly). Basically I don't want chart to auto calculate values based on scale.

Is there any feature or property of tee chart to export it into binary format?

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

Re: Bottom and Custom Vertical Axis Label Start Position

Post by Christopher » Thu Jun 09, 2016 1:44 pm

Priyanka wrote: In the earlier trend image Y-axis is showing minimum value as 500. Even if I have set it to 0.3 in code. I am expecting Y-axis should be started from 0.3 (min) to 7500 (no issue with max value it is setting correctly). Basically I don't want chart to auto calculate values based on scale.
One thing is the Axis.Minimum and Axis.Maximum, and another thing are the Axis labels. You can see that SetMinMax works using test code such as the following:

Code: Select all

    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;
      Line line = new Line(tChart1.Chart);

      Random rnd = new Random();

      for (int i = 0; i < 20; i++)
      {
        line.Add(i, rnd.Next(0, 8000));
      }

      tChart1.Axes.Left.SetMinMax(0.3, 7500);

      tChart1.GetNextAxisLabel += TChart1_GetNextAxisLabel;
    }

    private void TChart1_GetNextAxisLabel(object sender, GetNextAxisLabelEventArgs e)
    {
      if (((Steema.TeeChart.Axis)sender).Equals(tChart1.Axes.Left))
      {
        e.Stop = false;
        switch (e.LabelIndex)
        {
          case 0:
            e.LabelValue = 0.3;
            break;
          case 1:
            e.LabelValue = 500;
            break;
          case 2:
            e.LabelValue = 3000;
            break;
          case 3:
            e.LabelValue = 6000;
            break;
          case 4:
            e.LabelValue = 7500;
            break;
          default:
            e.Stop = true;
            break;
        }
      }
    }
which gives us:
636010835111272411.png
636010835111272411.png (33.97 KiB) Viewed 8367 times
This axis functionality is explained in the tutorials shipped with TeeChart.NET:
tutorials.PNG
tutorials.PNG (48.19 KiB) Viewed 8366 times
Priyanka wrote: Is there any feature or property of tee chart to export it into binary format?
Yes, there are TeeChart's "ten" files explained in Tutorial 12.
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

Priyanka
Newbie
Newbie
Posts: 19
Joined: Mon Nov 16, 2015 12:00 am

Re: Bottom and Custom Vertical Axis Label Start Position

Post by Priyanka » Fri Jun 10, 2016 10:42 am

Hi Christopher,

Thanks. I will take a look at tutorials again.

I would like to know the label value format which supports decimal and negative values. Currently I am using "##0.##;{##0.##}". However, it is showing wrong format in case of negative values. i.e. for value -500 chart is showing {500}. Please suggest.

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

Re: Bottom and Custom Vertical Axis Label Start Position

Post by Christopher » Fri Jun 10, 2016 11:41 am

Priyanka wrote: I would like to know the label value format which supports decimal and negative values. Currently I am using "##0.##;{##0.##}". However, it is showing wrong format in case of negative values. i.e. for value -500 chart is showing {500}. Please suggest.
You can try: "##0.##;{-##0.##}"

These are standard .NET custom number formatting strings, as you can read here.
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

Post Reply