Type TSChart = Class
	///缺省构造函数
	Function Create(chartData); overload;
	Begin
		chartData_ := chartData;
	End;
	
	Function GetDefaultXml();
	Begin
		return '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<c:chartSpace xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
    <c:date1904 val="0"></c:date1904>
    <c:lang val="zh-CN"></c:lang>
    <c:roundedCorners val="0"></c:roundedCorners>
	<mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">
		<mc:Choice Requires="c14" xmlns:c14="http://schemas.microsoft.com/office/drawing/2007/8/2/chart">
			<c14:style val="102" />
		</mc:Choice>
		<mc:Fallback>
			<c:style val="2" />
		</mc:Fallback>
	</mc:AlternateContent>
    <c:chart>
        <c:title>
            <c:tx>
                <c:rich>
                    <a:bodyPr anchorCtr="false" rot="0" spcFirstLastPara="false"></a:bodyPr>
					<a:lstStyle />
                    <a:p>
                        <a:pPr>
                            <a:defRPr b="false" baseline="0" i="false" kern="1200" spc="0" strike="noStrike" sz="1400" u="none">
                                <a:solidFill>
                                    <a:schemeClr val="tx1">
                                        <a:lumMod val="65000"></a:lumMod>
                                        <a:lumOff val="35000"></a:lumOff>
                                    </a:schemeClr>
                                </a:solidFill>
                                <a:latin typeface="+mn-lt"></a:latin>
                                <a:ea typeface="+mn-ea"></a:ea>
                                <a:cs typeface="+mn-cs"></a:cs>
                            </a:defRPr>
                        </a:pPr>
                        <a:r>
                            <a:rPr altLang="en-US" b="false" baseline="0" i="false" kern="0" lang="en-US" spc="0"></a:rPr>
                            <a:t>Chart</a:t>
                        </a:r>
						<a:endParaRPr lang="en-US" altLang="en-US" b="0" i="0" kern="0" spc="0" baseline="0" />
                    </a:p>
                </c:rich>
            </c:tx>
			<c:layout />
            <c:overlay val="0"></c:overlay>
        </c:title>
		<c:autoTitleDeleted val="0" />
        <c:view3D />
		<c:plotArea/>
        <c:legend>
            <c:legendPos val="b"></c:legendPos>
			<c:layout />
			<c:overlay val="0" />
			<c:txPr>
				<a:bodyPr rot="0" spcFirstLastPara="0" vertOverflow="ellipsis" vert="horz" wrap="square" anchor="ctr" anchorCtr="1" />
				<a:lstStyle />
				<a:p>
					<a:pPr>
						<a:defRPr lang="zh-CN" sz="1000" b="0" i="0" u="none" strike="noStrike" kern="1200" baseline="0">
							<a:solidFill>
								<a:schemeClr val="tx1" />
							</a:solidFill>
							<a:latin typeface="+mn-lt" />
							<a:ea typeface="+mn-ea" />
							<a:cs typeface="+mn-cs" />
						</a:defRPr>
					</a:pPr>
				</a:p>
			</c:txPr>
        </c:legend>
        <c:plotVisOnly val="0"></c:plotVisOnly>
        <c:dispBlanksAs val="zero"></c:dispBlanksAs>
        <c:showDLblsOverMax val="0"></c:showDLblsOverMax>
    </c:chart>
    <c:spPr>
        <a:solidFill>
            <a:schemeClr val="bg1"></a:schemeClr>
        </a:solidFill>
        <a:ln algn="ctr" cap="flat" cmpd="sng" w="9525">
            <a:solidFill>
                <a:schemeClr val="tx1">
                    <a:lumMod val="15000"></a:lumMod>
                    <a:lumOff val="85000"></a:lumOff>
                </a:schemeClr>
            </a:solidFill>
        </a:ln>
    </c:spPr>
</c:chartSpace>';
	End;
	
	Function IsWord();virtual;
	Begin
		return false;
	End;

	Function Apply(xmlObj);
	Begin
		chartData_.Serialize(IsWord());	//初始化图表数据
		task := array(('c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:r/a:t', 'pcdata', class(TSXml).CurCodePageToUtf8(chartData_.Title)),
					('c:chartSpace/c:chart/c:plotVisOnly', 'val', chartData_.plotVisOnly),
					('c:chartSpace/c:chart/c:dispBlanksAs', 'val', chartData_.ShowBlanksAs),
					('c:chartSpace/c:chart/c:legend', 'Del', ifnil(chartData_.Legend)),
					('c:chartSpace/c:chart/c:plotArea', 'unmarshal', chartData_.plotArea.Marshal()),
					('c:chartSpace/c:chart/c:view3D', 'unmarshal', getview3D().Marshal())
					);
		for i:=0 to length(task)-1 do Begin
			class(TSXml).SetNodeValue(xmlObj, task[i]);
		End;
		if ifObj(chartData_.Legend) then Begin
			node := class(TSXml).GetNode(xmlObj, 'c:chartSpace/c:chart/c:legend');
			if ifObj(node) then Begin
				arr := chartData_.Legend.Marshal();
				class(TSXml).UpdateNode(node, arr['attributes'], arr['children']);
			End;
		End;
		chartData_.plotAreaNode := class(TSXml).GetNode(xmlObj, 'c:chartSpace/c:chart/c:plotArea');
		if chartData_.DataTable then
			chartData_.ShowDataTable(true);
	End;
protected	
	Function getview3D();
	Begin
		view3D := TOfficeObj('TView3D');
		chartView3DRotX := array(
			'area':                        0,
			'areastacked':                 0,
			'areapercentstacked':          0,
			'area3d':                      15,
			'area3dstacked':               15,
			'area3dpercentstacked':        15,
			'bar':                         0,
			'barstacked':                  0,
			'barpercentstacked':           0,
			'bar3dclustered':              15,
			'bar3dstacked':                15,
			'bar3dpercentstacked':         15,
			'bar3dconeclustered':          15,
			'bar3dconestacked':            15,
			'bar3dconepercentstacked':     15,
			'bar3dpyramidclustered':       15,
			'bar3dpyramidstacked':         15,
			'bar3dpyramidpercentstacked':  15,
			'bar3dcylinderclustered':      15,
			'bar3dcylinderstacked':        15,
			'bar3dcylinderpercentstacked': 15,
			'col':                         0,
			'colstacked':                  0,
			'colpercentstacked':           0,
			'col3d':                       15,
			'col3dclustered':              15,
			'col3dstacked':                15,
			'col3dpercentstacked':         15,
			'col3dcone':                   15,
			'col3dconeclustered':          15,
			'col3dconestacked':            15,
			'col3dconepercentstacked':     15,
			'col3dpyramid':                15,
			'col3dpyramidclustered':       15,
			'col3dpyramidstacked':         15,
			'col3dpyramidpercentstacked':  15,
			'col3dcylinder':               15,
			'col3dcylinderclustered':      15,
			'col3dcylinderstacked':        15,
			'col3dcylinderpercentstacked': 15,
			'doughnut':                    0,
			'line':                        0,
			'pie':                         0,
			'pie3d':                       30,
			'pieofpiechart':               0,
			'barofpiechart':               0,
			'radar':                       0,
			'scatter':                     0,
			'surface3d':                   15,
			'wireframesurface3d':          15,
			'contour':                     90,
			'wireframecontour':            90);
		chartView3DRotY := array(
			'area':                        0,
			'areastacked':                 0,
			'areapercentstacked':          0,
			'area3d':                      20,
			'area3dstacked':               20,
			'area3dpercentstacked':        20,
			'bar':                         0,
			'barstacked':                  0,
			'barpercentstacked':           0,
			'bar3dclustered':              20,
			'bar3dstacked':                20,
			'bar3dpercentstacked':         20,
			'bar3dconeclustered':          20,
			'bar3dconestacked':            20,
			'bar3dconepercentstacked':     20,
			'bar3dpyramidclustered':       20,
			'bar3dpyramidstacked':         20,
			'bar3dpyramidpercentstacked':  20,
			'bar3dcylinderclustered':      20,
			'bar3dcylinderstacked':        20,
			'bar3dcylinderpercentstacked': 20,
			'col':                         0,
			'colstacked':                  0,
			'colpercentstacked':           0,
			'col3d':                       20,
			'col3dclustered':              20,
			'col3dstacked':                20,
			'col3dpercentstacked':         20,
			'col3dcone':                   20,
			'col3dconeclustered':          20,
			'col3dconestacked':            20,
			'col3dconepercentstacked':     20,
			'col3dpyramid':                20,
			'col3dpyramidclustered':       20,
			'col3dpyramidstacked':         20,
			'col3dpyramidpercentstacked':  20,
			'col3dcylinder':               20,
			'col3dcylinderclustered':      20,
			'col3dcylinderstacked':        20,
			'col3dcylinderpercentstacked': 20,
			'doughnut':                    0,
			'line':                        0,
			'pie':                         0,
			'pie3d':                       0,
			'pieofpiechart':               0,
			'barofpiechart':               0,
			'radar':                       0,
			'scatter':                     0,
			'surface3d':                   20,
			'wireframesurface3d':          20,
			'contour':                     0,
			'wireframecontour':            0);
		chartView3DPerspective  := array(
			'contour':          0,
			'wireframecontour': 0);
		chartView3DRAngAx  := array(
			'area':                        0,
			'areastacked':                 0,
			'areapercentstacked':          0,
			'area3d':                      1,
			'area3dstacked':               1,
			'area3dpercentstacked':        1,
			'bar':                         0,
			'barstacked':                  0,
			'barpercentstacked':           0,
			'bar3dclustered':              1,
			'bar3dstacked':                1,
			'bar3dpercentstacked':         1,
			'bar3dconeclustered':          1,
			'bar3dconestacked':            1,
			'bar3dconepercentstacked':     1,
			'bar3dpyramidclustered':       1,
			'bar3dpyramidstacked':         1,
			'bar3dpyramidpercentstacked':  1,
			'bar3dcylinderclustered':      1,
			'bar3dcylinderstacked':        1,
			'bar3dcylinderpercentstacked': 1,
			'col':                         0,
			'colstacked':                  0,
			'colpercentstacked':           0,
			'col3d':                       1,
			'col3dclustered':              1,
			'col3dstacked':                1,
			'col3dpercentstacked':         1,
			'col3dcone':                   1,
			'col3dconeclustered':          1,
			'col3dconestacked':            1,
			'col3dconepercentstacked':     1,
			'col3dpyramid':                1,
			'col3dpyramidclustered':       1,
			'col3dpyramidstacked':         1,
			'col3dpyramidpercentstacked':  1,
			'col3dcylinder':               1,
			'col3dcylinderclustered':      1,
			'col3dcylinderstacked':        1,
			'col3dcylinderpercentstacked': 1,
			'doughnut':                    0,
			'line':                        0,
			'pie':                         0,
			'pie3d':                       0,
			'pieofpiechart':               0,
			'barofpiechart':               0,
			'radar':                       0,
			'scatter':                     0,
			'surface3d':                   0,
			'wireframesurface3d':          0,
			'contour':                     0,
			'bubble':                      0,
			'bubble3d':                    0);
		view3D.RotX := chartView3DRotX[chartData_.Type];
		view3D.RotY := chartView3DRotY[chartData_.Type];
		view3D.Perspective := chartView3DPerspective[chartData_.Type];
		view3D.RAngAx := chartView3DRAngAx[chartData_.Type];
		return view3D;
	End;

	chartData_;
	type_;
End;
