私は以下のASP.NET動的チャートを持っています。どのようにして、x軸上の日付ごとにグラフを下ろすかを決定します。現在、y軸、2009年7月、2010年5月、2011年3月の3つの行があります。各日付の行が必要なので、行の各点を見ることができます。チャートに配置されます。ASP.NETチャートの列幅
また、チャートの開始時と終了時にパディングがあり、右側の境界線がないようです。パディングを取り除き、正しいボーダーを得るにはどうすればいいですか?
フロントエンド:
<asp:Chart ID="chtReport" runat="server" Width="650px" Height="400px" ImageType="Jpeg">
<Series>
<asp:Series Name="TotalLine" YValueType="Double" ChartType="Line" ChartArea="MainChartArea" />
<asp:Series Name="GoalLine" YValueType="Double" ChartType="Line" ChartArea="MainChartArea" />
<asp:Series Name="AverageLine" YValueType="Double" ChartType="Line" ChartArea="MainChartArea" />
<asp:Series Name="TotalPoint" YValueType="Double" ChartType="Point" ChartArea="MainChartArea" />
<asp:Series Name="GoalPoint" YValueType="Double" ChartType="Point" ChartArea="MainChartArea" />
<asp:Series Name="AveragePoint" YValueType="Double" ChartType="Point" ChartArea="MainChartArea" />
</Series>
<ChartAreas>
<asp:ChartArea Name="MainChartArea">
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
バックエンド任意の助けを事前に
protected void Page_Load(object sender, EventArgs e)
{
for (DateTime date = startDate; date <= ChartDetails.EndDate; date = date.AddMonths(1))
{
dates.Add(date.ToString());
}
grdChart.DataSource = dates;
grdChart.DataBind();
chtReport.ChartAreas["MainChartArea"].AxisY.Minimum = 0;
chtReport.ChartAreas["MainChartArea"].AxisY.Maximum = 100;
chtReport.ChartAreas["MainChartArea"].AxisX.Title = "Date Range";
chtReport.ChartAreas["MainChartArea"].AxisY.Title = "Percent";
}
protected void grdChart_ItemDataBound(object sender, DataGridItemEventArgs e)
{
// Extra Code above...
chtReport.Series["TotalLine"].Points.AddXY(rowDate.ToString("MMM yyyy"), total);
chtReport.Series["GoalLine"].Points.AddXY(rowDate.ToString("MMM yyyy"), total);
chtReport.Series["AverageLine"].Points.AddXY(rowDate.ToString("MMM yyyy"), total);
chtReport.Series["TotalPoint"].Points.AddY(total);
chtReport.Series["GoalPoint"].Points.AddXY(rowDate.ToString("MMM yyyy"), total);
chtReport.Series["AveragePoint"].Points.AddXY(rowDate.ToString("MMM yyyy"), total);
}
おかげ
は、ここに私のコードです。
私は幸運のない0のパディングでスタイルを追加しました。パディングの問題以外にも、チャート上の各日付のY軸を上に移動するための線を表示する必要があります。 – PsychoDUCK