変位バーをペイントする私はSystem.Web.UI.DataVisualization.Charting.Chart
を使用して変位バーをペイントしようとしているが、代わりにこのようにしています: この他の方法:
どのようにASP.NETチャートで
を私は意味、私が希望点1から始まり、右に55px移動した棒をペイントします。次のコードで
:
私はこれを達成している
Chart1.Series.Clear();
int[,] horas = new int[,] { { 0, 1 }, { 1, 1 }, { 2, 0 }, { 3, 1 }, { 4, 0 }, { 5, 1 }, { 6, 0 }, { 7, 0 }, { 8, 1 }, { 9, 1 } };
Chart1.DataSource = horas;
var series1 = new Series
{
Color = System.Drawing.Color.Green,
IsVisibleInLegend = false,
IsXValueIndexed = true,
ChartType = SeriesChartType.RangeColumn,
};
series1["PixelPointWidth"] = "1";
int[,] horas1 = new int[,] { { 0, 1 }, { 1, 1 }, { 2, 0 }, { 3, 1 }, { 4, 0 }, { 5, 1 }, { 6, 0 }, { 7, 0 }, { 8, 1 }, { 9, 1 } };
var series2 = new Series
{
Color = System.Drawing.Color.Green,
IsVisibleInLegend = false,
IsXValueIndexed = true,
ChartType = SeriesChartType.RangeColumn
};
series2["PixelPointWidth"] = "110";
for (int i = 0; i < horas.GetLength(0); i++)
{
series1.Points.AddXY(horas[i, 0], horas[i, 1]);
}
for (int i = 0; i < horas.GetLength(0); i++)
{
series2.Points.AddXY(horas1[i, 0], horas1[i, 1]);
}
int b = 0;
foreach (var label in Chart1.ChartAreas[0].AxisX.CustomLabels)
{
label.Text = b.ToString();
b++;
}
Chart1.Series.Add(series1);
Chart1.Series.Add(series2);
Chart1.ChartAreas[0].AxisY.Interval = 0;
Chart1.ChartAreas[0].AxisX.Interval = 1;
Chart1.ChartAreas[0].AxisY.Maximum = 1;
Chart1.ChartAreas[0].AxisY.Minimum = 0;
Chart1.ChartAreas[0].AxisX.MajorGrid.LineWidth = 0;
Chart1.ChartAreas[0].AxisY.MajorGrid.LineWidth = 0;
Chart1.DataBind();
をしかし、これは私が望んでいない側に、少なくとも1ピクセルをペイントしなければならないとして、最適な解決策ではありません。
私の目標を達成するための解決策や提案がありがとうと思います。 Thxを事前に入力してください。
編集。これは、.NET 4.5 FrameworkでVS 2015 Professionalで開発されたIIS 6.0のWindows Server 2012で動作しています
編集:右は55ピクセルですが、最適な解決策はX軸の次のポイントになります
編集:これはweb.configの内容です。
<configuration>
<appSettings>
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />
</appSettings>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="ChartImageHandler" />
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST"
path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
</system.webServer>
<system.web>
<httpHandlers>
<add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
validate="false" />
</httpHandlers>
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting"
assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</controls>
</pages>
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>
<httpRuntime targetFramework="4.5"/>
</system.web>
</configuration>
asp.netチャートは何ですか?私はあなたのグラフライブラリを使用して推測しています。この情報がなければ誰も助けることはできません – Liam
@Liamクラスは:System.Web.UI.DataVisualization.Charting.Chart – Veelicus
これはWebフォームコントロールだと思いますか?私はこれがどのように機能するか(またはネットクラスとは別のもの)を参照するのに苦労しています。これはどのバージョンの.netですか?プラグインをインストールしましたか?基本的には、ここに関連情報があれば全ての[最小、完全、および検証可能な例](https://stackoverflow.com/help/mcve)が必要です。 – Liam