Using none zero Origin on a bar series.

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
tms4000
Newbie
Newbie
Posts: 17
Joined: Mon Jun 02, 2014 12:00 am

Using none zero Origin on a bar series.

Post by tms4000 » Thu Jun 05, 2014 6:29 pm

I have a horizontal bar chart with 2 series. One series is a percentage using the left axis. The axis is set to run from 0% to 100%. The second series is using the right axis and represents a temperature. Potential values are -40 - 160. I would like the second series bar to start at the base of the chart instead of starting at zero.

However that is not how it's rendering. I tried setting UseOrigin to true and Origin to -40, but it didn't make a difference.

I've also posted my question on stackoverflow.com here:


http://stackoverflow.com/questions/2406 ... rigin-inst

I have included a screen capture so you can see my code and see how it rendering.


An unrelated problem I'm having is no matter what property I change, I can't see to get the background of the graph to render as white. It always seems to be battleship grey.

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

Re: Using none zero Origin on a bar series.

Post by Christopher » Fri Jun 06, 2014 9:07 am

Hello!
tms4000 wrote:I have a horizontal bar chart with 2 series. One series is a percentage using the left axis. The axis is set to run from 0% to 100%. The second series is using the right axis and represents a temperature. Potential values are -40 - 160. I would like the second series bar to start at the base of the chart instead of starting at zero.
The following code:

Code: Select all

    private void InitializeChart()
    {
      tChart1.Axes.Right.Grid.Visible = false;
      tChart1.Axes.Right.Maximum = 160.0;
      tChart1.Axes.Right.Minimum = -40;
      tChart1.Axes.Right.Increment = 40;

      tChart1.Axes.Right.Automatic = false;
      tChart1.Axes.Right.AutomaticMinimum = false;
      tChart1.Axes.Right.AutomaticMaximum = false;

      tChart1.Aspect.View3D = false;
      tChart1.Panel.Bevel.Inner = Steema.TeeChart.Drawing.BevelStyles.None;
      tChart1.Panel.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None;
      tChart1.Axes.Left.Grid.Visible = false;
      tChart1.Axes.Bottom.Grid.Centered = false;
      tChart1.Axes.Bottom.Ticks.Visible = false;
      tChart1.Axes.Left.Automatic = false;
      tChart1.Axes.Left.Minimum = 0;
      tChart1.Axes.Left.Maximum = 100;
      tChart1.Axes.Right.Visible = true;


      var barProduct = new Steema.TeeChart.Styles.Bar();
      barProduct.MultiBar = MultiBars.Side;
      barProduct.Color = Color.Green;

      barProduct.Marks.Visible = false;
      barProduct.Title = "% Vol";
      barProduct.ShowInLegend = true;

      Random rnd = new Random();

      for (int i = 0; i < 10; i++)
      {
        barProduct.Add(rnd.Next(0, 100));
      }

      tChart1.Series.Add(barProduct);

      var barTemperature = new Steema.TeeChart.Styles.Bar();
      barTemperature.MultiBar = MultiBars.Side;
      barTemperature.Color = Color.FromArgb(153, 74, 11);

      barTemperature.Marks.Visible = false;
      barTemperature.VertAxis = VerticalAxis.Right;
      barTemperature.UseOrigin = true;
      barTemperature.Origin = -40;
      barTemperature.Title = "Temperature";
      barTemperature.ShowInLegend = true;
      for (int i = 0; i < 10; i++)
      {
        barTemperature.Add(rnd.Next(-40, 160));
      }
      tChart1.Series.Add(barTemperature);

      tChart1.Panel.Gradient.Visible = false;
      tChart1.Walls.Back.Gradient.Visible = false;
      tChart1.Panel.Color = Color.White;
      tChart1.Walls.Back.Color = Color.White;
    }
gives me the following chart:
bars.PNG
bars.PNG (11.01 KiB) Viewed 8697 times
Do you get the same results at your end?
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

tms4000
Newbie
Newbie
Posts: 17
Joined: Mon Jun 02, 2014 12:00 am

Re: Using none zero Origin on a bar series.

Post by tms4000 » Sat Jun 07, 2014 3:07 am

If I use your code, I get the same result as you.

I messed around and determined the issue is related to the mutibar property.

My origin code snippet left out some details, that in retrospect I should have included.

I actually have 5 series: Product, SP1, SP2, SP3 alll with Multibar = Multibar.Stacked & StackGroup = 1
The last series is the temperature series.


I need the first 4 series to be stacked together and use the left axis.
I need the temp series to stand alone and use the right axis (-40 to 160)

When I remove the SP1 SP2 and SP3 series and change the Mutibar property on the product seriers to MultiBars.Side, the Temperature series responds correctly to the origin property.
When I set Product.Multibar = Multibar.Stacked, the temperature series acts like 0 is the origin.

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

Re: Using none zero Origin on a bar series.

Post by Christopher » Mon Jun 09, 2014 9:09 am

tms4000 wrote:When I remove the SP1 SP2 and SP3 series and change the Mutibar property on the product seriers to MultiBars.Side, the Temperature series responds correctly to the origin property.
When I set Product.Multibar = Multibar.Stacked, the temperature series acts like 0 is the origin.
Just to confirm exactly what the issue is. I think I can reproduce the problem using this code:

Code: Select all

    private void InitializeChart()
    {
      Random rnd = new Random();

      tChart1.Axes.Right.Grid.Visible = false;
      tChart1.Axes.Right.Maximum = 160.0;
      tChart1.Axes.Right.Minimum = -40;
      tChart1.Axes.Right.Increment = 40;

      tChart1.Axes.Right.Automatic = false;
      tChart1.Axes.Right.AutomaticMinimum = false;
      tChart1.Axes.Right.AutomaticMaximum = false;

      tChart1.Aspect.View3D = false;
      tChart1.Panel.Bevel.Inner = Steema.TeeChart.Drawing.BevelStyles.None;
      tChart1.Panel.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None;
      tChart1.Axes.Left.Grid.Visible = false;
      tChart1.Axes.Bottom.Grid.Centered = false;
      tChart1.Axes.Bottom.Ticks.Visible = false;
      tChart1.Axes.Left.Automatic = false;
      tChart1.Axes.Left.Minimum = 0;
      tChart1.Axes.Left.Maximum = 100;
      tChart1.Axes.Right.Visible = true;

      for (int j = 0; j < 3; j++)
      {
        var barProduct = new Steema.TeeChart.Styles.Bar();
        barProduct.MultiBar = MultiBars.Stacked;
        barProduct.Color = Color.Green;
        barProduct.StackGroup = 0;

        barProduct.Marks.Visible = false;
        barProduct.Title = "% Vol";
        barProduct.ShowInLegend = true;

        for (int i = 0; i < 10; i++)
        {
          barProduct.Add(rnd.Next(0, 100));
        }

        tChart1.Series.Add(barProduct);
      }

      var barTemperature = new Steema.TeeChart.Styles.Bar();
      barTemperature.MultiBar = MultiBars.Stacked;
      barTemperature.Color = Color.FromArgb(153, 74, 11);

      barTemperature.StackGroup = 1;

      barTemperature.Marks.Visible = false;
      barTemperature.VertAxis = VerticalAxis.Right;
      barTemperature.UseOrigin = true;
      barTemperature.Origin = -40;
      barTemperature.Title = "Temperature";
      barTemperature.ShowInLegend = true;
      for (int i = 0; i < 10; i++)
      {
        barTemperature.Add(rnd.Next(-40, 160));
      }
      tChart1.Series.Add(barTemperature);

      tChart1.Panel.Gradient.Visible = false;
      tChart1.Walls.Back.Gradient.Visible = false;
      tChart1.Panel.Color = Color.White;
      tChart1.Walls.Back.Color = Color.White;
    }
which gives me this chart:
bars2.PNG
bars2.PNG (16.12 KiB) Viewed 8682 times
is this the issue you're referring to? If so I'll add it to http://bugs.teechart.net/ if you haven't done so already.
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

tms4000
Newbie
Newbie
Posts: 17
Joined: Mon Jun 02, 2014 12:00 am

Re: Using none zero Origin on a bar series.

Post by tms4000 » Mon Jun 09, 2014 1:17 pm

Yes, that's the issue I'm seeing.

I have not posted it to your bug tracker. Could I be informed when this issue is addressed?

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

Re: Using none zero Origin on a bar series.

Post by Christopher » Tue Jun 10, 2014 8:28 am

tms4000 wrote:Yes, that's the issue I'm seeing.

I have not posted it to your bug tracker. Could I be informed when this issue is addressed?
The bug is has been posted here and has already been fixed; the fix will become publicly available in the next maintenance release, due out mid-summer.
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