Page 1 of 1
Scale And Marks
Posted: Fri Jul 13, 2012 2:25 pm
by 15662902
On the sample graph I have set the scale to 0 to 100, by
WebChart1.Chart.Axes.Left.SetMinMax(0,100);
I want it be in qty's of 10 and not 5, ie 10,20,30 etc
Also
I wish to show the marks as values an not as per the bottom axis label, data is being added like:-
footer = mnth + "_" + year + "\n(n=" + totaln + ")";
line1.Add(7, footer);
Re: Scale And Marks
Posted: Mon Jul 16, 2012 7:48 am
by narcis
Hi mikethelad,
I want it be in qty's of 10 and not 5, ie 10,20,30 etc
You should set Increment property then:
Code: Select all
tChart1.Axes.Bottom.Increment = 10;
I wish to show the marks as values an not as per the bottom axis label, data is being added like:-
You can set Label.Style like this:
Code: Select all
tChart1.Axes.Bottom.Labels.Style = Steema.TeeChart.AxisLabelStyle.Value;
For further information about axis settings please read tutorial 4. Tutorials can be found at TeeChart's program group.
Re: Scale And Marks
Posted: Mon Jul 16, 2012 11:16 am
by 15662902
Hi, scale change works fine. The axis label, is correct how I have it, I want the mark on the line to show the value
Re: Scale And Marks
Posted: Mon Jul 16, 2012 12:16 pm
by narcis
Hi mikethelad,
I want the mark on the line to show the value
Sorry, I understood you wanted the values as bottom axis labels. In that case what you need to change is Marks.Style:
Code: Select all
tChart1[0].Marks.Style = Steema.TeeChart.Styles.MarksStyles.Value;
Re: Scale And Marks
Posted: Mon Jul 16, 2012 2:02 pm
by 15662902
Thanks, that works, see new graph, is there anyway to overcome the following:-
1. Overlap of the marks?
2. How to show the % symbol after the mark value
3. 1st and last one not showing
Re: Scale And Marks
Posted: Mon Jul 16, 2012 2:16 pm
by narcis
Hi mikethelad,
1. Overlap of the marks?
Yes, you can do something similar as in the example Pep posted
here.
2. How to show the % symbol after the mark value
Either using one of the percent related MarksStyles values or manually adding it to the mark text with the GetSeriesMark event:
Code: Select all
void Form1_GetSeriesMark(Steema.TeeChart.Styles.Series series, Steema.TeeChart.Styles.GetSeriesMarkEventArgs e)
{
e.MarkText += "%";
}
3. 1st and last one not showing
Using MinimumOffset and MaximumOffset, for example:
Code: Select all
tChart1.Axes.Bottom.MinimumOffset = 5;
tChart1.Axes.Bottom.MaximumOffset = 5;
Re: Scale And Marks
Posted: Mon Jul 16, 2012 3:59 pm
by 15662902
What calls the GetSeriesMark event, have tried in the afterdraw but no lucj
Re: Scale And Marks
Posted: Mon Jul 16, 2012 5:22 pm
by narcis
Hi mikethelad,
Series call it. You have to subscribe the series to this event.
Re: Scale And Marks
Posted: Tue Jul 17, 2012 8:25 am
by 15662902
Sorry don't understand how to :-
"Series call it. You have to subscribe the series to this event."
Re: Scale And Marks
Posted: Tue Jul 17, 2012 10:15 am
by 10050769
Hello mikethelad,
You must subscribe and call the GetSeriesMark event when you initialize chart. You can do something next:
Code: Select all
...
tChart1.Axes.Bottom.Labels.Style = Steema.TeeChart.AxisLabelStyle.Value;
line1.GetSeriesMark += new Series.GetSeriesMarkEventHandler(series_GetSeriesMark);
line2.GetSeriesMark +=new Series.GetSeriesMarkEventHandler(series_GetSeriesMark);
line3.GetSeriesMark +=new Series.GetSeriesMarkEventHandler(series_GetSeriesMark);
}
void series_GetSeriesMark(Series series, GetSeriesMarkEventArgs e)
{
if (tChart1.Series.IndexOf(series) == 0)
{
e.MarkText = series.XValues[e.ValueIndex].ToString() + " %";
}
else if (tChart1.Series.IndexOf(series)==1)
{
e.MarkText = series.XValues[e.ValueIndex].ToString() + " %";
}
else if (tChart1.Series.IndexOf(series) == 2)
{
e.MarkText = series.XValues[e.ValueIndex].ToString() + " %";
}
}
As you see, in previous code, I have subscribed and called the event for each series in the initialization of chart and it works fine for me. I recommend you always call the event in the initialization of Chart to avoid problems.
Thanks,
Re: Scale And Marks
Posted: Tue Jul 17, 2012 10:26 am
by 15662902
Thanks, the following has worked:-
line1.GetSeriesMark += new Steema.TeeChart.Styles.Series.GetSeriesMarkEventHandler(line_GetSeriesMark);
Re: Scale And Marks
Posted: Tue Jul 17, 2012 1:49 pm
by 10050769
Hello mikethelad,
I am glad that your problem solved.
Thanks,