Hello,
I would like to add a custom axis on top of my color grid graph, but it seems that the labels and the title of this custom axis appears outside the chart area (above the chart title).
I tried to set a different top margin but the only thing it does is adding some space above the chart title, and the axis labels stay above my chart view.
Could you help me please ?
Top Custom Axis Elements are outside chart area
Re: Top Custom Axis Elements are outside chart area
Hello MartinB,
I have made a simple code where I have added a horizontal custom axis top, I have incremented the top margin and I have repositioned the Title of Char and the labels of axis,are in the Chart area always.
Could you please tell us if previous code help you to solve your problem? If it doesn't help please try to arrange for us a simple code where the problem appears, because we can try to solve your problem.
Thanks,
I have made a simple code where I have added a horizontal custom axis top, I have incremented the top margin and I have repositioned the Title of Char and the labels of axis,are in the Chart area always.
Code: Select all
Axis customAxis;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
colorGrid1 = new ColorGrid(tChart1.Chart);
colorGrid1.FillSampleValues();
customAxis = new Axis(tChart1.Chart);
tChart1.Axes.Custom.Add(customAxis);
customAxis.Horizontal = true;
colorGrid1.HorizAxis = HorizontalAxis.Both;
colorGrid1.CustomHorizAxis = customAxis;
tChart1.Draw();
customAxis.OtherSide = true;
tChart1.Panel.MarginUnits = PanelMarginUnits.Pixels;
tChart1.Panel.MarginTop = 50;
tChart1.Header.CustomPosition = true;
tChart1.Header.Left = tChart1.Width / 2;
tChart1.Header.Top = 0;
button1.Click +=button1_Click;
}
Could you please tell us if previous code help you to solve your problem? If it doesn't help please try to arrange for us a simple code where the problem appears, because we can try to solve your problem.
Thanks,
Best Regards,
Sandra Pazos / 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 |
Re: Top Custom Axis Elements are outside chart area
Hello Sandra,
Indeed it is now working better adding these lines :
colorGrid1.HorizAxis = HorizontalAxis.Both;
colorGrid1.CustomHorizAxis = customAxis;
except the labels I add on the bottom axis disappears.
I tried to only use
colorGrid1.HorizAxis = HorizontalAxis.Both;
but this time , if I call the customAxis.labels.Clear() method and I add another label, I still see a lot of labels on the top custom axis plus my new label.
I would like to only add custom labels on this top axis, how can I do this please ?
Indeed it is now working better adding these lines :
colorGrid1.HorizAxis = HorizontalAxis.Both;
colorGrid1.CustomHorizAxis = customAxis;
except the labels I add on the bottom axis disappears.
I tried to only use
colorGrid1.HorizAxis = HorizontalAxis.Both;
but this time , if I call the customAxis.labels.Clear() method and I add another label, I still see a lot of labels on the top custom axis plus my new label.
I would like to only add custom labels on this top axis, how can I do this please ?
Re: Top Custom Axis Elements are outside chart area
Hello MartinB,
I am afraid if you want use multiple custom axis for one series, you can not do it, because you only can assign for each axis one Series, for this reason, The possibility to assign several horizontal/vertical axes to a series is a request already in the wish-list (TF02010876).
In this point, I think you have two options as a workaround:
First don't use custom axes, but use default Bottom axis and Top axis of Chart as do in next code:
Second, use a auxiliary series and assign custom axis to it. You can do something a next code:
As you see in both codes I have removed the labels of top axis and add only one label.
Could you tell us if previous code works in your end?
Thanks,
I am afraid if you want use multiple custom axis for one series, you can not do it, because you only can assign for each axis one Series, for this reason, The possibility to assign several horizontal/vertical axes to a series is a request already in the wish-list (TF02010876).
In this point, I think you have two options as a workaround:
First don't use custom axes, but use default Bottom axis and Top axis of Chart as do in next code:
Code: Select all
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
colorGrid1 = new ColorGrid(tChart1.Chart);
colorGrid1.FillSampleValues();
colorGrid1.HorizAxis = HorizontalAxis.Both;
AddCustomLabels(tChart1.Axes.Top);
tChart1.Draw();
tChart1.Panel.MarginUnits = PanelMarginUnits.Pixels;
tChart1.Panel.MarginTop = 50;
tChart1.Header.CustomPosition = true;
tChart1.Header.Left = tChart1.Width / 2;
tChart1.Header.Top = 0;
button1.Click += button1_Click;
}
private void AddCustomLabels(Axis a)
{
a.Labels.Items.Clear();
a.Labels.Items.Add(colorGrid1.XValues[5], "Point 1");
}
Code: Select all
Axis customAxis;
Steema.TeeChart.Styles.ColorGrid colorGrid1;
Steema.TeeChart.Styles.ColorGrid auxiliarygrid;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
colorGrid1 = new ColorGrid(tChart1.Chart);
auxiliarygrid = new ColorGrid(tChart1.Chart);
colorGrid1.FillSampleValues();
customAxis = new Axis(tChart1.Chart);
tChart1.Axes.Custom.Add(customAxis);
customAxis.Horizontal = true;
colorGrid1.HorizAxis = HorizontalAxis.Bottom;
auxiliarygrid.CustomHorizAxis = customAxis;
auxiliarygrid.ShowInLegend = false;
AddCustomLabels(customAxis);
tChart1.Draw();
customAxis.OtherSide = true;
tChart1.Panel.MarginUnits = PanelMarginUnits.Pixels;
tChart1.Panel.MarginTop = 50;
tChart1.Header.CustomPosition = true;
tChart1.Header.Left = tChart1.Width / 2;
tChart1.Header.Top = 0;
}
Could you tell us if previous code works in your end?
Thanks,
Best Regards,
Sandra Pazos / 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 |
Re: Top Custom Axis Elements are outside chart area
The second workaround worked for me, thank you very much.