Page 1 of 1
Axis Legend
Posted: Thu Jun 27, 2013 7:43 am
by 15664465
Hello,
I have a Bar Chart and i wanted to put in the Y axis the values with the € simbol.
Is this posible?
Re: Axis Legend
Posted: Thu Jun 27, 2013 2:04 pm
by 10050769
Hello Fulcrum,
I think you can use CustomLabels to add "€" in the Y axis, you can do something as next:
Code: Select all
Steema.TeeChart.Styles.FastLine line1;
private void InitializeChart()
{
//Chart
tChart1.Aspect.View3D = false;
//Series
line1 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
Random rnd = new Random();
for (int i = 0; i < 10; i++)
{
line1.Add(i, rnd.Next(10));
}
AddCustomLabels();
}
private void AddCustomLabels()
{
tChart1.Axes.Left.Labels.Items.Clear();
for (int i = 0; i < tChart1[0].Count; i++)
{
tChart1.Axes.Left.Labels.Items.Add(tChart1[0].YValues[i], (tChart1[0].YValues[i] + 1 + "€").ToString());
}
}
Thanks,
Re: Axis Legend
Posted: Fri Jun 28, 2013 8:29 am
by 15664465
Thank for the code, it Works. But i want that the values of the axe that not always is the same as the bars to be with the €
Re: Axis Legend
Posted: Fri Jun 28, 2013 11:59 am
by 10050769
Hello Fulcrum,
I suggest you two different alternative to achieve as you want:
First, changing labels valueFormat property as do in next lines of code:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
Steema.TeeChart.Styles.FastLine line1;
private void InitializeChart()
{
//Chart
tChart1.Aspect.View3D = false;
//Series
line1 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
Random rnd = new Random();
for (int i = 0; i < 10; i )
{
line1.Add(i, rnd.Next(10));
}
tChart1.Axes.Left.Labels.ValueFormat = "0.#€";
}
Second, using GetAxisLabels event where you can add "€" for each labels as do in next code:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
Steema.TeeChart.Styles.FastLine line1;
private void InitializeChart()
{
//Chart
tChart1.Aspect.View3D = false;
//Series
line1 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
Random rnd = new Random();
for (int i = 0; i < 10; i )
{
line1.Add(i, rnd.Next(10));
}
tChart1.GetAxisLabel = tChart1_GetAxisLabel;
}
void tChart1_GetAxisLabel(object sender, GetAxisLabelEventArgs e)
{
e.LabelText = e.LabelText "€";
}
At any rate, we aren't sure as you want, therefore, we would be very grateful if my suggestion code, isn't as you want, explain exactly what are you want achieve. On the other hand, if is easier for you, explain your request in Spanish you can do it.
Thanks,
Re: Axis Legend
Posted: Mon Jul 01, 2013 11:11 am
by 15664465
thanks Sandra, the 1st solution made what I want