S
Sascha Sertel
In an ideal world, I wouldn't have to write this posting. In an almost ideal
world, I would like to have the guy who programmed the Microsoft OWC11 (and
earlier) read this and answer me the following questions:
1. Why does the ChSeries.SetData method not accept chDataBound as the data
source? To me it seems very logic to set the Category and Value fields from
my recordset per Series, and not per Chart or per ChartSpace. The
documentation does not even explicitly say that this value cannot be used on
ChSeries. After reading it over and over again it seems to be hinted at when
the remarks say that only one data source can be set for a Chart or
ChartSpace (because the word Series doesn't even appear here). In a
knowledgebase article Microsoft says that if you want to add more data or
series, you have to populate arrays and add them as chDataLiteral to the
Chart.
2. Okay, even if I accept the fact that I cannot assign DataBound values to
Series directly, I start assigning it to the ChartSpace, only to find more
oddities. Why is a new Chart added to the ChartSpace as soon as the line
m_cspace.DataSource = m_rs (where m_cspace is the ChartSpace object and m_rs
the RecordSet) is executed? It doesn't matter if the HasMultipleCharts value
is set to false or not, the additional chart gets added in any way. Even in
Microsofts own example ChartGif (can be found in the KnowledgeBase) there is
the following line which gets rid of the additional chart again
(interestingly the only line in the whole script which is not explained with
a comment): m_cspace.Charts.Delete 1
3. Well, as long as the Delete resolves the situation I at least have a
workaround, but unfortunately it doesn't end here. Now OWC tries to be
intelligent and helpful. A noble effort, but very annoying if forced onto me
and I can't find a way to deactivate it (if anyone knows a solution for
this, please let me know!!): Why are the Category values automatically
sorted? I bind my chDimCategories dimension to a recordset field which I
presorted when selecting it, but when it is displayed suddenly the
categories are ordered lexicographically and not in the way they are in the
recordset. My categories happen to be Time labels such as "March 2004" etc.
and I wanted to have them exactly this way and not 03/2004 or 03/01/2004 or
anything like that. However, the string "March 2004" is not recognized as a
date by OWC, so it 'thinks' we have a random category list and sorts it for
me. It doesn't matter if I have the Sort string set for the Recordset or
not, since the OWC sorting comes after that. Only if I format my date in a
form such as 03/01/2004 it will be displayed and ordered correctly. But why
can't I chose if I want that to be automatically sorted or not? I looked
through all the Methods and Properties of ChartSpace, nothing even seems to
hint to something like sorting. I guess the OWC feature list I found online
says it all: "With added special handling for date/time data, the chart will
fill in missing dates, sort dates in the correct order, group data points by
time intervals, and present a visually appealing axis that is intelligent
about labels, tick-marks, and gridline intervals."
Finally I ended up setting the recordset, deleting the extra charts object,
and populating arrays manually from my recordset which I then use for the
SetData method of my Series. That way, I get MY labels in MY order, and
everything looks fine.
I'm only refering to the OWC Chart Component here, I'm sure the list goes on
for the Spreadshit and Pivot Components. In case I'm just totally stupid and
didn't use the OWC right, please feel free to explain to me how it should
work.
Sascha
world, I would like to have the guy who programmed the Microsoft OWC11 (and
earlier) read this and answer me the following questions:
1. Why does the ChSeries.SetData method not accept chDataBound as the data
source? To me it seems very logic to set the Category and Value fields from
my recordset per Series, and not per Chart or per ChartSpace. The
documentation does not even explicitly say that this value cannot be used on
ChSeries. After reading it over and over again it seems to be hinted at when
the remarks say that only one data source can be set for a Chart or
ChartSpace (because the word Series doesn't even appear here). In a
knowledgebase article Microsoft says that if you want to add more data or
series, you have to populate arrays and add them as chDataLiteral to the
Chart.
2. Okay, even if I accept the fact that I cannot assign DataBound values to
Series directly, I start assigning it to the ChartSpace, only to find more
oddities. Why is a new Chart added to the ChartSpace as soon as the line
m_cspace.DataSource = m_rs (where m_cspace is the ChartSpace object and m_rs
the RecordSet) is executed? It doesn't matter if the HasMultipleCharts value
is set to false or not, the additional chart gets added in any way. Even in
Microsofts own example ChartGif (can be found in the KnowledgeBase) there is
the following line which gets rid of the additional chart again
(interestingly the only line in the whole script which is not explained with
a comment): m_cspace.Charts.Delete 1
3. Well, as long as the Delete resolves the situation I at least have a
workaround, but unfortunately it doesn't end here. Now OWC tries to be
intelligent and helpful. A noble effort, but very annoying if forced onto me
and I can't find a way to deactivate it (if anyone knows a solution for
this, please let me know!!): Why are the Category values automatically
sorted? I bind my chDimCategories dimension to a recordset field which I
presorted when selecting it, but when it is displayed suddenly the
categories are ordered lexicographically and not in the way they are in the
recordset. My categories happen to be Time labels such as "March 2004" etc.
and I wanted to have them exactly this way and not 03/2004 or 03/01/2004 or
anything like that. However, the string "March 2004" is not recognized as a
date by OWC, so it 'thinks' we have a random category list and sorts it for
me. It doesn't matter if I have the Sort string set for the Recordset or
not, since the OWC sorting comes after that. Only if I format my date in a
form such as 03/01/2004 it will be displayed and ordered correctly. But why
can't I chose if I want that to be automatically sorted or not? I looked
through all the Methods and Properties of ChartSpace, nothing even seems to
hint to something like sorting. I guess the OWC feature list I found online
says it all: "With added special handling for date/time data, the chart will
fill in missing dates, sort dates in the correct order, group data points by
time intervals, and present a visually appealing axis that is intelligent
about labels, tick-marks, and gridline intervals."
Finally I ended up setting the recordset, deleting the extra charts object,
and populating arrays manually from my recordset which I then use for the
SetData method of my Series. That way, I get MY labels in MY order, and
everything looks fine.
I'm only refering to the OWC Chart Component here, I'm sure the list goes on
for the Spreadshit and Pivot Components. In case I'm just totally stupid and
didn't use the OWC right, please feel free to explain to me how it should
work.
Sascha