C1WebChart 对图形化处理还可以。以下图如下:
A:折线图:
B:柱形图:
C:面积图:
D:饼图:
E:折线图(3D)
F:柱形图(3D)
G:面积图(3D)
H:饼图(3D)
完成这些功能。需要以下条件。
1:引用相关组件(C1.Common.dll、C1.Web.C1WebChart.dll、C1.Win.C1Chart.dll)
2:配置web.config
<system.web>
<httpHandlers>
<add verb="*" path="c1chartimage.aspx"
type="C1.Web.C1WebChart.ImageHttpHandler,C1.Web.C1WebChart"/>
</httpHandlers>
......
</system.web>
3:详细代码如下:
A: Html代码如下
<%@ Register TagPrefix="c1webchart" Namespace="C1.Web.C1WebChart" Assembly="C1.Web.C1WebChart" %>
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="Web3D.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<TABLE id="Table1" borderColor="black" cellSpacing="0" cellPadding="0" align="center" border="1">
<TR>
<TD style="HEIGHT: 10px; BACKGROUND-COLOR: #ffb866">
<asp:radiobuttonlist id="ddlSheet" runat="server" Height="32px" Width="616px" Font-Size="9pt" AutoPostBack="true"
RepeatDirection="Horizontal" RepeatLayout="Flow">
<asp:ListItem Value="XYPlot" Selected="True">折线图</asp:ListItem>
<asp:ListItem Value="Bar">柱形图</asp:ListItem>
<asp:ListItem Value="Area">面积图</asp:ListItem>
<asp:ListItem Value="Pie">饼图</asp:ListItem>
<asp:ListItem Value="XYPlot3d">折线图(3D)</asp:ListItem>
<asp:ListItem Value="Bar3d">柱形图(3D)</asp:ListItem>
<asp:ListItem Value="Area3d">面积图(3D)</asp:ListItem>
<asp:ListItem Value="Pie3d">饼图(3D)</asp:ListItem>
</asp:radiobuttonlist></TD>
</TR>
<TR>
<TD><FONT face="宋体">
<c1webchart:c1webchart id="C1WebChart1" runat="server" Height="400px" Width="720px" SlidingExpiration="00:00:30"
ImageFormat="Png" ImageQuality="100">
<ImageAreas>
<c1webchart:MapArea Tooltip="图标区" IsCustom="False" Name="ChartArea"></c1webchart:MapArea>
<c1webchart:MapArea Tooltip="X-轴" IsCustom="False" Name="AxisX"></c1webchart:MapArea>
<c1webchart:MapArea Tooltip="Y-轴" IsCustom="False" Name="AxisY"></c1webchart:MapArea>
<c1webchart:MapArea Tooltip="图标区" IsCustom="False" Name="PlotArea"></c1webchart:MapArea>
<c1webchart:MapArea Tooltip="({#XVAL},{#YVAL})" IsCustom="False" Name="ChartData"></c1webchart:MapArea>
<c1webchart:MapArea Tooltip="表头" IsCustom="False" Name="Header"></c1webchart:MapArea>
<c1webchart:MapArea Tooltip="表尾" IsCustom="False" Name="Footer"></c1webchart:MapArea>
<c1webchart:MapArea Tooltip="Series {#ISERIES}: "{#TEXT}"" IsCustom="False" Name="LegendItem"></c1webchart:MapArea>
</ImageAreas>
<Serializer Value="<?xml version="1.0"?>
<Chart2DPropBag Version="">
<StyleCollection>
<NamedStyle Name="PlotArea" ParentName="Area">
<StyleData>GradientStyle=DiagonalCenter;Border=None,Control,1;BackColor2=Blue;BackColor=RoyalBlue;Opaque=True;HatchStyle=None;</StyleData>
</NamedStyle>
<NamedStyle Name="Legend" ParentName="Legend.default">
<StyleData>Font=Microsoft Sans Serif, 9pt;AlignVert=Top;GradientStyle=None;Opaque=True;Rotation=Rotate0;ForeColor=ControlText;Border=Solid,Black,1;AlignImage=Tile;HatchStyle=None;AlignHorz=General;Wrap=True;BackColor2=;BackColor=Snow;</StyleData>
</NamedStyle>
<NamedStyle Name="Footer" ParentName="Control">
<StyleData>Font=Microsoft Sans Serif, 10pt, style=Bold;GradientStyle=None;ForeColor=ControlText;Border=None,Control,1;HatchStyle=None;Opaque=True;BackColor2=;BackColor=0, 0, 202;</StyleData>
</NamedStyle>
<NamedStyle Name="Area" ParentName="Area.default">
<StyleData>Font=Microsoft Sans Serif, 10pt, style=Bold;GradientStyle=DiagonalCenter;ForeColor=ControlText;Border=Fillet,HotTrack,6;HatchStyle=None;Opaque=True;BackColor2=Blue;BackColor=White;Rounding=7 7 7 7;</StyleData>
</NamedStyle>
<NamedStyle Name="Control" ParentName="Control.default">
<StyleData>Font=Microsoft Sans Serif, 10pt, style=Bold;GradientStyle=None;ForeColor=ControlText;Border=None,Control,1;HatchStyle=None;Opaque=True;BackColor2=;BackColor=AliceBlue;</StyleData>
</NamedStyle>
<NamedStyle Name="AxisX" ParentName="Area">
<StyleData>Font=Microsoft Sans Serif, 9pt;AlignVert=Bottom;Rotation=Rotate0;ForeColor=ControlText;Border=None,Control,1;AlignHorz=Center;Opaque=False;BackColor=Transparent;</StyleData>
</NamedStyle>
<NamedStyle Name="AxisY" ParentName="Area">
<StyleData>Font=Microsoft Sans Serif, 10pt;AlignVert=Center;Rotation=Rotate270;ForeColor=ControlText;Border=None,Control,1;AlignHorz=Near;Opaque=False;BackColor=Transparent;</StyleData>
</NamedStyle>
<NamedStyle Name="LabelStyleDefault" ParentName="LabelStyleDefault.default">
<StyleData>Font=Microsoft Sans Serif, 10pt, style=Bold;</StyleData>
</NamedStyle>
<NamedStyle Name="Legend.default" ParentName="Control">
<StyleData>Border=None,Black,1;Wrap=False;AlignVert=Top;</StyleData>
</NamedStyle>
<NamedStyle Name="LabelStyleDefault.default" ParentName="Control">
<StyleData>Border=None,Control,1;BackColor=Transparent;</StyleData>
</NamedStyle>
<NamedStyle Name="Header" ParentName="Control">
<StyleData>Font=Microsoft Sans Serif, 10pt, style=Bold;GradientStyle=None;AlignHorz=Center;ForeColor=ControlText;Border=None,Control,1;HatchStyle=None;Opaque=False;BackColor2=;BackColor=255, 250, 210;</StyleData>
</NamedStyle>
<NamedStyle Name="Control.default" ParentName="">
<StyleData>ForeColor=ControlText;Border=None,Control,1;BackColor=Control;</StyleData>
</NamedStyle>
<NamedStyle Name="AxisY2" ParentName="Area">
<StyleData>Rotation=Rotate90;Border=None,Transparent,1;AlignHorz=Far;BackColor=Transparent;AlignVert=Center;</StyleData>
</NamedStyle>
<NamedStyle Name="Area.default" ParentName="Control">
<StyleData>Border=None,Control,1;AlignVert=Top;</StyleData>
</NamedStyle>
</StyleCollection>
<ChartGroupsCollection>
<ChartGroup>
<DataSerializer Hole="1000000000">
<DataSeriesCollection>
<DataSeriesSerializer FitType="Spline">
<LineStyle Color="Coral" />
<SymbolStyle Size="3" Color="Coral" Shape="Dot" />
<SeriesLabel>库容与水位关系曲线</SeriesLabel>
<X>0;1;2;3;4</X>
<Y>1;8;27;64;125</Y>
<Y1>5;1;5;8;12</Y1>
<Y2>5;3;6;12;15</Y2>
<Y3>1;3.5;8;15;22</Y3>
<DataTypes>Single;Single;Single;Single;Single</DataTypes>
<DataFields>;;;;</DataFields>
<Tag />
</DataSeriesSerializer>
</DataSeriesCollection>
</DataSerializer>
<Name>Group1</Name>
<Stacked>False</Stacked>
<ChartType>XYPlot</ChartType>
<Pie>OtherOffset=0,Start=0</Pie>
<Bar>ClusterOverlap=0,ClusterWidth=50</Bar>
<HiLoData>FillFalling=True,FillTransparent=True,FullWidth=False,ShowClose=True,ShowOpen=True</HiLoData>
<Bubble>EncodingMethod=Diameter,MaximumSize=20,MinimumSize=5</Bubble>
<Polar>Degrees=True,PiRatioAnnotations=True,Start=0</Polar>
<Radar>Degrees=True,Filled=False,Start=0</Radar>
<Use3D>False</Use3D>
<Visible>True</Visible>
<ShowOutline>True</ShowOutline>
</ChartGroup>
<ChartGroup>
<DataSerializer Hole="1000000000" />
<Name>Group2</Name>
<Stacked>False</Stacked>
<ChartType>XYPlot</ChartType>
<Pie>OtherOffset=0,Start=0</Pie>
<Bar>ClusterOverlap=0,ClusterWidth=50</Bar>
<HiLoData>FillFalling=True,FillTransparent=True,FullWidth=False,ShowClose=True,ShowOpen=True</HiLoData>
<Bubble>EncodingMethod=Diameter,MaximumSize=20,MinimumSize=5</Bubble>
<Polar>Degrees=True,PiRatioAnnotations=True,Start=0</Polar>
<Radar>Degrees=True,Filled=False,Start=0</Radar>
<Visible>True</Visible>
<ShowOutline>True</ShowOutline>
</ChartGroup>
</ChartGroupsCollection>
<Header Compass="North">
<Text>Header Region </Text>
</Header>
<Footer Compass="South" Visible="False">
<Text>Footer text</Text>
</Footer>
<Legend Compass="South" Visible="True" Orientation="Horizontal">
<Text />
</Legend>
<ChartArea Depth="20" Rotation="45" Elevation="45" />
<Axes>
<Axis Max="4" Min="0" AnnoFormat="NumericManual" UnitMajor="1" UnitMinor="0.5" AutoMajor="True" AutoMinor="True" AutoMax="True" AutoMin="True" _onTop="-1" Compass="South">
<Text>库容 (万立方米)</Text>
<GridMajor Spacing="1" AutoSpace="True" Color="Black" Pattern="Dash" />
<GridMinor Visible="True" Spacing="0.5" AutoSpace="True" Color="LightGray" Pattern="Dash" />
</Axis>
<Axis Max="140" Min="0" UnitMajor="20" UnitMinor="10" AutoMajor="True" AutoMinor="True" AutoMax="True" AutoMin="True" _onTop="-1" Compass="West">
<Text>水位(米)</Text>
<GridMajor Visible="True" Spacing="20" AutoSpace="True" Color="Black" Pattern="Dash" />
<GridMinor AutoSpace="True" Color="LightGray" Pattern="Dash" />
</Axis>
<Axis Max="0" Min="0" UnitMajor="0" UnitMinor="0" AutoMajor="True" AutoMinor="True" AutoMax="True" AutoMin="True" _onTop="0" Compass="East">
<Text />
<GridMajor AutoSpace="True" Color="LightGray" Pattern="Dash" />
<GridMinor AutoSpace="True" Color="LightGray" Pattern="Dash" />
</Axis>
</Axes>
</Chart2DPropBag>"></Serializer>
</c1webchart:c1webchart></FONT><IMAGEAREAS>
<C1WEBCHART:MAPAREA Tooltip="图标区" IsCustom="False" Name="ChartArea"></C1WEBCHART:MAPAREA>
<C1WEBCHART:MAPAREA Tooltip="X-轴" IsCustom="False" Name="AxisX"></C1WEBCHART:MAPAREA>
<C1WEBCHART:MAPAREA Tooltip="Y-轴" IsCustom="False" Name="AxisY"></C1WEBCHART:MAPAREA>
<C1WEBCHART:MAPAREA Tooltip="图标区" IsCustom="False" Name="PlotArea"></C1WEBCHART:MAPAREA>
<C1WEBCHART:MAPAREA Tooltip="({#XVAL},{#YVAL})" IsCustom="False" Name="ChartData"></C1WEBCHART:MAPAREA>
<C1WEBCHART:MAPAREA Tooltip="表头" IsCustom="False" Name="Header"></C1WEBCHART:MAPAREA>
<C1WEBCHART:MAPAREA Tooltip="表尾" IsCustom="False" Name="Footer"></C1WEBCHART:MAPAREA>
<C1WEBCHART:MAPAREA Tooltip='Series {#ISERIES}: "{#TEXT}"' IsCustom="False" Name="LegendItem"></C1WEBCHART:MAPAREA>
</IMAGEAREAS><SERIALIZER Value='<?xml version="1.0"?> <Chart2DPropBag Version=""> <StyleCollection> <NamedStyle Name="PlotArea" ParentName="Area"> <StyleData>GradientStyle=None;Border=None,Control,1;BackColor2=SteelBlue;BackColor=255, 253, 232;Opaque=True;HatchStyle=None;</StyleData> </NamedStyle> <NamedStyle Name="Legend" ParentName="Legend.default"> <StyleData>Border=Solid,Black,1;AlignHorz=General;BackColor=Snow;Font=Microsoft Sans Serif, 9pt;AlignVert=Top;Wrap=True;</StyleData> </NamedStyle> <NamedStyle Name="Footer" ParentName="Control"> <StyleData>Border=None,Control,1;</StyleData> </NamedStyle> <NamedStyle Name="Area" ParentName="Area.default"> <StyleData>Font=Microsoft Sans Serif, 10pt, style=Bold;GradientStyle=None;ForeColor=ControlText;Border=None,Control,1;HatchStyle=None;Opaque=True;BackColor2=;BackColor=255, 250, 210;</StyleData> </NamedStyle> <NamedStyle Name="Control" ParentName="Control.default"> <StyleData>BackColor=255, 250, 210;Font=Microsoft Sans Serif, 10pt, style=Bold;</StyleData> </NamedStyle> <NamedStyle Name="AxisX" ParentName="Area"> <StyleData>Font=Microsoft Sans Serif, 9pt;AlignVert=Bottom;AlignHorz=Center;Rotation=Rotate0;Border=None,Control,1;Opaque=False;BackColor=Transparent;</StyleData> </NamedStyle> <NamedStyle Name="AxisY" ParentName="Area"> <StyleData>Font=Microsoft Sans Serif, 10pt;AlignVert=Center;AlignHorz=Near;Rotation=Rotate270;Border=None,Control,1;Opaque=False;BackColor=Transparent;</StyleData> </NamedStyle> <NamedStyle Name="LabelStyleDefault" ParentName="LabelStyleDefault.default"> <StyleData>Font=Microsoft Sans Serif, 10pt, style=Bold;</StyleData> </NamedStyle> <NamedStyle Name="Legend.default" ParentName="Control"> <StyleData>Border=None,Black,1;Wrap=False;AlignVert=Top;</StyleData> </NamedStyle> <NamedStyle Name="LabelStyleDefault.default" ParentName="Control"> <StyleData>Border=None,Control,1;BackColor=Transparent;</StyleData> </NamedStyle> <NamedStyle Name="Header" ParentName="Control"> <StyleData>Border=None,Control,1;AlignHorz=Center;</StyleData> </NamedStyle> <NamedStyle Name="Control.default" ParentName=""> <StyleData>ForeColor=ControlText;Border=None,Control,1;BackColor=Control;</StyleData> </NamedStyle> <NamedStyle Name="AxisY2" ParentName="Area"> <StyleData>Rotation=Rotate90;Border=None,Transparent,1;AlignHorz=Far;BackColor=Transparent;AlignVert=Center;</StyleData> </NamedStyle> <NamedStyle Name="Area.default" ParentName="Control"> <StyleData>Border=None,Control,1;AlignVert=Top;</StyleData> </NamedStyle> </StyleCollection> <ChartGroupsCollection> <ChartGroup> <DataSerializer Hole="1000000000"> <DataSeriesCollection> <DataSeriesSerializer FitType="Spline"> <LineStyle Color="CornflowerBlue" /> <SymbolStyle Size="10" Color="CornflowerBlue" Shape="Dot" /> <SeriesLabel>series 0</SeriesLabel> <X>0;1;2;3;4</X> <Y>1;8;5;64;125</Y> <Y1>5;6;18;48;100</Y1> <Y2>5;7;20;55;112</Y2> <Y3>1;6;25;60;122</Y3> <DataTypes>Single;Single;Single;Single;Single</DataTypes> <DataFields>;;;;</DataFields> <Tag /> </DataSeriesSerializer> </DataSeriesCollection> </DataSerializer> <Name>Group1</Name> <Stacked>False</Stacked> <ChartType>XYPlot</ChartType> <Pie>OtherOffset=0,Start=0</Pie> <Bar>ClusterOverlap=0,ClusterWidth=50</Bar> <HiLoData>FillFalling=True,FillTransparent=True,FullWidth=False,ShowClose=True,ShowOpen=True</HiLoData> <Bubble>EncodingMethod=Diameter,MaximumSize=20,MinimumSize=5</Bubble> <Polar>Degrees=True,PiRatioAnnotations=True,Start=0</Polar> <Radar>Degrees=True,Filled=False,Start=0</Radar> <Use3D>False</Use3D> <Visible>True</Visible> <ShowOutline>True</ShowOutline> </ChartGroup> <ChartGroup> <DataSerializer Hole="1000000000" /> <Name>Group2</Name> <Stacked>False</Stacked> <ChartType>XYPlot</ChartType> <Pie>OtherOffset=0,Start=0</Pie> <Bar>ClusterOverlap=0,ClusterWidth=50</Bar> <HiLoData>FillFalling=True,FillTransparent=True,FullWidth=False,ShowClose=True,ShowOpen=True</HiLoData> <Bubble>EncodingMethod=Diameter,MaximumSize=20,MinimumSize=5</Bubble> <Polar>Degrees=True,PiRatioAnnotations=True,Start=0</Polar> <Radar>Degrees=True,Filled=False,Start=0</Radar> <Visible>True</Visible> <ShowOutline>True</ShowOutline> </ChartGroup> </ChartGroupsCollection> <Header Compass="North"> <Text>Header Region </Text> </Header> <Footer Compass="South" Visible="False"> <Text>Footer text</Text> </Footer> <Legend Compass="South" Visible="True" Orientation="Horizontal"> <Text /> <Reversed>True</Reversed> </Legend> <ChartArea Depth="20" Rotation="45" Elevation="45" /> <Axes> <Axis Max="4" Min="0" AnnotationRotation="-45" UnitMajor="1" UnitMinor="0.5" AutoMajor="True" AutoMinor="True" AutoMax="True" AutoMin="True" _onTop="0" Compass="South"> <Text /> <GridMajor Spacing="1" AutoSpace="True" Color="Black" Pattern="Dash" /> <GridMinor Visible="True" Spacing="0.5" AutoSpace="True" Color="LightGray" Pattern="Dash" /> </Axis> <Axis Max="140" Min="0" UnitMajor="20" UnitMinor="10" AutoMajor="True" AutoMinor="True" AutoMax="True" AutoMin="True" _onTop="0" Compass="West"> <Text /> <GridMajor Visible="True" Spacing="20" AutoSpace="True" Color="Black" Pattern="Dash" /> <GridMinor AutoSpace="True" Color="LightGray" Pattern="Dash" /> </Axis> <Axis Max="0" Min="0" UnitMajor="0" UnitMinor="0" AutoMajor="True" AutoMinor="True" AutoMax="True" AutoMin="True" _onTop="0" Compass="East"> <Text /> <GridMajor AutoSpace="True" Color="LightGray" Pattern="Dash" /> <GridMinor AutoSpace="True" Color="LightGray" Pattern="Dash" /> </Axis> </Axes> </Chart2DPropBag>'></SERIALIZER></TD>
</TR>
</TABLE>
</form>
</body>
</HTML>
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="Web3D.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<TABLE id="Table1" borderColor="black" cellSpacing="0" cellPadding="0" align="center" border="1">
<TR>
<TD style="HEIGHT: 10px; BACKGROUND-COLOR: #ffb866">
<asp:radiobuttonlist id="ddlSheet" runat="server" Height="32px" Width="616px" Font-Size="9pt" AutoPostBack="true"
RepeatDirection="Horizontal" RepeatLayout="Flow">
<asp:ListItem Value="XYPlot" Selected="True">折线图</asp:ListItem>
<asp:ListItem Value="Bar">柱形图</asp:ListItem>
<asp:ListItem Value="Area">面积图</asp:ListItem>
<asp:ListItem Value="Pie">饼图</asp:ListItem>
<asp:ListItem Value="XYPlot3d">折线图(3D)</asp:ListItem>
<asp:ListItem Value="Bar3d">柱形图(3D)</asp:ListItem>
<asp:ListItem Value="Area3d">面积图(3D)</asp:ListItem>
<asp:ListItem Value="Pie3d">饼图(3D)</asp:ListItem>
</asp:radiobuttonlist></TD>
</TR>
<TR>
<TD><FONT face="宋体">
<c1webchart:c1webchart id="C1WebChart1" runat="server" Height="400px" Width="720px" SlidingExpiration="00:00:30"
ImageFormat="Png" ImageQuality="100">
<ImageAreas>
<c1webchart:MapArea Tooltip="图标区" IsCustom="False" Name="ChartArea"></c1webchart:MapArea>
<c1webchart:MapArea Tooltip="X-轴" IsCustom="False" Name="AxisX"></c1webchart:MapArea>
<c1webchart:MapArea Tooltip="Y-轴" IsCustom="False" Name="AxisY"></c1webchart:MapArea>
<c1webchart:MapArea Tooltip="图标区" IsCustom="False" Name="PlotArea"></c1webchart:MapArea>
<c1webchart:MapArea Tooltip="({#XVAL},{#YVAL})" IsCustom="False" Name="ChartData"></c1webchart:MapArea>
<c1webchart:MapArea Tooltip="表头" IsCustom="False" Name="Header"></c1webchart:MapArea>
<c1webchart:MapArea Tooltip="表尾" IsCustom="False" Name="Footer"></c1webchart:MapArea>
<c1webchart:MapArea Tooltip="Series {#ISERIES}: "{#TEXT}"" IsCustom="False" Name="LegendItem"></c1webchart:MapArea>
</ImageAreas>
<Serializer Value="<?xml version="1.0"?>
<Chart2DPropBag Version="">
<StyleCollection>
<NamedStyle Name="PlotArea" ParentName="Area">
<StyleData>GradientStyle=DiagonalCenter;Border=None,Control,1;BackColor2=Blue;BackColor=RoyalBlue;Opaque=True;HatchStyle=None;</StyleData>
</NamedStyle>
<NamedStyle Name="Legend" ParentName="Legend.default">
<StyleData>Font=Microsoft Sans Serif, 9pt;AlignVert=Top;GradientStyle=None;Opaque=True;Rotation=Rotate0;ForeColor=ControlText;Border=Solid,Black,1;AlignImage=Tile;HatchStyle=None;AlignHorz=General;Wrap=True;BackColor2=;BackColor=Snow;</StyleData>
</NamedStyle>
<NamedStyle Name="Footer" ParentName="Control">
<StyleData>Font=Microsoft Sans Serif, 10pt, style=Bold;GradientStyle=None;ForeColor=ControlText;Border=None,Control,1;HatchStyle=None;Opaque=True;BackColor2=;BackColor=0, 0, 202;</StyleData>
</NamedStyle>
<NamedStyle Name="Area" ParentName="Area.default">
<StyleData>Font=Microsoft Sans Serif, 10pt, style=Bold;GradientStyle=DiagonalCenter;ForeColor=ControlText;Border=Fillet,HotTrack,6;HatchStyle=None;Opaque=True;BackColor2=Blue;BackColor=White;Rounding=7 7 7 7;</StyleData>
</NamedStyle>
<NamedStyle Name="Control" ParentName="Control.default">
<StyleData>Font=Microsoft Sans Serif, 10pt, style=Bold;GradientStyle=None;ForeColor=ControlText;Border=None,Control,1;HatchStyle=None;Opaque=True;BackColor2=;BackColor=AliceBlue;</StyleData>
</NamedStyle>
<NamedStyle Name="AxisX" ParentName="Area">
<StyleData>Font=Microsoft Sans Serif, 9pt;AlignVert=Bottom;Rotation=Rotate0;ForeColor=ControlText;Border=None,Control,1;AlignHorz=Center;Opaque=False;BackColor=Transparent;</StyleData>
</NamedStyle>
<NamedStyle Name="AxisY" ParentName="Area">
<StyleData>Font=Microsoft Sans Serif, 10pt;AlignVert=Center;Rotation=Rotate270;ForeColor=ControlText;Border=None,Control,1;AlignHorz=Near;Opaque=False;BackColor=Transparent;</StyleData>
</NamedStyle>
<NamedStyle Name="LabelStyleDefault" ParentName="LabelStyleDefault.default">
<StyleData>Font=Microsoft Sans Serif, 10pt, style=Bold;</StyleData>
</NamedStyle>
<NamedStyle Name="Legend.default" ParentName="Control">
<StyleData>Border=None,Black,1;Wrap=False;AlignVert=Top;</StyleData>
</NamedStyle>
<NamedStyle Name="LabelStyleDefault.default" ParentName="Control">
<StyleData>Border=None,Control,1;BackColor=Transparent;</StyleData>
</NamedStyle>
<NamedStyle Name="Header" ParentName="Control">
<StyleData>Font=Microsoft Sans Serif, 10pt, style=Bold;GradientStyle=None;AlignHorz=Center;ForeColor=ControlText;Border=None,Control,1;HatchStyle=None;Opaque=False;BackColor2=;BackColor=255, 250, 210;</StyleData>
</NamedStyle>
<NamedStyle Name="Control.default" ParentName="">
<StyleData>ForeColor=ControlText;Border=None,Control,1;BackColor=Control;</StyleData>
</NamedStyle>
<NamedStyle Name="AxisY2" ParentName="Area">
<StyleData>Rotation=Rotate90;Border=None,Transparent,1;AlignHorz=Far;BackColor=Transparent;AlignVert=Center;</StyleData>
</NamedStyle>
<NamedStyle Name="Area.default" ParentName="Control">
<StyleData>Border=None,Control,1;AlignVert=Top;</StyleData>
</NamedStyle>
</StyleCollection>
<ChartGroupsCollection>
<ChartGroup>
<DataSerializer Hole="1000000000">
<DataSeriesCollection>
<DataSeriesSerializer FitType="Spline">
<LineStyle Color="Coral" />
<SymbolStyle Size="3" Color="Coral" Shape="Dot" />
<SeriesLabel>库容与水位关系曲线</SeriesLabel>
<X>0;1;2;3;4</X>
<Y>1;8;27;64;125</Y>
<Y1>5;1;5;8;12</Y1>
<Y2>5;3;6;12;15</Y2>
<Y3>1;3.5;8;15;22</Y3>
<DataTypes>Single;Single;Single;Single;Single</DataTypes>
<DataFields>;;;;</DataFields>
<Tag />
</DataSeriesSerializer>
</DataSeriesCollection>
</DataSerializer>
<Name>Group1</Name>
<Stacked>False</Stacked>
<ChartType>XYPlot</ChartType>
<Pie>OtherOffset=0,Start=0</Pie>
<Bar>ClusterOverlap=0,ClusterWidth=50</Bar>
<HiLoData>FillFalling=True,FillTransparent=True,FullWidth=False,ShowClose=True,ShowOpen=True</HiLoData>
<Bubble>EncodingMethod=Diameter,MaximumSize=20,MinimumSize=5</Bubble>
<Polar>Degrees=True,PiRatioAnnotations=True,Start=0</Polar>
<Radar>Degrees=True,Filled=False,Start=0</Radar>
<Use3D>False</Use3D>
<Visible>True</Visible>
<ShowOutline>True</ShowOutline>
</ChartGroup>
<ChartGroup>
<DataSerializer Hole="1000000000" />
<Name>Group2</Name>
<Stacked>False</Stacked>
<ChartType>XYPlot</ChartType>
<Pie>OtherOffset=0,Start=0</Pie>
<Bar>ClusterOverlap=0,ClusterWidth=50</Bar>
<HiLoData>FillFalling=True,FillTransparent=True,FullWidth=False,ShowClose=True,ShowOpen=True</HiLoData>
<Bubble>EncodingMethod=Diameter,MaximumSize=20,MinimumSize=5</Bubble>
<Polar>Degrees=True,PiRatioAnnotations=True,Start=0</Polar>
<Radar>Degrees=True,Filled=False,Start=0</Radar>
<Visible>True</Visible>
<ShowOutline>True</ShowOutline>
</ChartGroup>
</ChartGroupsCollection>
<Header Compass="North">
<Text>Header Region </Text>
</Header>
<Footer Compass="South" Visible="False">
<Text>Footer text</Text>
</Footer>
<Legend Compass="South" Visible="True" Orientation="Horizontal">
<Text />
</Legend>
<ChartArea Depth="20" Rotation="45" Elevation="45" />
<Axes>
<Axis Max="4" Min="0" AnnoFormat="NumericManual" UnitMajor="1" UnitMinor="0.5" AutoMajor="True" AutoMinor="True" AutoMax="True" AutoMin="True" _onTop="-1" Compass="South">
<Text>库容 (万立方米)</Text>
<GridMajor Spacing="1" AutoSpace="True" Color="Black" Pattern="Dash" />
<GridMinor Visible="True" Spacing="0.5" AutoSpace="True" Color="LightGray" Pattern="Dash" />
</Axis>
<Axis Max="140" Min="0" UnitMajor="20" UnitMinor="10" AutoMajor="True" AutoMinor="True" AutoMax="True" AutoMin="True" _onTop="-1" Compass="West">
<Text>水位(米)</Text>
<GridMajor Visible="True" Spacing="20" AutoSpace="True" Color="Black" Pattern="Dash" />
<GridMinor AutoSpace="True" Color="LightGray" Pattern="Dash" />
</Axis>
<Axis Max="0" Min="0" UnitMajor="0" UnitMinor="0" AutoMajor="True" AutoMinor="True" AutoMax="True" AutoMin="True" _onTop="0" Compass="East">
<Text />
<GridMajor AutoSpace="True" Color="LightGray" Pattern="Dash" />
<GridMinor AutoSpace="True" Color="LightGray" Pattern="Dash" />
</Axis>
</Axes>
</Chart2DPropBag>"></Serializer>
</c1webchart:c1webchart></FONT><IMAGEAREAS>
<C1WEBCHART:MAPAREA Tooltip="图标区" IsCustom="False" Name="ChartArea"></C1WEBCHART:MAPAREA>
<C1WEBCHART:MAPAREA Tooltip="X-轴" IsCustom="False" Name="AxisX"></C1WEBCHART:MAPAREA>
<C1WEBCHART:MAPAREA Tooltip="Y-轴" IsCustom="False" Name="AxisY"></C1WEBCHART:MAPAREA>
<C1WEBCHART:MAPAREA Tooltip="图标区" IsCustom="False" Name="PlotArea"></C1WEBCHART:MAPAREA>
<C1WEBCHART:MAPAREA Tooltip="({#XVAL},{#YVAL})" IsCustom="False" Name="ChartData"></C1WEBCHART:MAPAREA>
<C1WEBCHART:MAPAREA Tooltip="表头" IsCustom="False" Name="Header"></C1WEBCHART:MAPAREA>
<C1WEBCHART:MAPAREA Tooltip="表尾" IsCustom="False" Name="Footer"></C1WEBCHART:MAPAREA>
<C1WEBCHART:MAPAREA Tooltip='Series {#ISERIES}: "{#TEXT}"' IsCustom="False" Name="LegendItem"></C1WEBCHART:MAPAREA>
</IMAGEAREAS><SERIALIZER Value='<?xml version="1.0"?> <Chart2DPropBag Version=""> <StyleCollection> <NamedStyle Name="PlotArea" ParentName="Area"> <StyleData>GradientStyle=None;Border=None,Control,1;BackColor2=SteelBlue;BackColor=255, 253, 232;Opaque=True;HatchStyle=None;</StyleData> </NamedStyle> <NamedStyle Name="Legend" ParentName="Legend.default"> <StyleData>Border=Solid,Black,1;AlignHorz=General;BackColor=Snow;Font=Microsoft Sans Serif, 9pt;AlignVert=Top;Wrap=True;</StyleData> </NamedStyle> <NamedStyle Name="Footer" ParentName="Control"> <StyleData>Border=None,Control,1;</StyleData> </NamedStyle> <NamedStyle Name="Area" ParentName="Area.default"> <StyleData>Font=Microsoft Sans Serif, 10pt, style=Bold;GradientStyle=None;ForeColor=ControlText;Border=None,Control,1;HatchStyle=None;Opaque=True;BackColor2=;BackColor=255, 250, 210;</StyleData> </NamedStyle> <NamedStyle Name="Control" ParentName="Control.default"> <StyleData>BackColor=255, 250, 210;Font=Microsoft Sans Serif, 10pt, style=Bold;</StyleData> </NamedStyle> <NamedStyle Name="AxisX" ParentName="Area"> <StyleData>Font=Microsoft Sans Serif, 9pt;AlignVert=Bottom;AlignHorz=Center;Rotation=Rotate0;Border=None,Control,1;Opaque=False;BackColor=Transparent;</StyleData> </NamedStyle> <NamedStyle Name="AxisY" ParentName="Area"> <StyleData>Font=Microsoft Sans Serif, 10pt;AlignVert=Center;AlignHorz=Near;Rotation=Rotate270;Border=None,Control,1;Opaque=False;BackColor=Transparent;</StyleData> </NamedStyle> <NamedStyle Name="LabelStyleDefault" ParentName="LabelStyleDefault.default"> <StyleData>Font=Microsoft Sans Serif, 10pt, style=Bold;</StyleData> </NamedStyle> <NamedStyle Name="Legend.default" ParentName="Control"> <StyleData>Border=None,Black,1;Wrap=False;AlignVert=Top;</StyleData> </NamedStyle> <NamedStyle Name="LabelStyleDefault.default" ParentName="Control"> <StyleData>Border=None,Control,1;BackColor=Transparent;</StyleData> </NamedStyle> <NamedStyle Name="Header" ParentName="Control"> <StyleData>Border=None,Control,1;AlignHorz=Center;</StyleData> </NamedStyle> <NamedStyle Name="Control.default" ParentName=""> <StyleData>ForeColor=ControlText;Border=None,Control,1;BackColor=Control;</StyleData> </NamedStyle> <NamedStyle Name="AxisY2" ParentName="Area"> <StyleData>Rotation=Rotate90;Border=None,Transparent,1;AlignHorz=Far;BackColor=Transparent;AlignVert=Center;</StyleData> </NamedStyle> <NamedStyle Name="Area.default" ParentName="Control"> <StyleData>Border=None,Control,1;AlignVert=Top;</StyleData> </NamedStyle> </StyleCollection> <ChartGroupsCollection> <ChartGroup> <DataSerializer Hole="1000000000"> <DataSeriesCollection> <DataSeriesSerializer FitType="Spline"> <LineStyle Color="CornflowerBlue" /> <SymbolStyle Size="10" Color="CornflowerBlue" Shape="Dot" /> <SeriesLabel>series 0</SeriesLabel> <X>0;1;2;3;4</X> <Y>1;8;5;64;125</Y> <Y1>5;6;18;48;100</Y1> <Y2>5;7;20;55;112</Y2> <Y3>1;6;25;60;122</Y3> <DataTypes>Single;Single;Single;Single;Single</DataTypes> <DataFields>;;;;</DataFields> <Tag /> </DataSeriesSerializer> </DataSeriesCollection> </DataSerializer> <Name>Group1</Name> <Stacked>False</Stacked> <ChartType>XYPlot</ChartType> <Pie>OtherOffset=0,Start=0</Pie> <Bar>ClusterOverlap=0,ClusterWidth=50</Bar> <HiLoData>FillFalling=True,FillTransparent=True,FullWidth=False,ShowClose=True,ShowOpen=True</HiLoData> <Bubble>EncodingMethod=Diameter,MaximumSize=20,MinimumSize=5</Bubble> <Polar>Degrees=True,PiRatioAnnotations=True,Start=0</Polar> <Radar>Degrees=True,Filled=False,Start=0</Radar> <Use3D>False</Use3D> <Visible>True</Visible> <ShowOutline>True</ShowOutline> </ChartGroup> <ChartGroup> <DataSerializer Hole="1000000000" /> <Name>Group2</Name> <Stacked>False</Stacked> <ChartType>XYPlot</ChartType> <Pie>OtherOffset=0,Start=0</Pie> <Bar>ClusterOverlap=0,ClusterWidth=50</Bar> <HiLoData>FillFalling=True,FillTransparent=True,FullWidth=False,ShowClose=True,ShowOpen=True</HiLoData> <Bubble>EncodingMethod=Diameter,MaximumSize=20,MinimumSize=5</Bubble> <Polar>Degrees=True,PiRatioAnnotations=True,Start=0</Polar> <Radar>Degrees=True,Filled=False,Start=0</Radar> <Visible>True</Visible> <ShowOutline>True</ShowOutline> </ChartGroup> </ChartGroupsCollection> <Header Compass="North"> <Text>Header Region </Text> </Header> <Footer Compass="South" Visible="False"> <Text>Footer text</Text> </Footer> <Legend Compass="South" Visible="True" Orientation="Horizontal"> <Text /> <Reversed>True</Reversed> </Legend> <ChartArea Depth="20" Rotation="45" Elevation="45" /> <Axes> <Axis Max="4" Min="0" AnnotationRotation="-45" UnitMajor="1" UnitMinor="0.5" AutoMajor="True" AutoMinor="True" AutoMax="True" AutoMin="True" _onTop="0" Compass="South"> <Text /> <GridMajor Spacing="1" AutoSpace="True" Color="Black" Pattern="Dash" /> <GridMinor Visible="True" Spacing="0.5" AutoSpace="True" Color="LightGray" Pattern="Dash" /> </Axis> <Axis Max="140" Min="0" UnitMajor="20" UnitMinor="10" AutoMajor="True" AutoMinor="True" AutoMax="True" AutoMin="True" _onTop="0" Compass="West"> <Text /> <GridMajor Visible="True" Spacing="20" AutoSpace="True" Color="Black" Pattern="Dash" /> <GridMinor AutoSpace="True" Color="LightGray" Pattern="Dash" /> </Axis> <Axis Max="0" Min="0" UnitMajor="0" UnitMinor="0" AutoMajor="True" AutoMinor="True" AutoMax="True" AutoMin="True" _onTop="0" Compass="East"> <Text /> <GridMajor AutoSpace="True" Color="LightGray" Pattern="Dash" /> <GridMinor AutoSpace="True" Color="LightGray" Pattern="Dash" /> </Axis> </Axes> </Chart2DPropBag>'></SERIALIZER></TD>
</TR>
</TABLE>
</form>
</body>
</HTML>
B :.CS代码如下:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using C1.Web.C1WebChart;
using C1.Win.C1Chart;
namespace Web3D
{
/// <summary>
/// WebForm1 的摘要说明。
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.RadioButtonList ddlSheet;
protected C1.Web.C1WebChart.C1WebChart C1WebChart1;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
RenderChart("33728");
}
private void RenderChart(string stcdt)
{
string Caption ="(斋堂水库)"+"统计图";
C1WebChart1.Header.Text = Caption;
DataSet ds = Get_Data( stcdt );
DataView dv = new DataView(ds.Tables[0]);
if (dv.Count>100)
{
PointF[] data = new PointF[dv.Count];
for (int i = 0; i < data.Length; i++)
{
float y = float.Parse(dv[i]["ZI"].ToString());
float x=float.Parse(dv[i]["V"].ToString());
data[i] = new PointF(x, y);
}
ChartDataSeries series = C1WebChart1.ChartGroups[0].ChartData.SeriesList[0];
series.SymbolStyle.Size=0;
series.PointData.CopyDataIn(data);
}
else
{
PointF[] data = new PointF[dv.Count];
for (int i = 0; i < data.Length; i++)
{
float y = float.Parse(dv[i]["ZI"].ToString());
float x=float.Parse(dv[i]["V"].ToString());
data[i] = new PointF(x, y);
}
ChartDataSeries series = C1WebChart1.ChartGroups[0].ChartData.SeriesList[0];
series.PointData.CopyDataIn(data);
}
}
public DataSet Get_Data(string stcdt)
{
String DBConnStr;
DataSet MyDataSet=new DataSet();
System.Data.SqlClient.SqlDataAdapter DataAdapter=new System.Data.SqlClient.SqlDataAdapter();
DBConnStr=System.Configuration.ConfigurationSettings.AppSettings["DBConnectString"];
System.Data.SqlClient.SqlConnection myConnection = new System.Data.SqlClient.SqlConnection(DBConnStr);
if (myConnection.State!=ConnectionState.Open)
{
myConnection.Open();
}
System.Data.SqlClient.SqlCommand myCommand = new System.Data.SqlClient.SqlCommand("Select ZI,V,B.AREA FROM STNM A,Data B WHERE A.STCDT=B.STCDT and A.STCDT=@STCDT ORDER BY ZI",myConnection);
myCommand.Parameters.Add("@STCDT",SqlDbType.VarChar );
myCommand.Parameters["@STCDT"].Value =stcdt ; //参数化赋值
myCommand.ExecuteNonQuery();
DataAdapter.SelectCommand = myCommand;
if (MyDataSet!=null)
{
DataAdapter.Fill(MyDataSet,"table");
}
if (myConnection.State == ConnectionState.Open)
{
myConnection.Close();
}
return MyDataSet;
}
Web 窗体设计器生成的代码
private void ddlSheet_SelectedIndexChanged(object sender, System.EventArgs e)
{
ChartGroup grp= this.C1WebChart1.ChartGroups[0];
Chart2DTypeEnum ctype = (Chart2DTypeEnum)
Enum.Parse(typeof(Chart2DTypeEnum),ddlSheet.SelectedItem.Value.Replace("3d",""),true);
string Caption_Name=null;
if (this.ddlSheet.SelectedValue.IndexOf("3d")<0)
{
grp.ChartType = ctype;
grp.Use3D = false;
Caption_Name="(平面)";
}
else
{
grp.ChartType = ctype;
grp.Use3D = true;
Caption_Name="(3D)";
}
string tt = string.Empty;
ChartDataSeries series = C1WebChart1.ChartGroups[0].ChartData.SeriesList[0];
switch(ctype)
{
case Chart2DTypeEnum.XYPlot:
series.Label="库容与水位关系曲线图"+Caption_Name;
break;
case Chart2DTypeEnum.Bar:
series.Label="库容与水位柱状图"+Caption_Name;
break;
case Chart2DTypeEnum.Area:
series.Label="库容与水位面积图+"+Caption_Name;
tt = "{#TEXT}";
break;
case Chart2DTypeEnum.Pie:
series.Label="库容与水位饼图"+Caption_Name;
tt = "{#TEXT}";
break;
case Chart2DTypeEnum.Bubble:
//tt = "({#XVAL},{#YVAL},{#Y1VAL})";
series.Label="库容与水位泡状图"+Caption_Name;
break;
case Chart2DTypeEnum.Candle:
series.Label="库容与水位烛型图"+Caption_Name;
//tt = "X={#XVAL}, Hi={#YVAL}, Lo={#Y1VAL}";
//lineThickness = 3;
break;
case Chart2DTypeEnum.HiLo:
series.Label="库容与水位HiLo图"+Caption_Name;
//tt = "X={#XVAL}, Hi={#YVAL}, Lo={#Y1VAL}";
break;
case Chart2DTypeEnum.HiLoOpenClose:
series.Label="库容与水位HiLoOpenClose图"+Caption_Name;
tt = "X={#XVAL} Hi={#YVAL}, Lo={#Y1VAL} Open={#Y2VAL}, Close={#Y3VAL}";
//lineThickness = 3;
break;
case Chart2DTypeEnum.Polar:
series.Label="库容与水位Polar图"+Caption_Name;
break;
case Chart2DTypeEnum.Radar:
series.Label="库容与水位Radar图"+Caption_Name;
break;
default:
tt = "({#XVAL},{#YVAL})";
break;
}
C1WebChart1.ImageAreas.GetByName("ChartData").Tooltip = tt;
}
}
}
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using C1.Web.C1WebChart;
using C1.Win.C1Chart;
namespace Web3D
{
/// <summary>
/// WebForm1 的摘要说明。
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.RadioButtonList ddlSheet;
protected C1.Web.C1WebChart.C1WebChart C1WebChart1;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
RenderChart("33728");
}
private void RenderChart(string stcdt)
{
string Caption ="(斋堂水库)"+"统计图";
C1WebChart1.Header.Text = Caption;
DataSet ds = Get_Data( stcdt );
DataView dv = new DataView(ds.Tables[0]);
if (dv.Count>100)
{
PointF[] data = new PointF[dv.Count];
for (int i = 0; i < data.Length; i++)
{
float y = float.Parse(dv[i]["ZI"].ToString());
float x=float.Parse(dv[i]["V"].ToString());
data[i] = new PointF(x, y);
}
ChartDataSeries series = C1WebChart1.ChartGroups[0].ChartData.SeriesList[0];
series.SymbolStyle.Size=0;
series.PointData.CopyDataIn(data);
}
else
{
PointF[] data = new PointF[dv.Count];
for (int i = 0; i < data.Length; i++)
{
float y = float.Parse(dv[i]["ZI"].ToString());
float x=float.Parse(dv[i]["V"].ToString());
data[i] = new PointF(x, y);
}
ChartDataSeries series = C1WebChart1.ChartGroups[0].ChartData.SeriesList[0];
series.PointData.CopyDataIn(data);
}
}
public DataSet Get_Data(string stcdt)
{
String DBConnStr;
DataSet MyDataSet=new DataSet();
System.Data.SqlClient.SqlDataAdapter DataAdapter=new System.Data.SqlClient.SqlDataAdapter();
DBConnStr=System.Configuration.ConfigurationSettings.AppSettings["DBConnectString"];
System.Data.SqlClient.SqlConnection myConnection = new System.Data.SqlClient.SqlConnection(DBConnStr);
if (myConnection.State!=ConnectionState.Open)
{
myConnection.Open();
}
System.Data.SqlClient.SqlCommand myCommand = new System.Data.SqlClient.SqlCommand("Select ZI,V,B.AREA FROM STNM A,Data B WHERE A.STCDT=B.STCDT and A.STCDT=@STCDT ORDER BY ZI",myConnection);
myCommand.Parameters.Add("@STCDT",SqlDbType.VarChar );
myCommand.Parameters["@STCDT"].Value =stcdt ; //参数化赋值
myCommand.ExecuteNonQuery();
DataAdapter.SelectCommand = myCommand;
if (MyDataSet!=null)
{
DataAdapter.Fill(MyDataSet,"table");
}
if (myConnection.State == ConnectionState.Open)
{
myConnection.Close();
}
return MyDataSet;
}
Web 窗体设计器生成的代码
private void ddlSheet_SelectedIndexChanged(object sender, System.EventArgs e)
{
ChartGroup grp= this.C1WebChart1.ChartGroups[0];
Chart2DTypeEnum ctype = (Chart2DTypeEnum)
Enum.Parse(typeof(Chart2DTypeEnum),ddlSheet.SelectedItem.Value.Replace("3d",""),true);
string Caption_Name=null;
if (this.ddlSheet.SelectedValue.IndexOf("3d")<0)
{
grp.ChartType = ctype;
grp.Use3D = false;
Caption_Name="(平面)";
}
else
{
grp.ChartType = ctype;
grp.Use3D = true;
Caption_Name="(3D)";
}
string tt = string.Empty;
ChartDataSeries series = C1WebChart1.ChartGroups[0].ChartData.SeriesList[0];
switch(ctype)
{
case Chart2DTypeEnum.XYPlot:
series.Label="库容与水位关系曲线图"+Caption_Name;
break;
case Chart2DTypeEnum.Bar:
series.Label="库容与水位柱状图"+Caption_Name;
break;
case Chart2DTypeEnum.Area:
series.Label="库容与水位面积图+"+Caption_Name;
tt = "{#TEXT}";
break;
case Chart2DTypeEnum.Pie:
series.Label="库容与水位饼图"+Caption_Name;
tt = "{#TEXT}";
break;
case Chart2DTypeEnum.Bubble:
//tt = "({#XVAL},{#YVAL},{#Y1VAL})";
series.Label="库容与水位泡状图"+Caption_Name;
break;
case Chart2DTypeEnum.Candle:
series.Label="库容与水位烛型图"+Caption_Name;
//tt = "X={#XVAL}, Hi={#YVAL}, Lo={#Y1VAL}";
//lineThickness = 3;
break;
case Chart2DTypeEnum.HiLo:
series.Label="库容与水位HiLo图"+Caption_Name;
//tt = "X={#XVAL}, Hi={#YVAL}, Lo={#Y1VAL}";
break;
case Chart2DTypeEnum.HiLoOpenClose:
series.Label="库容与水位HiLoOpenClose图"+Caption_Name;
tt = "X={#XVAL} Hi={#YVAL}, Lo={#Y1VAL} Open={#Y2VAL}, Close={#Y3VAL}";
//lineThickness = 3;
break;
case Chart2DTypeEnum.Polar:
series.Label="库容与水位Polar图"+Caption_Name;
break;
case Chart2DTypeEnum.Radar:
series.Label="库容与水位Radar图"+Caption_Name;
break;
default:
tt = "({#XVAL},{#YVAL})";
break;
}
C1WebChart1.ImageAreas.GetByName("ChartData").Tooltip = tt;
}
}
}
C:Web.config代码如下:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<httpHandlers>
<add verb="*" path="c1chartimage.aspx" type="C1.Web.C1WebChart.ImageHttpHandler,C1.Web.C1WebChart"/>
</httpHandlers>
<!-- 动态调试编译
设置 compilation debug="true" 以启用 ASPX 调试。否则,将此值设置为
false 将提高此应用程序的运行时性能。
设置 compilation debug="true" 以将调试符号(.pdb 信息)
插入到编译页中。因为这将创建执行起来
较慢的大文件,所以应该只在调试时将此值设置为 true,而在所有其他时候都设置为
false。有关更多信息,请参考有关
调试 ASP.NET 文件的文档。
-->
<compilation
defaultLanguage="c#"
debug="true"
/>
<!-- 自定义错误信息
设置 customErrors mode="On" 或 "RemoteOnly" 以启用自定义错误信息,或设置为 "Off" 以禁用自定义错误信息。
为每个要处理的错误添加 <error> 标记。
"On" 始终显示自定义(友好的)信息。
"Off" 始终显示详细的 ASP.NET 错误信息。
"RemoteOnly" 只对不在本地 Web 服务器上运行的
用户显示自定义(友好的)信息。出于安全目的,建议使用此设置,以便
不向远程客户端显示应用程序的详细信息。
-->
<customErrors
mode="RemoteOnly"
/>
<!-- 身份验证
此节设置应用程序的身份验证策略。可能的模式是 "Windows"、
"Forms"、 "Passport" 和 "None"
"None" 不执行身份验证。
"Windows" IIS 根据应用程序的设置执行身份验证
(基本、简要或集成 Windows)。在 IIS 中必须禁用匿名访问。
"Forms" 您为用户提供一个输入凭据的自定义窗体(Web 页),然后
在您的应用程序中验证他们的身份。用户凭据标记存储在 Cookie 中。
"Passport" 身份验证是通过 Microsoft 的集中身份验证服务执行的,
它为成员站点提供单独登录和核心配置文件服务。
-->
<authentication mode="Windows" />
<!-- 授权
此节设置应用程序的授权策略。可以允许或拒绝不同的用户或角色访问
应用程序资源。通配符: "*" 表示任何人,"?" 表示匿名
(未经身份验证的)用户。
-->
<authorization>
<allow users="*" /> <!-- 允许所有用户 -->
<!-- <allow users="[逗号分隔的用户列表]"
roles="[逗号分隔的角色列表]"/>
<deny users="[逗号分隔的用户列表]"
roles="[逗号分隔的角色列表]"/>
-->
</authorization>
<!-- 应用程序级别跟踪记录
应用程序级别跟踪为应用程序中的每一页启用跟踪日志输出。
设置 trace enabled="true" 可以启用应用程序跟踪记录。如果 pageOutput="true",则
在每一页的底部显示跟踪信息。否则,可以通过浏览 Web 应用程序
根目录中的 "trace.axd" 页来查看
应用程序跟踪日志。
-->
<trace
enabled="false"
requestLimit="10"
pageOutput="false"
traceMode="SortByTime"
localOnly="true"
/>
<!-- 会话状态设置
默认情况下,ASP.NET 使用 Cookie 来标识哪些请求属于特定的会话。
如果 Cookie 不可用,则可以通过将会话标识符添加到 URL 来跟踪会话。
若要禁用 Cookie,请设置 sessionState cookieless="true"。
-->
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="20"
/>
<!-- 全球化
此节设置应用程序的全球化设置。
-->
<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
/>
</system.web>
<appSettings>
<add key="DBConnectString" value="server=(local);User ID=sa;Password=sa;database=CSDN" />
</appSettings>
</configuration>
<configuration>
<system.web>
<httpHandlers>
<add verb="*" path="c1chartimage.aspx" type="C1.Web.C1WebChart.ImageHttpHandler,C1.Web.C1WebChart"/>
</httpHandlers>
<!-- 动态调试编译
设置 compilation debug="true" 以启用 ASPX 调试。否则,将此值设置为
false 将提高此应用程序的运行时性能。
设置 compilation debug="true" 以将调试符号(.pdb 信息)
插入到编译页中。因为这将创建执行起来
较慢的大文件,所以应该只在调试时将此值设置为 true,而在所有其他时候都设置为
false。有关更多信息,请参考有关
调试 ASP.NET 文件的文档。
-->
<compilation
defaultLanguage="c#"
debug="true"
/>
<!-- 自定义错误信息
设置 customErrors mode="On" 或 "RemoteOnly" 以启用自定义错误信息,或设置为 "Off" 以禁用自定义错误信息。
为每个要处理的错误添加 <error> 标记。
"On" 始终显示自定义(友好的)信息。
"Off" 始终显示详细的 ASP.NET 错误信息。
"RemoteOnly" 只对不在本地 Web 服务器上运行的
用户显示自定义(友好的)信息。出于安全目的,建议使用此设置,以便
不向远程客户端显示应用程序的详细信息。
-->
<customErrors
mode="RemoteOnly"
/>
<!-- 身份验证
此节设置应用程序的身份验证策略。可能的模式是 "Windows"、
"Forms"、 "Passport" 和 "None"
"None" 不执行身份验证。
"Windows" IIS 根据应用程序的设置执行身份验证
(基本、简要或集成 Windows)。在 IIS 中必须禁用匿名访问。
"Forms" 您为用户提供一个输入凭据的自定义窗体(Web 页),然后
在您的应用程序中验证他们的身份。用户凭据标记存储在 Cookie 中。
"Passport" 身份验证是通过 Microsoft 的集中身份验证服务执行的,
它为成员站点提供单独登录和核心配置文件服务。
-->
<authentication mode="Windows" />
<!-- 授权
此节设置应用程序的授权策略。可以允许或拒绝不同的用户或角色访问
应用程序资源。通配符: "*" 表示任何人,"?" 表示匿名
(未经身份验证的)用户。
-->
<authorization>
<allow users="*" /> <!-- 允许所有用户 -->
<!-- <allow users="[逗号分隔的用户列表]"
roles="[逗号分隔的角色列表]"/>
<deny users="[逗号分隔的用户列表]"
roles="[逗号分隔的角色列表]"/>
-->
</authorization>
<!-- 应用程序级别跟踪记录
应用程序级别跟踪为应用程序中的每一页启用跟踪日志输出。
设置 trace enabled="true" 可以启用应用程序跟踪记录。如果 pageOutput="true",则
在每一页的底部显示跟踪信息。否则,可以通过浏览 Web 应用程序
根目录中的 "trace.axd" 页来查看
应用程序跟踪日志。
-->
<trace
enabled="false"
requestLimit="10"
pageOutput="false"
traceMode="SortByTime"
localOnly="true"
/>
<!-- 会话状态设置
默认情况下,ASP.NET 使用 Cookie 来标识哪些请求属于特定的会话。
如果 Cookie 不可用,则可以通过将会话标识符添加到 URL 来跟踪会话。
若要禁用 Cookie,请设置 sessionState cookieless="true"。
-->
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="20"
/>
<!-- 全球化
此节设置应用程序的全球化设置。
-->
<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
/>
</system.web>
<appSettings>
<add key="DBConnectString" value="server=(local);User ID=sa;Password=sa;database=CSDN" />
</appSettings>
</configuration>
D:数据库代码如下:
--建数据库
Create Database CSDN
--建表
DROP TABLE [STNM]
CREATE TABLE [STNM] ( [STCDT] [char] (5) NOT NULL , [STNM] [char] (30) NULL , [RVNM] [char] (30) NULL , [SUBNM] [char] (30) NULL , [BNNM] [char] (30) NULL , [ELSO] [int] NULL , [NTLA] [int] NULL , [STADDR] [char] (30) NULL , [ADCD] [char] (6) NULL , [BASE] [float] NULL , [MDPR] [float] NULL , [STTP] [char] (2) NOT NULL , [NDR] [int] NULL , [ITEM] [char] (30) NULL , [FNYM] [char] (6) NULL , [ENDYM] [char] (6) NULL , [ROW_ORDER] [int] NULL , [AREA] [float] NULL , [IsSat] [char] (2) NULL , [IsBroad] [char] (2) NULL )
INSERT [STNM] ( [STCDT] , [STNM] , [RVNM] , [SUBNM] , [BNNM] , [ELSO] , [NTLA] , [STADDR] , [STTP] , [FNYM] , [ENDYM] , [IsSat] , [IsBroad] ) VALUES ( '33728' , '斋堂水库 ' , '清水河 ' , '永定河 ' , '海河流域 ' , 115 , 39 , '京-门头沟 ' , 'RR' , '195401' , '195401' , '否' , '否' )
--建表
DROP TABLE [Data]
CREATE TABLE [Data] ( [STCDT] [char] (5) NOT NULL , [ZI] [float] NOT NULL , [V] [float] NULL , [AREA] [int] NULL )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 412.0 , 0.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 415.0 , 0.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 416.0 , 0.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 418.0 , 5.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 420.0 , 10.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 422.0 , 60.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 424.0 , 100.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 426.0 , 160.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 428.0 , 220.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 430.0 , 300.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 432.0 , 400.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 434.0 , 500.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 438.0 , 745.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 440.0 , 895.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 442.0 , 1050.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 444.0 , 1210.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 446.0 , 1410.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 448.0 , 1600.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 450.0 , 1810.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 452.0 , 2040.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 454.0 , 2290.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 456.0 , 2550.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 458.0 , 2845.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 460.0 , 3175.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 464.0 , 3880.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 468.0 , 4680.0 )
Create Database CSDN
--建表
DROP TABLE [STNM]
CREATE TABLE [STNM] ( [STCDT] [char] (5) NOT NULL , [STNM] [char] (30) NULL , [RVNM] [char] (30) NULL , [SUBNM] [char] (30) NULL , [BNNM] [char] (30) NULL , [ELSO] [int] NULL , [NTLA] [int] NULL , [STADDR] [char] (30) NULL , [ADCD] [char] (6) NULL , [BASE] [float] NULL , [MDPR] [float] NULL , [STTP] [char] (2) NOT NULL , [NDR] [int] NULL , [ITEM] [char] (30) NULL , [FNYM] [char] (6) NULL , [ENDYM] [char] (6) NULL , [ROW_ORDER] [int] NULL , [AREA] [float] NULL , [IsSat] [char] (2) NULL , [IsBroad] [char] (2) NULL )
INSERT [STNM] ( [STCDT] , [STNM] , [RVNM] , [SUBNM] , [BNNM] , [ELSO] , [NTLA] , [STADDR] , [STTP] , [FNYM] , [ENDYM] , [IsSat] , [IsBroad] ) VALUES ( '33728' , '斋堂水库 ' , '清水河 ' , '永定河 ' , '海河流域 ' , 115 , 39 , '京-门头沟 ' , 'RR' , '195401' , '195401' , '否' , '否' )
--建表
DROP TABLE [Data]
CREATE TABLE [Data] ( [STCDT] [char] (5) NOT NULL , [ZI] [float] NOT NULL , [V] [float] NULL , [AREA] [int] NULL )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 412.0 , 0.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 415.0 , 0.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 416.0 , 0.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 418.0 , 5.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 420.0 , 10.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 422.0 , 60.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 424.0 , 100.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 426.0 , 160.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 428.0 , 220.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 430.0 , 300.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 432.0 , 400.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 434.0 , 500.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 438.0 , 745.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 440.0 , 895.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 442.0 , 1050.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 444.0 , 1210.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 446.0 , 1410.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 448.0 , 1600.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 450.0 , 1810.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 452.0 , 2040.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 454.0 , 2290.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 456.0 , 2550.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 458.0 , 2845.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 460.0 , 3175.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 464.0 , 3880.0 )
INSERT [Data] ( [STCDT] , [ZI] , [V] ) VALUES ( '33728' , 468.0 , 4680.0 )
以上为完整代码。