User (Legacy) Posted October 15, 2004 Report Share Posted October 15, 2004 Hi, Below is the code i used in C#: The method setSeries() and setLegends(0 are significant. If i use the methods in the code below i get the resultant charts as attached in this mail . For Pie there is no label o the slices but for doughniut there is disoriented labels. public ASCOMChartFXChart() { // chart.LegendBox = true; //chart.SerLegBox= true; //chart.PointLabelAlign= ChartfxLib.CfxAlign.LA_BOTTOM ; //chart.PointLabelAngle= ChartfxLib.CfxAlign.LA_BOTTOM ; // TODO: Add constructor logic here // } public void setSeries(ChartFXClass chart, DataTable table) { string chtType=ChartType.ToString(); DataRowCollection rows = table.Rows; for(int i=0; i<table.Rows.Count; i++) { for(int j=0; j<table.Columns.Count; j++) { DataRow r = rows[i]; if (chtType.Equals("bar")) { chart.set_ValueEx(Convert.ToByte(i),j,Convert.ToDouble(r[j])); } else { chart.set_ValueEx(Convert.ToByte(j),i,Convert.ToDouble(r[j])); } } } } /// <summary> /// sets the legends the chart /// </summary> /// <param name="chart"></param> /// <returns>void</returns> public void setLegends(ChartFXClass chart,int nseries) { string chtType=ChartType.ToString(); string[] temp = Chart.Report.Legends; if(chtType.Equals("pie")) { chart.SerLegBox= false; for(int i=0; i<temp.Length; i++) { chart.set_Legend(i,temp[i]); } } else { chart.SerLegBox= true; for(int i=0; i<temp.Length; i++) { chart.set_SerLeg(Convert.ToByte(i),temp[i]); //chart.set_Legend(j,temp[j]); } } } ASData data = new ASData(); DataSet dSet = (DataSet)DataSource; //data.fetch("SELECT COUNT(*) AS COUNT FROM WF_STEP_ACTIVITY WHERE WS_INSTANCE_ID LIKE 'UZM%'GROUP BY WS_INSTANCE_ID", data.Connections[4]); chart.OpenDataEx(ChartfxLib.CfxCod.COD_VALUES & ChartfxLib.CfxCod.COD_COLORS,dSet.Tables[0].Rows.Count,dSet.Tables[0].Column s.Count); chart.RGB3DBk=0xFFFFFF; chart.Chart3D = true; setSeries(chart, dSet.Tables[0]); setSeriesColor(chart, dSet.Tables[0].Rows.Count, dSet.Tables[0].Columns.Count); setDrillDowns(chart); setLegends(chart,dSet.Tables[0].Columns.Count); chart.CloseData(ChartfxLib.CfxCod.COD_VALUES & ChartfxLib.CfxCod.COD_COLORS); string htmlTags = chart.GetHtmlTag(Width,Height,"SVG",ID,ID); return htmlTags; } // end of public override string render() #endregion } ----- Original Message ----- From: "SoftwareFX Support" <noreply@softwarefx.com> Newsgroups: chartfx.internet.55 Sent: Wednesday, October 13, 2004 6:06 PM Subject: Re: labels not showing correctly > Do all these charts have the same data ? > > It doesn't look like it. > > Which legend box are you displaying ? Please attach a code snippet that > shows the problem. > > -- > FP > Software FX > > Link to comment Share on other sites More sharing options...
Software FX Posted October 18, 2004 Report Share Posted October 18, 2004 Well, since your code is taking from a database that I don't know I can not tell whether this is correct or not. I think the problem is that you are mixing-up the columns (series) with the rows (points), but since you have 2 series and 2 points the difference is not that clear. A Pie chart, will draw as many pies as series you have. Each PIE (not slice, but the whole pie) will be labeled at the top using the Series legend for that PIE. If PointLabels is turned ON, the Point labels (chart.Legend) will be display for each SLICE. The values legend (Chart.LegendBox) will show whatever you assigned to chat.Legend. I suggest you change one of these numbers (Number of series or number of points) so that you see the difference more clear and then figure out how to pass your data. If you still have problems please: - Attach a picture with the Data Editor visible (chart.DataEditor = true) - Export the chart to a binary file and attach it as well (use the Export method to do this). -- FP Software FX Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.