/// <summary> /// XML数据头 /// </summary> /// <param name="c"></param> /// <returns></returns> public string GetFusionChartStartXML(chart c, string chartName) { StringBuilder sb_Start = new StringBuilder(); sb_Start.Append("<chart caption='" + c.Caption + "' xAxisName='" + c.XAxisName + "' yAxisName='" + c.YAxisName + "' yAxisMaxValue='" + c.YAxisMaxValue + "' numberPrefix='" + c.NumberPrefix + "' divLinColor='" + c.DivLineColor + "' divLineAlpha='" + c.DivLineAlpha + "' alternatrHGridAlpha='" + c.AlternateHGridAlpha + "' canvasBorderColor='" + c.CanvasBorderColor + "' baseFontColor='" + c.BaseFontColor + "' lineColor='" + c.LineColor + "' numVDivlines='" + c.NumVDivlines + "' showAlternateVGridColor='" + c.ShowAlternateVgridColor + "' anchorSides='" + c.AnchorSides + "' anchorRadius='" + c.AnchorRadius + "' showValues='" + c.ShowValues + "' showLabels='" + c.ShowLables + "' decimals='" + c.Decimals + "' placeValuesInside='" + c.PlaceValuesInside + "' rotateValues='" + c.RotateValues + "' showLegend='" + c.ShowLegend + "' legendPosition='" + c.LegendPosition + "' bgcolor='" + c.Bgcolor + "' basefontsize='" + c.Basefontsize + "' showpercentvalues='" + c.Showpercentvalues + "' bgratio='" + c.Bgratio + "' startingangle='" + c.Startingangle + "' animation='" + c.Animation + "' bgalpha='" + c.Bgalpha + "' chartrightmargin='" + c.ChartRightmargin + "' slicingDistance='" + c.SlicingDistance + "' isSliced='" + c.IsSliced + "' showNames='" + c.ShowNames + "' formatNumberScale='" + c.FormatNumberScale + "' canvasBgAlpha='" + c.CanvasBgAlpha + "' drawQuadrant='" + c.DrawQuadrant + "' quadrantLabelTL='" + c.QuadrantLabelTL + "' quadrantLabelTR='" + c.QuadrantLabelTR + "' quadrantLabelBR='" + c.QuadrantLabelBR + "' quadrantLabelBL='" + c.QuadrantLabelBL + "' quadrantLineThickness='" + c.QuadrantLineThickness + "' quadrantLineColor='" + c.QuadrantLineColor + "' quadrantXVal='" + c.QuadrantXVal + "' quadrantYVal='" + c.QuadrantYVal + "' pNumberSuffix='" + c.PNumberSuffix + "' sNumberSuffix='" + c.SNumberSuffix + "' NumberSuffix='" + c.NumberSuffix + "' pYAxisName='" + c.PYAxisName + "' sformatNumberScale='" + c.SFormatNumberScale + "' showZeroPies='" + c.ShowZeroPies + "' pformatNumberScale='" + c.PFormatNumberScale + "' showPercentInToolTip='" + c.ShowPercentInToolTip + "' sYAxisName='" + c.SYAxisName + "' rotatesYAxisName='" + c.RotateSYAxisNames + "' howLables='" + c.HowLables + "' labelPadding='" + c.LabelPadding + "' yAxisValuesPadding='" + c.YAxisValuesPadding + "' valuePosition='" + c.ValuePosition + "' labelDisplay='" + c.LabelDisplay + "' slantLabels='" + c.SlantLabels + "' anchorBgAlpha='" + c.AnchorBgAlpha + "' limitsDecimalPrecision='" + c.LimitsDecimalPrecision + "'>"); return(sb_Start.ToString()); }
/// <summary> /// 获取图表XML字符串(双轴) /// </summary> /// <param name="dt"></param> /// <param name="c"></param> /// <param name="llist"></param> /// <param name="slist"></param> /// <param name="chartType"></param> /// <returns></returns> public string GetXMLData(DataTable dt, chart c, IList <line> llist, IList <style> slist, FusionChartType chartType, IList <string> colors, string chartName, string chartWidth, string chartHeight, IList <string> countershaft, string isload = "") { GetFusionChartDataXML getXML = new GetFusionChartDataXML(); StringBuilder sb_XMLData = new StringBuilder(); colors = new List <string>(); while (colors.Count < dt.Columns.Count) { colors.Add("000080"); colors.Add("ff0000"); colors.Add("ff8901"); colors.Add("55FFFF"); colors.Add("00BF55"); colors.Add("FFBF00"); colors.Add("FFFF00"); colors.Add("FF9FFF"); colors.Add("00FB00"); colors.Add("FF9FFF"); colors.Add("FF9ooo"); colors.Add("EF9FFF"); colors.Add("5F9FFF"); colors.Add("000000"); colors.Add("55FFFF"); colors.Add("ffffff"); colors.Add("000080"); colors.Add("0ED1DC"); colors.Add("595959"); colors.Add("55FFFF"); colors.Add("00BF55"); colors.Add("FFBF00"); colors.Add("FFFF00"); colors.Add("FF9ooo"); colors.Add("EF9FFF"); colors.Add("5F9FFF"); colors.Add("000000"); colors.Add("000080"); colors.Add("ff0000"); colors.Add("595959"); colors.Add("55FFFF"); colors.Add("00BF55"); colors.Add("FFBF00"); colors.Add("FFFF00"); colors.Add("FF9FFF"); colors.Add("00FB00"); colors.Add("000080"); colors.Add("0ED1DC"); colors.Add("595959"); colors.Add("55FFFF"); colors.Add("00BF55"); colors.Add("FFBF00"); colors.Add("FFFF00"); colors.Add("FF9ooo"); colors.Add("EF9FFF"); colors.Add("5F9FFF"); } if (chartType == FusionChartType.MSColumn2D) { sb_XMLData.Append(getXML.GetFusionChartStartXML(c, chartName)); sb_XMLData.Append(getXML.GetFusionChartGeneralXML(dt, colors)); //sb_XMLData.Append(getXML.GetFusionChartTrendLinesXML(llist)); // sb_XMLData.Append(getXML.GetFusionChartStyleXML(slist)); sb_XMLData.Append(getXML.GetFusionChartEndXML()); return(RenderChart( "../Scripts/FusionChart/Swf/MSColumn2D.swf", "", sb_XMLData.ToString(), chartName, chartWidth, chartHeight, false, true )); } else if (chartType == FusionChartType.Doughnut2D) { sb_XMLData.Append(getXML.GetFusionChartStartXML(c, chartName)); sb_XMLData.Append(getXML.GetFusionChartSetXML(dt, colors)); sb_XMLData.Append(getXML.GetFusionChartStyleXML(slist)); sb_XMLData.Append(getXML.GetFusionChartEndXML()); return(RenderChart( "../Scripts/FusionChart/Swf/Doughnut2D.swf", "", sb_XMLData.ToString(), chartName, chartWidth, chartHeight, false, true )); } else if (chartType == FusionChartType.Pie2D) { sb_XMLData.Append(getXML.GetFusionChartStartXML(c, chartName)); sb_XMLData.Append(getXML.GetFusionChartSetXML(dt, colors)); sb_XMLData.Append(getXML.GetFusionChartStyleXML(slist)); sb_XMLData.Append(getXML.GetFusionChartEndXML()); if (!string.IsNullOrWhiteSpace(isload)) { return(sb_XMLData.ToString()); } else { return(RenderChart( "../Scripts/FusionChart/Swf/Pie2D.swf", "", sb_XMLData.ToString(), chartName, chartWidth, chartHeight, false, true )); } } else if (chartType == FusionChartType.AngularGauge) { sb_XMLData.Append(getXML.GetFusionChartStartXML(c, chartName)); sb_XMLData.Append(getXML.GetFusionChartGeneralXML(dt, colors)); sb_XMLData.Append(getXML.GetFusionChartTrendLinesXML(llist)); sb_XMLData.Append(getXML.GetFusionChartStyleXML(slist)); sb_XMLData.Append(getXML.GetFusionChartEndXML()); return(RenderChart( "../Scripts/FusionChart/Swf/AngularGauge.swf", "", sb_XMLData.ToString(), chartName, chartWidth, chartHeight, false, true )); } else if (chartType == FusionChartType.Bubble) { sb_XMLData.Append(getXML.GetFusionChartStartXML(c, chartName)); sb_XMLData.Append(getXML.GetFusionChartBubbleXML(dt)); sb_XMLData.Append(getXML.GetFusionChartStyleXML(slist)); sb_XMLData.Append(getXML.GetFusionChartEndXML()); return(RenderChart( "../Scripts/FusionChart/Swf/Bubble.swf", "", sb_XMLData.ToString(), chartName, chartWidth, chartHeight, false, true )); } else if (chartType == FusionChartType.Funnel) { sb_XMLData.Append(getXML.GetFusionChartStartXML(c, chartName)); sb_XMLData.Append(getXML.GetFusionChartSetXML(dt, colors)); //sb_XMLData.Append(getXML.GetFusionChartTrendLinesXML(llist)); // sb_XMLData.Append(getXML.GetFusionChartStyleXML(slist)); sb_XMLData.Append(getXML.GetFusionChartEndXML()); return(RenderChart( "../Scripts/FusionChart/Swf/Funnel.swf", "", sb_XMLData.ToString(), chartName, chartWidth, chartHeight, false, true )); } else if (chartType == FusionChartType.MSCombiDY2D) { sb_XMLData.Append(getXML.GetFusionChartStartXML(c, chartName)); sb_XMLData.Append(getXML.GetFusionChartGeneralXML(dt, colors, countershaft)); //sb_XMLData.Append(getXML.GetFusionChartStyleXML(slist)); sb_XMLData.Append(getXML.GetFusionChartEndXML()); return(RenderChart( "../Scripts/FusionChart/Swf/MSCombiDY2D.swf", "", sb_XMLData.ToString(), chartName, chartWidth, chartHeight, false, true )); } else if (chartType == FusionChartType.Line) { sb_XMLData.Append(getXML.GetFusionChartStartXML(c, chartName)); sb_XMLData.Append(getXML.GetFusionChartSetXML(dt, colors)); sb_XMLData.Append(getXML.GetFusionChartEndXML()); if (!string.IsNullOrWhiteSpace(isload)) { return(sb_XMLData.ToString()); } else { return(RenderChart( "../Scripts/FusionChart/Swf/Line.swf", "", sb_XMLData.ToString(), chartName, chartWidth, chartHeight, false, true )); } } else if (chartType == FusionChartType.Line2) { sb_XMLData.Append(getXML.GetFusionChartStartXML(c, chartName)); sb_XMLData.Append(getXML.GetFusionChartGeneralXML(dt, colors)); // sb_XMLData.Append(getXML.GetFusionChartTrendLinesXML(llist)); // sb_XMLData.Append(getXML.GetFusionChartStyleXML(slist)); sb_XMLData.Append(getXML.GetFusionChartEndXML()); if (!string.IsNullOrWhiteSpace(isload)) { return(sb_XMLData.ToString()); } else { return(RenderChart( "../Scripts/FusionChart/Swf/MSLine.swf", "", sb_XMLData.ToString(), chartName, chartWidth, chartHeight, false, true )); } } else if (chartType == FusionChartType.Pie3D) { sb_XMLData.Append(getXML.GetFusionChartStartXML(c, chartName)); sb_XMLData.Append(getXML.GetFusionChartSetXML(dt, colors)); sb_XMLData.Append(getXML.GetFusionChartStyleXML(slist)); sb_XMLData.Append(getXML.GetFusionChartEndXML()); if (!string.IsNullOrWhiteSpace(isload)) { return(sb_XMLData.ToString()); } else { return(RenderChart( "../Scripts/FusionChart/Swf/Pie3D.swf", "", sb_XMLData.ToString(), chartName, chartWidth, chartHeight, false, true )); } } return(""); }
/// <summary> /// /// </summary> /// <param name="dt"></param> /// <param name="c"></param> /// <param name="llist"></param> /// <param name="slist"></param> /// <param name="chartType"></param> /// <param name="colors"></param> /// <param name="chartName"></param> /// <param name="chartWidth"></param> /// <param name="chartHeight"></param> /// <returns></returns> public string GetXMLData(DataTable dt, chart c, IList <line> llist, IList <style> slist, FusionChartType chartType, IList <string> colors, string chartName, string chartWidth, string chartHeight, string isload = "") { IList <string> countershaft = new List <string>(); return(GetXMLData(dt, c, llist, slist, chartType, colors, chartName, chartWidth, chartHeight, countershaft, isload)); }