OWC10 Chart Legend Problem

N

NJost

I'm creating a chart something like so in C# (I *have* simplified, mainly by
dropping try/catch blocks and abstracting my data collection code):
axChart = new OWC10.ChartSpaceClass();
axChart.Clear();
axChart.Charts.Add(0);
axChart.Charts[0].Type = OWC10.ChartChartTypeEnum.chChartTypeLine;
// Get date values as the categories EXP:
("01/01/2001,02/01/2001,03/01/2001")
axChart.Charts[0].SetData(OWC10.ChartDimensionsEnum.chDimCategories,
(int)OWC10.ChartSpecialDataSourcesEnum.chDataLiteral, sTotalReadBuffer);
while (sDataRecord = myStuff.GetRecord()) {

axChart.Charts[0].SeriesCollection[iSeriesCount].SetData(OWC10.ChartDimensio
nsEnum.chDimValues, (int)OWC10.ChartSpecialDataSourcesEnum.chDataLiteral,
sDataRecord);
iSeriesCount++;
}
axChart.Charts[0].Name = sFileName;
axChart.Charts[0].HasLegend = true;
axChart.Charts[0].Axes[0].HasTitle = true;
axChart.Charts[0].Axes[0].Title.Caption = "Date";
axChart.Charts[0].Axes[0].MajorUnit = 1;
axChart.Charts[0].Axes[1].HasTitle = true;
axChart.Charts[0].Axes[1].Title.Caption = "Buggers";

--END SNIPPET--

1.) When I run this I get an extra series in my legend labled "Series 1".
This series does not plot. I thought at first that I was reading too much
data so I did two things. First, I tried chopping off the last series.
This results in the chart running fine, but my dates disappear and are
replaced by whole numbers in ascending order of entry (e.g.
"01/01/2002,01/02/2002,01/03/2002" would be replaced by "1,2,3"). Second I
added a line that set the colors in my loop, this trailing entry didn't have
any of my color sets. I'm let to believe that adding categories creates a
new series, but how do I prevent that from showing up on the legend?
2.) I posted this in another thread, but how can I restrict *using strings
as my method of entry* the dates shown on the axis? I realize you can
group, which seems to work fine on bar graphs, but not on line graphs.
 
M

Madan

Hi

to avoid two legends being displayed ... use only
HasChartSpaceLegend property of ChartSpace and do not use
ChartSpace.Charts(0).HasLegend property at all... if u
intend to have only one chart being displayed all time.

madan
-----Original Message-----
I'm creating a chart something like so in C# (I *have* simplified, mainly by
dropping try/catch blocks and abstracting my data collection code):
axChart = new OWC10.ChartSpaceClass();
axChart.Clear();
axChart.Charts.Add(0);
axChart.Charts[0].Type = OWC10.ChartChartTypeEnum.chChartTypeLine;
// Get date values as the categories EXP:
("01/01/2001,02/01/2001,03/01/2001")
axChart.Charts[0].SetData (OWC10.ChartDimensionsEnum.chDimCategories,
(int)OWC10.ChartSpecialDataSourcesEnum.chDataLiteral,
sTotalReadBuffer);
while (sDataRecord = myStuff.GetRecord()) {

axChart.Charts[0].SeriesCollection[iSeriesCount].SetData (OWC10.ChartDimensio
nsEnum.chDimValues, (int) OWC10.ChartSpecialDataSourcesEnum.chDataLiteral,
sDataRecord);
iSeriesCount++;
}
axChart.Charts[0].Name = sFileName;
axChart.Charts[0].HasLegend = true;
axChart.Charts[0].Axes[0].HasTitle = true;
axChart.Charts[0].Axes[0].Title.Caption = "Date";
axChart.Charts[0].Axes[0].MajorUnit = 1;
axChart.Charts[0].Axes[1].HasTitle = true;
axChart.Charts[0].Axes[1].Title.Caption = "Buggers";

--END SNIPPET--

1.) When I run this I get an extra series in my legend labled "Series 1".
This series does not plot. I thought at first that I was reading too much
data so I did two things. First, I tried chopping off the last series.
This results in the chart running fine, but my dates disappear and are
replaced by whole numbers in ascending order of entry (e.g.
"01/01/2002,01/02/2002,01/03/2002" would be replaced by "1,2,3"). Second I
added a line that set the colors in my loop, this trailing entry didn't have
any of my color sets. I'm let to believe that adding categories creates a
new series, but how do I prevent that from showing up on the legend?
2.) I posted this in another thread, but how can I restrict *using strings
as my method of entry* the dates shown on the axis? I realize you can
group, which seems to work fine on bar graphs, but not on line graphs.


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top