Page 1 of 1

Area Graph

Posted: Wed Jul 18, 2012 3:40 pm
by 15662902
Trying to achive a graph as per sample, I have tried an area graph, but I only have 1 value for each response, so all I get is all in the left hand column, I need to fill the area 100%, so was thinking the area graph is what is needed

Re: Area Graph

Posted: Mon Jul 23, 2012 12:03 pm
by 10050769
Hello miethelad,

Sorry for the delay. I think should be useful for you, use a customBarSeries as do in the example of Demo All Features\Welcome !\Chart styles\Standard\Bar\Bar Size example. As you see in this example is used a custom series to change the size of Bars. I have made a simple project where try to achieve as you want using a CustomBarSize class and changing the size and positions of Bars.
GeneralTest.zip
(29.6 KiB) Downloaded 364 times
Can you tell us if previous code works as you expect?


I hope will helps.

Thanks,

Re: Area Graph

Posted: Tue Jul 24, 2012 10:03 am
by 15662902
Thanks, your demo worked fine apart from can't see how the invert works as this did not work, I have added my 3 of my values to the data, but is not right, see attached

Re: Area Graph

Posted: Tue Jul 24, 2012 3:14 pm
by 10050769
Hello mikethelad,

I have made a simple code to adapt the bars at your values:

Code: Select all

        CustomBarSize bar1, bar2, bar3;
        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            bar1 = new CustomBarSize(tChart1.Chart);
            bar2 = new CustomBarSize(tChart1.Chart);
            bar3 = new CustomBarSize(tChart1.Chart);

            bar1.Add(1, 100, "16.3%", Color.Black);
            bar2.Add(2, 100, "60.3%", Color.Blue);
            bar3.Add(3, 100, "0.4%", Color.Red);

            bar1.SideMargins = false;
            bar2.SideMargins = false;
            bar3.SideMargins = false;
            bar1.SizeValues[0] = 1.63;
            bar2.SizeValues[0] = 6.3;
            bar3.SizeValues[0] = 0.04;
            bar1.XValues[0] = 0;
            bar2.XValues[0] = 2;
            bar3.XValues[0] = 5.1;
            tChart1.Axes.Bottom.Labels.Style = AxisLabelStyle.Value;
            tChart1.Axes.Bottom.SetMinMax(-2, 5.2);
            tChart1.Axes.Bottom.Increment = 1;
            tChart1.Axes.Bottom.MinimumOffset = 1;
            tChart1.Axes.Bottom.MaximumOffset = 1;
        }
Can you tell us if previous code help you to achieve as you want? As you see you need modify the Xvalue to adapt your data.

Thanks,

Re: Area Graph

Posted: Tue Jul 24, 2012 3:21 pm
by 15662902
I can see how the below are done, and can do formula:-

bar1.SizeValues[0] = 1.63;
bar2.SizeValues[0] = 6.3;
bar3.SizeValues[0] = 0.04;

The XValues I can't work out,

bar1.XValues[0] = 0;
bar2.XValues[0] = 2;
bar3.XValues[0] = 5.1;

The graphs will have vary number of columns, from 2 upto 9

Re: Area Graph

Posted: Thu Jul 26, 2012 9:28 am
by narcis
Hi mikethelad,

You could do something as in the All Features\Welcome !\Chart styles\Standard\Area\Sales vs. Price example in the features demo where Area series is being used.