--建立表结构
CREATE TABLE [dbo].[Sales](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Corpration] [nvarchar](32) COLLATE Chinese_PRC_CI_AS NOT NULL,
[Sales] [decimal](18, 2) NOT NULL,
[DateTime] [datetime] NULL CONSTRAINT [DF_Sales_DateTime]  DEFAULT (getdate()),
 CONSTRAINT [PK_Sales] PRIMARY KEY CLUSTERED 
(
[Id] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
--插入数据
INSERT INTO SALES(Corpration,Sales) values('中华',1900.98)
INSERT INTO SALES(Corpration,Sales) values('中华',1256.32)
INSERT INTO SALES(Corpration,Sales) values('中华',1362.00)
INSERT INTO SALES(Corpration,Sales) values('中华',1527.96)
INSERT INTO SALES(Corpration,Sales) values('中华',1854.23)
INSERT INTO SALES(Corpration,Sales) values('海狮',2631.25)
INSERT INTO SALES(Corpration,Sales) values('海狮',2798.36)
INSERT INTO SALES(Corpration,Sales) values('海狮',2869.51)
INSERT INTO SALES(Corpration,Sales) values('海狮',2987.36)
INSERT INTO SALES(Corpration,Sales) values('海狮',3025.13)--删除表
DROP TABLE SALES要求结果纵坐标为销售额、横坐标为日期(单位为天),2条折线,分别为中华和海狮。
下图仅仅显示了2个日期,要求是数据库中按天进行绘图。

解决方案 »

  1.   

    用zedgraph控件话,具体下载地址google一下
      

  2.   

    数据DataSet如下:
    <?xml version="1.0" encoding="utf-8"?>
    <xs:schema id="Multy" targetNamespace="http://tempuri.org/Multy.xsd" xmlns:mstns="http://tempuri.org/Multy.xsd" xmlns="http://tempuri.org/Multy.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
      <xs:annotation>
        <xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
          <DataSource DefaultConnectionIndex="0" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
            <Connections>
              <Connection AppSettingsObjectName="Web.config" AppSettingsPropertyName="CrystalReportConnectionString" ConnectionStringObject="" IsAppSettingsProperty="True" Modifier="Assembly" Name="CrystalReportConnectionString (Web.config)" ParameterPrefix="@" PropertyReference="AppConfig.System.Configuration.ConfigurationManager.0.ConnectionStrings.CrystalReportConnectionString.ConnectionString" Provider="System.Data.SqlClient">
              </Connection>
            </Connections>
            <Tables>
              <TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="SalesTableAdapter" GeneratorDataComponentClassName="SalesTableAdapter" Name="Sales" UserDataComponentName="SalesTableAdapter">
                <MainSource>
                  <DbSource ConnectionRef="CrystalReportConnectionString (Web.config)" DbObjectName="CrystalReport.dbo.Sales" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="False" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="False" UserGetMethodName="GetData" UserSourceName="Fill">
                    <SelectCommand>
                      <DbCommand CommandType="Text" ModifiedByUser="True">
                        <CommandText>SELECT Id, Corpration, Sales, DateTime
    FROM Sales</CommandText>
                        <Parameters>
                        </Parameters>
                      </DbCommand>
                    </SelectCommand>
                  </DbSource>
                </MainSource>
                <Mappings>
                  <Mapping SourceColumn="Id" DataSetColumn="Id" />
                  <Mapping SourceColumn="Corpration" DataSetColumn="Corpration" />
                  <Mapping SourceColumn="Sales" DataSetColumn="Sales" />
                  <Mapping SourceColumn="DateTime" DataSetColumn="DateTime" />
                </Mappings>
                <Sources>
                </Sources>
              </TableAdapter>
            </Tables>
            <Sources>
            </Sources>
          </DataSource>
        </xs:appinfo>
      </xs:annotation>
      <xs:element name="Multy" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:Generator_UserDSName="Multy" msprop:Generator_DataSetName="Multy">
        <xs:complexType>
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element name="Sales" msprop:Generator_UserTableName="Sales" msprop:Generator_RowDeletedName="SalesRowDeleted" msprop:Generator_TableClassName="SalesDataTable" msprop:Generator_RowChangedName="SalesRowChanged" msprop:Generator_RowClassName="SalesRow" msprop:Generator_RowChangingName="SalesRowChanging" msprop:Generator_RowEvArgName="SalesRowChangeEvent" msprop:Generator_RowEvHandlerName="SalesRowChangeEventHandler" msprop:Generator_TablePropName="Sales" msprop:Generator_TableVarName="tableSales" msprop:Generator_RowDeletingName="SalesRowDeleting">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="Id" msdata:ReadOnly="true" msdata:AutoIncrement="true" msprop:Generator_UserColumnName="Id" msprop:Generator_ColumnPropNameInRow="Id" msprop:Generator_ColumnVarNameInTable="columnId" msprop:Generator_ColumnPropNameInTable="IdColumn" type="xs:int" />
                  <xs:element name="Corpration" msprop:Generator_UserColumnName="Corpration" msprop:Generator_ColumnPropNameInRow="Corpration" msprop:Generator_ColumnVarNameInTable="columnCorpration" msprop:Generator_ColumnPropNameInTable="CorprationColumn">
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="32" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:element>
                  <xs:element name="Sales" msprop:Generator_UserColumnName="Sales" msprop:Generator_ColumnPropNameInRow="Sales" msprop:Generator_ColumnVarNameInTable="columnSales" msprop:Generator_ColumnPropNameInTable="SalesColumn" type="xs:decimal" />
                  <xs:element name="DateTime" msprop:Generator_UserColumnName="DateTime" msprop:Generator_ColumnPropNameInRow="DateTime" msprop:Generator_ColumnVarNameInTable="columnDateTime" msprop:Generator_ColumnPropNameInTable="DateTimeColumn" type="xs:dateTime" minOccurs="0" />
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:choice>
        </xs:complexType>
        <xs:unique name="Constraint1" msdata:PrimaryKey="true">
          <xs:selector xpath=".//mstns:Sales" />
          <xs:field xpath="mstns:Id" />
        </xs:unique>
      </xs:element>
    </xs:schema>
      

  3.   


    第一种用  .NET 的第三方控件, 对于控件的用法 网上有
    第二种用 JQUERY ,在 谷歌 里面 搜索 flot ,里面也有详细的API,2种方法都能达到你的要求 。