Page 1 of 1
Custom labels - how to set axis increment
Posted: Wed Nov 12, 2008 9:40 am
by 13045482
Hi
I have got custom labels on x axis and its a bar chart. Custom labels are a,b,c corresponding to 3 bars of chart. Now i want to increase space between 3 bars . If i do
Me.tcStraAssessRC.Axes.Bottom.Increment=20 it does not work as labels are not numeric.
So what can be the solution to achieve the same. Its very urgent, so a quick response will be highly appreciated. Thanks.
Posted: Wed Nov 12, 2008 9:46 am
by narcis
Hi shikha,
Please see my reply
here.
However, if you are using custom labels you are already defining labels increment. Are you using custom labels as in the
All Features\Welcome !\Axes\Labels\Custom labels example at the features demo, available at TeeChart’s program group?
Posted: Wed Nov 12, 2008 10:37 am
by 13045482
Hi
Thanks for swift reply. However when i click the link "here" it takes me to profile page where i do not find the information. I am not adding as given in allfeatures. I am basically doing
barSeriesBase.Add(baseVal, POGRow("PogIDDesc"))
tcStraAssessRC.Series.Add(barSeriesBase)
it automatically takes POGRow("PogIDDesc") as labels on x axis and baseVal as the height of bar. But where to set the position of bar?
[/img]
Posted: Wed Nov 12, 2008 10:45 am
by narcis
Hi shikha,
Sorry, I copied a wrong link. That was the one I wanted to paste:
http://www.teechart.net/support/viewtopic.php?t=8720
If this doesn't help please send us a simple example project we can run "as-is" to reproduce the problem here.
You can either post your files at news://
www.steema.net/steema.public.attachments newsgroup or at our
upload page.
Thanks in advance.
Posted: Wed Nov 12, 2008 11:10 am
by 13045482
But my question is simple-
when we do this
tChart1.Series[0].Add(123, "ABC", Color.Red);
it creates a bar of 123 height as given in all featues\welcome\basi features. Now i just ant to know where we will set position(x axis ) of this bar. if we can do taht we can give more space between bars. i do not want to reduce width of bars.
Posted: Wed Nov 12, 2008 11:17 am
by narcis
Hi shikha,
I'm not sure to understand what you are trying to achive. However, you can get bar position like this:
Code: Select all
int index = tChart1.Series[0].Add(123, "ABC", Color.Red);
tChart1.Draw();
int pos = tChart1.Series[0].CalcXPos(index);
Posted: Wed Nov 12, 2008 11:36 am
by 13045482
thanks but i think we are talking in different lines. i will try to again describe my Q:
I just want that the bars in bar chart should have more space inbetween without decreasing their width.
i am doing
tChart1.Series[0].Add(123, "ABC", Color.Red);
and then later add series to chart.
Posted: Wed Nov 12, 2008 11:40 am
by 13045482
in other words how add values to series in longer intervals (as you suggessted to do )
Posted: Wed Nov 12, 2008 11:58 am
by narcis
Hi shikha,
Ok, using the code in the example you mentioned:
Code: Select all
tChart1.Series[0].Add(123, "ABC", Color.Red);
tChart1.Series[0].Add( 456, "DEF", Color.Blue );
tChart1.Series[0].Add( 321, "GHI", Color.Green );
Populates bar series automatically adding sequential X values like this:
X Bar
0 123
1 456
2 321
So to have longer intervals you can provide X and Y values, for example:
Code: Select all
tChart1.Series[0].Add(0, 123, "ABC", Color.Red);
tChart1.Series[0].Add(5, 456, "DEF", Color.Blue );
tChart1.Series[0].Add(10, 321, "GHI", Color.Green );
You can also try different axis offset combinations, for example:
Code: Select all
tChart1.Axes.Bottom.MinimumOffset = -10;
tChart1.Axes.Bottom.MaximumOffset = -10;
Posted: Wed Nov 12, 2008 12:04 pm
by 13045482
tHANKS THIS HELPS!!
JUST ONE MORE Q - INCASE I DO SOME THING LIKE
SERIES.ADD()
WHAT HAPPENS? WHERE WILL IT BE ADDED?
Posted: Wed Nov 12, 2008 12:23 pm
by narcis
Hi shikha,
You're welcome.
Series.Add() method has several overloads. If you don't provide any X value (eg.: Series.Add(25)) it will add this point to Series.Count, Y. So in that case Series.Add(25) is the same as Series.Add(Series.Count, 25): In the example above:
X Bar
0 123
3 25
5 456
10 321