0

現在、asp.netチャートツールキットを使用したポイントチャートがありますが、同じチャートに最適な線を配置したいと思います。直線(y = mx + b)の方程式を計算する方法を知っているとすると、これを同じグラフにどのように重ね合わせるのでしょうか。

4

2 に答える 2

0

ChartArea内に別のシリーズを作成し、ChartType="Line"を設定する必要があります

于 2010-08-24T17:38:54.093 に答える
0

このコードがお役に立てば幸いです。

<asp:Chart ID="Chart1" runat="server" Width="1000" BorderlineColor="Black" DataSourceID="SqlDataSource1">                    
                       <series>
                <asp:Series Name="Achieved %" XValueMember="date" YValueMembers="actual_value" Color="Plum" IsValueShownAsLabel="true" Palette="Pastel" ShadowColor="Bisque" > </asp:Series>             
             <asp:Series BorderWidth="2" Name="Target" ChartType="Line" Color="#00ff00" YValueMembers="target_value" BorderDashStyle="Dash"></asp:Series>
             <asp:Series BorderWidth="2" Name="Average %" ChartType="Line" Color="Brown" YValueMembers="average" BorderDashStyle="Dash"></asp:Series>
            </series>
         <Legends>
            <asp:Legend Name="DefaultLegend" Enabled="True" Docking="Bottom" />
         </Legends>
                     <chartareas>
                        <asp:ChartArea Name="ChartArea1">
                             <axisy Title="Achieved %">
                              <MajorGrid Enabled ="False" />
                    </axisy>
                    <axisy2 Title="Objective">
                                    <MajorGrid Enabled ="False" />
                    </axisy2>
                                <axisx Title="Date" Interval="1">
                                    <MajorGrid Enabled="false"/>
                                </axisx>

                        <asp:Chart ID="Chart1" runat="server" Width="1000" BorderlineColor="Black" DataSourceID="SqlDataSource1">                    
                       <series>
                <asp:Series Name="Achieved %" XValueMember="date" YValueMembers="actual_value" Color="Plum" IsValueShownAsLabel="true" Palette="Pastel" ShadowColor="Bisque" > </asp:Series>             
             <asp:Series BorderWidth="2" Name="Target" ChartType="Line" Color="#00ff00" YValueMembers="target_value" BorderDashStyle="Dash"></asp:Series>
             <asp:Series BorderWidth="2" Name="Average %" ChartType="Line" Color="Brown" YValueMembers="average" BorderDashStyle="Dash"></asp:Series>
            </series>
         <Legends>
            <asp:Legend Name="DefaultLegend" Enabled="True" Docking="Bottom" />
         </Legends>
                     <chartareas>
                        <asp:ChartArea Name="ChartArea1">
                             <axisy Title="Achieved %">
                              <MajorGrid Enabled ="False" />
                    </axisy>
                    <axisy2 Title="Objective">
                                    <MajorGrid Enabled ="False" />
                    </axisy2>
                                <axisx Title="Date" Interval="1">
                                    <MajorGrid Enabled="false"/>
                                </axisx>

                        </asp:ChartArea>
                    </chartareas>
                </asp:Chart>

サンプルチャート

于 2018-07-04T12:25:29.953 に答える