I am trying to make my own y axis values and I found the example of how to create them but it does not show what to attach them to. here is my example
Dim MyYAxis As IndexedYAxis = New IndexedYAxis()
MyYAxis.Labels.Add(New IndexedYAxisLabel("185", 0))
MyYAxis.Labels.Add(New IndexedYAxisLabel("195", 1))
MyYAxis.Labels.Add(New IndexedYAxisLabel("205", 2))
So then what do I attach MyYAxis to so that it displays.
IndexedYAxis
Re: IndexedYAxis
Support · Jan 14, 2009Hello,
You can set the YAxis for the chart using the below line of code:
IndexedAreaSeries.YAxis = MyyAxis
Basically use the YAxis property of the type of series you are using.
Thanks,
ceTe Software Support Team.
Re: IndexedYAxis
Forum member · Jan 14, 2009I'm using a line chart and there fore a lineseries. my code is
Dim MyLineSeries1 As New IndexedLineSeries("Student Scores")
MyLineSeries1.Values.Add(New Single() {dr("0506SS"), dr("0607SS"), dr("0708SS")})
MyPlotArea.Series.Add(MyLineSeries1)
Dim MyYAxis As IndexedYAxis = New IndexedYAxis()
MyYAxis.Labels.Add(New IndexedYAxisLabel("185", 0))
MyYAxis.Labels.Add(New IndexedYAxisLabel("195", 1))
MyYAxis.Labels.Add(New IndexedYAxisLabel("205", 2))
then I believe what you are saying is I would do this
MyLineSeries1.YAxis = MyYAxis
but I get an error that says "Property YAxis is read only"
Re: IndexedYAxis
Support · Jan 14, 2009Hello,
Following is the sample code that shows how to apply the custom YAxis to the series:
' Create a indexed yAxis
Dim yAxis As IndexedYAxis = New IndexedYAxis()
' Create indexed axis labels and add those to indexed xAxis
yAxis.Labels.Add(New IndexedYAxisLabel("Q1", 0))
yAxis.Labels.Add(New IndexedYAxisLabel("Q2", 1))
yAxis.Labels.Add(New IndexedYAxisLabel("Q3", 2))
yAxis.Labels.Add(New IndexedYAxisLabel("Q4", 3))
' Create a numeric xAxis
Dim xAxis As NumericXAxis = New NumericXAxis()
' Create a indexed bar series and add values to it
Dim MyBarSeries1 As IndexedBarSeries = New IndexedBarSeries("Website A", xAxis, yAxis)
MyBarSeries1.Values.Add(New Single() {5, 7, 9, 6})
Dim MyBarSeries2 As IndexedBarSeries = New IndexedBarSeries("Website B", xAxis, yAxis)
MyBarSeries2.Values.Add(New Single() {4, 2, 5, 8})
Dim MyBarSeries3 As IndexedBarSeries = New IndexedBarSeries("Website C", xAxis, yAxis)
MyBarSeries3.Values.Add(New Single() {2, 4, 6, 9})
Thanks,
ceTe Software Support Team
Re: IndexedYAxis
Forum member · Jan 14, 2009looks like that might work for a bar series but it does not work on a line series.
my code shows an error of:
value of numericYAxis cannot be converted to indexedYAxis
Re: IndexedYAxis
Forum member · Jan 14, 2009I fixed it by changing the Y to
Dim MyYAxis As NumericYAxis = New NumericYAxis
and leaving the X as IndexedXAxis.
But the I guess they are default values of 0 to 240 still shows on the y axis and my new y axis value show over the top of them. How do I get rid of the ones showing automaticly.
Re: IndexedYAxis
Support · Jan 15, 2009Hello,
In order to stop showing the default values of the YAxis, you will have to set the AutoLabels property to false. Following is the sample line of code for this.
MyYAxis.Labels.AutoLabels = False
Thanks,
ceTe Software Support Team.
Re: IndexedYAxis
Forum member · Jan 15, 2009Thanks, that got rid of the automatic numbers, but it appears that my markers are still plotting based on those automatic numbers not the values I have made for the Y axis.
Re: IndexedYAxis
Support · Jan 15, 2009Hello,
The Labels you are adding to the YAxis are to display in the Y axis and it is not related to the markers. The markers will be placed according to the internal calcuations for the given values. The YAxis labels also will be displayed according to these default values only. You can run the below sample code and see the output how it plots the markers and labels.
Document document = new Document();
Page page = new Page();
document.Pages.Add(page);
Chart chart = new Chart(0, 0, 500, 300);
PlotArea plotArea = chart.PlotAreas.Add(0, 0, 250, 300);
Title title1 = new Title("Website Visitors Year - 2007");
chart.HeaderTitles.Add(title1);
NumericYAxis yAxis = new NumericYAxis();
yAxis.Labels.AutoLabels = false;
yAxis.Labels.Add(new NumericYAxisLabel("Q1", 3));
yAxis.Labels.Add(new NumericYAxisLabel("Q2", 6));
yAxis.Labels.Add(new NumericYAxisLabel("Q3", 9));
yAxis.Labels.Add(new NumericYAxisLabel("Q4", 12));
IndexedXAxis xAxis = new IndexedXAxis();
IndexedLineSeries MyLineSeries1 = new IndexedLineSeries("Website A", xAxis, yAxis);
MyLineSeries1.Values.Add(new Single[] { 12, 10, 8, 3 });
MyLineSeries1.Marker = Marker.GetCircle(5);
plotArea.Series.Add(MyLineSeries1);
page.Elements.Add(chart);
document.Draw(@"C:\Temp\MyDocument.pdf");
Thanks,
ceTe Software Support Team.
Re: IndexedYAxis
Forum member · Jan 15, 2009So are you saying that you can't actually change the values the Y axis uses. If that is the case why let someone change the position of the label, because as you can see in my example the numbers do not line up at all if you do. the first student score is actually 190 but based on the chart you would think it was about 220. Here is the example I'm building to try and get this chart to work based on the specs I'll need for the report I need to build.
' Create a MyChart
Dim MyChart As New Chart(5, 250, 400, 230)
' Create a plot area
Dim MyPlotArea As PlotArea = MyChart.PrimaryPlotArea
' Create header titles and add it to the MyChart
Dim MyTitle1 As New Title("Reading Longitudinal Growth Report")
MyChart.HeaderTitles.Add(MyTitle1)
'Create Y Axis
Dim MyYAxis As NumericYAxis = New NumericYAxis
MyYAxis.Labels.AutoLabels = False
MyYAxis.Labels.Add(New NumericYAxisLabel("185", 10))
MyYAxis.Labels.Add(New NumericYAxisLabel("195", 60))
MyYAxis.Labels.Add(New NumericYAxisLabel("205", 110))
MyYAxis.Labels.Add(New NumericYAxisLabel("215", 160))
MyYAxis.Labels.Add(New NumericYAxisLabel("225", 210))
MyYAxis.Labels.Add(New NumericYAxisLabel("235", 260))
'Create X axis
Dim MyxAxis As IndexedXAxis = New IndexedXAxis
MyxAxis.Labels.Add(New IndexedXAxisLabel("Grade 3", 0))
MyxAxis.Labels.Add(New IndexedXAxisLabel("Grade 4", 1))
MyxAxis.Labels.Add(New IndexedXAxisLabel("Grade 5", 2))
' Create a indexed line series and add values to it
Dim MyMarker As Marker
MyMarker = Marker.GetDiamond(6)
Dim MyLineSeries1 As New IndexedLineSeries("Student Scores", MyxAxis, MyYAxis)
MyLineSeries1.Values.Add(New Single() {190, 205, 215})
MyLineSeries1.Marker = MyMarker
MyMarker = Marker.GetSquare(6)
Dim MyLineSeries2 As New IndexedLineSeries("Benchmark", MyxAxis, MyYAxis)
MyLineSeries2.Values.Add(New Single() {204, 211, 218})
MyLineSeries2.Marker = MyMarker
MyMarker = Marker.GetTriangle(6)
Dim MyLineSeries3 As New IndexedLineSeries("School Average", MyxAxis, MyYAxis)
MyLineSeries3.Values.Add(New Single() {214, 220, 224})
MyLineSeries3.Marker = MyMarker
' Add indexed line series to the plot area
MyPlotArea.Series.Add(MyLineSeries1)
MyPlotArea.Series.Add(MyLineSeries2)
MyPlotArea.Series.Add(MyLineSeries3)
' Create a title and add it to the yaxis
Dim MylTitle As New Title("Scale Score")
MyLineSeries1.YAxis.Titles.Add(MylTitle)
'Add the MyChart to the MyPage
MyPage.Elements.Add(MyChart)
Re: IndexedYAxis
Support · Jan 15, 2009Hello,
We have been able to recreate the behavior you mentioned. We have forwarded this over to the developers to look into further. We will post updates as soon as they become available.
Thanks,
ceTe Software Support Team
Re: IndexedYAxis
Forum member · Jan 15, 2009will the update be posted here, or will I have to look somewhere else. Also what kind of time frame does this usually take, I have a deadline. If this isn't a day or two thing then I will need to start doing this in a different product.
Re: IndexedYAxis
Support · Jan 15, 2009Hello,
We will be posting updates on this thread. We expect to have some updates on this sometime early next week.
Thanks,
ceTe Software Support Team
Re: IndexedYAxis
Forum member · Jan 15, 2009I found the answer to my biggest problem. by using the example I sent you. by adding
MyYAxis.Min = 185
MyYAxis.Max = 235
MyYAxis.Interval = 10
and then commenting out myYAxis.labels.add stuff and the MyYAxis.Labels.AutoLabels = False. I get the results I want.
I also want a data label and your documents says that ValuePositionDataLabel is avaliable on numeric and indexed axis, but when I use
MyLineSeries1.ValuePositionDataLabel = New ValuePositionDataLabel(True, True, True) I get the error that ValuePositionDataLabel is not a member of IndexedLineSeries. is there a way to show the data value for the markers in my example. thanks
Re: IndexedYAxis
Support · Jan 16, 2009Hello,
Yes, you can use the ValuePositionDataLabel with the line series without any problem. You will have to use the DataLabel property of the series. Following is the sample code for this.
MyLineSeries1.DataLabel = New ValuePositionDataLabel(True, True, False)
Thanks,
ceTe Software Support Team.
Re: IndexedYAxis
Forum member · Jan 20, 2009Thanks that did it. I didn't find that example in you help files, you might want to add it.