Page 1 of 1

Regarding Bar chart

Posted: Mon Sep 04, 2017 2:07 pm
by 9526439
Hi steema support,

I have a bar chart based on data
.
x axis- 0.0 , 0.4 , 0.9, 0.13 ,0.17 ,0.22, 0.26, 0.30, 0.35, 0.39
Y-Axis- 0.01, 0.78, 0.15, 0.04, 0.01, 0,0,0,0,0
Untitled.png
Untitled.png (22.54 KiB) Viewed 11884 times
In this i have facing overlap and gap issue. Please look this.

code-

SeriesPlotBar = new Bar(tChartGraph.Chart);
SeriesPlotBar.Color = BarAreaLightRed;
SeriesPlotBar.Marks.Visible = false;
SeriesPlotBar.StackGroup = 0;
SeriesPlotBar.BarWidthPercent = 100;

After setting barwidth percentage issue not resolved.
Rest we have soon provide data for our previous posts.

Thanks

Plano research

Re: Regarding Bar chart

Posted: Mon Sep 04, 2017 2:09 pm
by 9526439
Untitled.png
Untitled.png (11.02 KiB) Viewed 11886 times
More Images

Re: Regarding Bar chart

Posted: Tue Sep 05, 2017 9:14 am
by Christopher
Hello,

Using the latest version of TeeChart.dll and the following code:

Code: Select all

    Bar series;
    private void InitializeChart()
    {
      double[] xvalues = new double[] { 0.0, 0.4, 0.9, 0.13, 0.17, 0.22, 0.26, 0.30, 0.35, 0.39 };
      double[] yvalues = new double[] { 0.01, 0.78, 0.15, 0.04, 0.01, 0, 0, 0, 0, 0 };

      series = new Bar(tChart1.Chart);
      series.Add(xvalues, yvalues);
      series.Marks.Visible = false;

      tChart1.Axes.Bottom.SetMinMax(0, 0.5);
      tChart1.Axes.Left.SetMinMax(0, 0.2);
    }

    private void button2_Click(object sender, EventArgs e)
    {
      series.CustomBarWidth = 30;
      //series.BarWidthPercent = 20;
    }
I obtain the following before the button click:
WindowsFormsApplication1_2017-09-05_11-06-24.png
WindowsFormsApplication1_2017-09-05_11-06-24.png (13.71 KiB) Viewed 11873 times
and after the click I obtain:
WindowsFormsApplication1_2017-09-05_11-06-37.png
WindowsFormsApplication1_2017-09-05_11-06-37.png (13.69 KiB) Viewed 11870 times
in this test both CustomBarWidth and BarWidthPercent work as expected. Which version of TeeChart.dll are you using?

Re: Regarding Bar chart

Posted: Thu Sep 07, 2017 1:03 pm
by 9526439
I would like to share that we can not fix the width of bars and my expectation is to combine the bars without gap and without overlap.

I am giving 2 more dataset.

Ist Dataset

X- 0.06,0.18,0.13,0.41,0.53,0.64,0.76,0.87,0.9,1.11
Y- 0.01,0.04,0.09,0.16,0.20,0.19,0.16,0.09,.0.05,.0.0

And the chart image is as below, in this case overlapping is coming. I am using silverlight.
1.png
1.png (14.03 KiB) Viewed 11859 times
IINd Dataset-

X- 0.0, 0.04 ,0.09 ,0.13 ,0.17 ,0.22 ,0.26 ,0.30 ,0.35 ,0.39
Y- 0.01, 0.78, 0.15 , 0.04, 0.01, 0, 0, 0, 0, 0

In This gap is coming-
2.png
2.png (13.73 KiB) Viewed 11861 times
Please provide dome fruitful solution. In Excel we are able to plot expected. And i am using percentage 100%.

Thanks

Plano

Re: Regarding Bar chart

Posted: Thu Sep 07, 2017 3:25 pm
by Christopher
Hello,

TeeChart has no facility for allowing the Bar series to draw bars of different widths. If you want bars of different widths you can use the Histogram series, e.g.

Code: Select all

    Histogram series;
    private void InitializeChart()
    {
      double[] xvalues = new double[] { 0.0, 0.4, 0.9, 0.13, 0.17, 0.22, 0.26, 0.30, 0.35, 0.39 };
      double[] yvalues = new double[] { 0.01, 0.78, 0.15, 0.04, 0.01, 0, 0, 0, 0, 0 };

      series = new Histogram(tChart1.Chart);
      series.XValues.Order = ValueListOrder.Ascending;

      series.Add(xvalues, yvalues);
      series.Marks.Visible = false;
      series.XValues.Sort();

      tChart1.Axes.Bottom.SetMinMax(0, 0.9);
      tChart1.Axes.Left.SetMinMax(-1, 0.8);
    }
which gives me:
TChart636403942242529566.png
TChart636403942242529566.png (12.64 KiB) Viewed 11858 times