percentage mark on the Y- axis
Posted: Fri Sep 14, 2012 8:31 am
How do I add a percentage mark on the Y- axis
Steema Software - Customer Support Forums
http://teechart.com/support/
Code: Select all
Series1.Marks.Style = Steema.TeeChart.Styles.MarksStyles.Percent;
tChart1.Axes.Left.Labels.Style = AxisLabelStyle.Mark;
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
double MaxX, MinX;
tChart1.Aspect.View3D = false;
tChart1.Dock = DockStyle.Fill;
tChart1.Legend.Alignment = LegendAlignments.Bottom;
for (int i = 0; i < 2; i++)
{
new Steema.TeeChart.Styles.Line(tChart1.Chart);
tChart1[i].FillSampleValues(2);
tChart1[i].Marks.Visible = true;
tChart1[i].Marks.Style = Steema.TeeChart.Styles.MarksStyles.Percent;
}
tChart1.Axes.Left.GetAxisDrawLabel += new GetAxisDrawLabelEventHandler(Left_GetAxisDrawLabel);
tChart1.Axes.Bottom.MaximumOffset = 2;
tChart1.Axes.Bottom.MinimumOffset = 1;
tChart1.Axes.Left.MaximumOffset = 2;
tChart1.Axes.Left.MinimumOffset = 1;
}
void Left_GetAxisDrawLabel(object sender, GetAxisDrawLabelEventArgs e)
{
e.Text = e.Text + "%";
}
Code: Select all
Steema.TeeChart.Chart tChart1;
protected void Page_Load(object sender, EventArgs e)
{
tChart1 = WebChart3.Chart;
InitializeChart();
}
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
tChart1.Legend.Alignment = LegendAlignments.Bottom;
for (int i = 0; i < 2; i++)
{
new Steema.TeeChart.Styles.Line(tChart1.Chart);
tChart1[i].Marks.Visible = true;
AddValues(tChart1[i], 2);
tChart1[i].Marks.Style = Steema.TeeChart.Styles.MarksStyles.Percent;
}
tChart1.Axes.Left.GetAxisDrawLabel += new GetAxisDrawLabelEventHandler(Left_GetAxisDrawLabel);
tChart1.Axes.Bottom.MaximumOffset = 2;
tChart1.Axes.Bottom.MinimumOffset = 1;
tChart1.Axes.Left.MaximumOffset = 15;
tChart1.Axes.Left.MinimumOffset = 15;
tChart1.Axes.Left.SetMinMax(0, 100);
}
private void AddValues(Steema.TeeChart.Styles.Series s, int value)
{
Random rnd = new Random();
for (int i = 0; i < value; i++)
{
s.Add(i, rnd.Next(100));
}
}
void Left_GetAxisDrawLabel(object sender, GetAxisDrawLabelEventArgs e)
{
e.Text = e.Text + "%";
}
Code: Select all
tChart1.Panel.MarginLeft = 10;