No width with multi-series one point bar charts.

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
biqpaulson
Newbie
Newbie
Posts: 93
Joined: Thu Apr 17, 2008 12:00 am

No width with multi-series one point bar charts.

Post by biqpaulson » Wed Feb 22, 2017 3:43 pm

I have a problem with bars in multiple series bar charts where each series has only one point in them.

Code: Select all

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace NoThicknessInSingleDataPointBarChart
{
    public partial class Form1 : Form
    {
        const int NUMBER_OF_POINTS = 1;
        public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }

        private void InitializeChart()
        {
            tChart1.Aspect.View3D = true;
            for (int i = 0; i < 4; i++)
            {
                Steema.TeeChart.Styles.Bar TheSeries = new Steema.TeeChart.Styles.Bar();
                TheSeries.MultiBar = Steema.TeeChart.Styles.MultiBars.None;
                TheSeries.Title = "Series-" + i.ToString();
                TheSeries.Marks.Visible = false;

                tChart1.Series.Add(TheSeries);

                for (int j = 0; j < NUMBER_OF_POINTS; j += 1)
                {
                    TheSeries.Add(j + 1, "Label-" + j.ToString());
                }
            }
        }
    }
}
If NUMBER_OF_POINTS is set to 2 then you get:
TwoPointsMultipleSeries.PNG
TwoPointsMultipleSeries.PNG (13.72 KiB) Viewed 5768 times
If NUMBER_OF_POINTS is set to 1 then you get:
OnePointMultipleSeries.PNG
OnePointMultipleSeries.PNG (10.74 KiB) Viewed 5767 times
This is using the "Steema TeeChart for .NET 2016 4.1.2016.10260" of the library.
The "Steema TeeChart for .NET 2016 4.1.2016.05120" version of the library does not have this problem.

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

Re: No width with multi-series one point bar charts.

Post by Christopher » Wed Feb 22, 2017 4:04 pm

Hello,

Unfortunately a similar issue has already been reported and fixed in id=1794. In the meantime, you should be able to set the CustomBarWidth to ameliorate the rendering in these particular cases:

Code: Select all

    private void InitializeChart()
    {
      tChart1.Aspect.View3D = true;
      for (int i = 0; i < 4; i++)
      {
        Steema.TeeChart.Styles.Bar TheSeries = new Steema.TeeChart.Styles.Bar();
        TheSeries.MultiBar = Steema.TeeChart.Styles.MultiBars.None;
        TheSeries.Title = "Series-" + i.ToString();
        TheSeries.Marks.Visible = false;

        tChart1.Series.Add(TheSeries);

        TheSeries.CustomBarWidth = 150;


        for (int j = 0; j < NUMBER_OF_POINTS; j += 1)
        {
          TheSeries.Add(j + 1, "Label-" + j.ToString());
        }
      }
    }
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