作成日: 2021/02/09 最終更新日: 2021/03/17
文書種別
不具合
状況
修正済み
詳細
ChartModelオブジェクトのFillプロパティを使用してチャートコントロールの背景を白以外の色で塗りつぶすと、コントロールの上部と左部分に不正な線が表示されます。本現象はチャートコントロールのBorderStyleプロパティにNoneを設定した場合にも発生します。
【再現手順】
1.新規にプロジェクトを作成し、WebフォームにFpChartコントロールを配置します。
2.以下のコードを記述して実行します。
◎サンプルコード
【再現手順】
1.新規にプロジェクトを作成し、WebフォームにFpChartコントロールを配置します。
2.以下のコードを記述して実行します。
◎サンプルコード
------------------------------------
Webフォームクラス
------------------------------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Page.IsPostBack Then Return
' コントロール枠線の非表示
FpChart1.BorderStyle = BorderStyle.None
' 背景色の設定
FpChart1.Model.Fill = New FarPoint.Web.Chart.SolidFill(System.Drawing.Color.Black)
DirectCast(FpChart1.Model.PlotAreas(0), FarPoint.Web.Chart.YPlotArea).BackWall.Fill = New FarPoint.Web.Chart.SolidFill(System.Drawing.Color.Red)
End Sub
------------------------------------
クライアント側
------------------------------------
<style type="text/css">
body{
background-color:black;
}
</style>
Webフォームクラス
------------------------------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Page.IsPostBack Then Return
' コントロール枠線の非表示
FpChart1.BorderStyle = BorderStyle.None
' 背景色の設定
FpChart1.Model.Fill = New FarPoint.Web.Chart.SolidFill(System.Drawing.Color.Black)
DirectCast(FpChart1.Model.PlotAreas(0), FarPoint.Web.Chart.YPlotArea).BackWall.Fill = New FarPoint.Web.Chart.SolidFill(System.Drawing.Color.Red)
End Sub
------------------------------------
クライアント側
------------------------------------
<style type="text/css">
body{
background-color:black;
}
</style>
回避方法
Service Pack 7(v10.0.4012.2013)で修正済み。
Service Packを適用せずに対処する場合、FpChartのチャートを画像として取得し、背景と同色の直線で不正な線を上書きしImageコントロールとしてWebForms上に表示させることで回避可能です。
・WebForm1.aspxではFpChartコントロールのVisibleをFalseにして、Imageコントロールを追加します。
・WebForm1.aspx.vbではPage_Loadイベントの最後で次のような記述を追加します。
Service Packを適用せずに対処する場合、FpChartのチャートを画像として取得し、背景と同色の直線で不正な線を上書きしImageコントロールとしてWebForms上に表示させることで回避可能です。
・WebForm1.aspxではFpChartコントロールのVisibleをFalseにして、Imageコントロールを追加します。
------------------------------------
クライアント側
------------------------------------
<FarPoint:FpChart ID="FpChart1" Runat="server" BorderColor="#A0A0A0" BorderStyle="Solid" BorderWidth="1px" Height="320px" ViewType="View2D" Width="320px" Enabled="True" Visible="False">
<model><labelareas><FarPoint:LabelArea AlignmentX="0.5" Location="0.5, 0.02"></FarPoint:LabelArea></labelareas><legendareas><FarPoint:LegendArea AlignmentX="1" AlignmentY="0.5" Location="0.98, 0.5"></FarPoint:LegendArea></legendareas><plotareas><FarPoint:YPlotArea Elevation="15" GlobalAmbientLight="50,50,50" Location="0.2, 0.2" Rotation="-20" Size="0.6, 0.6"><yaxes><FarPoint:ValueAxis></FarPoint:ValueAxis></yaxes><series><FarPoint:BarSeries /></series><lights><FarPoint:DirectionalLight AmbientColor="128,128,128" DiffuseColor="128, 128, 128" DirectionX="10" DirectionY="20" DirectionZ="30"></FarPoint:DirectionalLight></lights></FarPoint:YPlotArea></plotareas></model>
</FarPoint:FpChart>
<asp:Image ID="Image1" runat="server" Height="320px" Width="320px" />
クライアント側
------------------------------------
<FarPoint:FpChart ID="FpChart1" Runat="server" BorderColor="#A0A0A0" BorderStyle="Solid" BorderWidth="1px" Height="320px" ViewType="View2D" Width="320px" Enabled="True" Visible="False">
<model><labelareas><FarPoint:LabelArea AlignmentX="0.5" Location="0.5, 0.02"></FarPoint:LabelArea></labelareas><legendareas><FarPoint:LegendArea AlignmentX="1" AlignmentY="0.5" Location="0.98, 0.5"></FarPoint:LegendArea></legendareas><plotareas><FarPoint:YPlotArea Elevation="15" GlobalAmbientLight="50,50,50" Location="0.2, 0.2" Rotation="-20" Size="0.6, 0.6"><yaxes><FarPoint:ValueAxis></FarPoint:ValueAxis></yaxes><series><FarPoint:BarSeries /></series><lights><FarPoint:DirectionalLight AmbientColor="128,128,128" DiffuseColor="128, 128, 128" DirectionX="10" DirectionY="20" DirectionZ="30"></FarPoint:DirectionalLight></lights></FarPoint:YPlotArea></plotareas></model>
</FarPoint:FpChart>
<asp:Image ID="Image1" runat="server" Height="320px" Width="320px" />
・WebForm1.aspx.vbではPage_Loadイベントの最後で次のような記述を追加します。
------------------------------------
Webフォームクラス
------------------------------------
' チャートの画像を取得
Dim bm As Bitmap = FpChart1.RenderImage
' 黒の直線で不正な線を上書き
Dim g As Graphics = Graphics.FromImage(bm)
Dim pen As Pen = New Pen(Brushes.Black, 1)
g.DrawLine(pen, New PointF(0, 0), New PointF(0, bm.Height + 1))
g.DrawLine(pen, New PointF(0, 0), New PointF(bm.Width + 1, 0))
g.Dispose()
' ファイルとしてImageコントロールに設定
bm.Save(Server.MapPath("~/") & "spreadchart.bmp")
Image1.ImageUrl = "~/spreadchart.bmp"
Webフォームクラス
------------------------------------
' チャートの画像を取得
Dim bm As Bitmap = FpChart1.RenderImage
' 黒の直線で不正な線を上書き
Dim g As Graphics = Graphics.FromImage(bm)
Dim pen As Pen = New Pen(Brushes.Black, 1)
g.DrawLine(pen, New PointF(0, 0), New PointF(0, bm.Height + 1))
g.DrawLine(pen, New PointF(0, 0), New PointF(bm.Width + 1, 0))
g.Dispose()
' ファイルとしてImageコントロールに設定
bm.Save(Server.MapPath("~/") & "spreadchart.bmp")
Image1.ImageUrl = "~/spreadchart.bmp"
旧文書番号
86398