我正在为ASP.NET 4.0网页上的报表设计一个简单的图表。我面临的一个问题是,如果我使用任何透明度,图表似乎会损坏字体。考虑下面的例子:
<asp:Chart
  ID="chart" runat="server"
  Height="300px" Width="300px"
  BackColor="White"
  ImageStorageMode="UseHttpHandler">
  <Titles>
    <asp:Title Name="title" Text="Results" />
  </Titles>
  <Legends>
    <asp:Legend
      Name="Default"
      Docking="Top"
      LegendStyle="Column"
      BackColor="Transparent"
      Title="Legend"
      Font="Segoe UI, 10.25pt, style=Regular"
      TitleFont="Segoe UI, 12pt, style=Regular">
    </asp:Legend>
  </Legends>
  <Series>
    <asp:Series
      Name="Default"
      ChartType="Pie"
      CustomProperties="PieDrawingStyle=Concave,PieLabelStyle=Disabled"
      IsValueShownAsLabel="False">
      <Points>
        <asp:DataPoint Label="Argentina" YValues="5" />
        <asp:DataPoint Label="Italy" YValues="8" />
        <asp:DataPoint Label="Portugal" YValues="12" />
        <asp:DataPoint Label="China" YValues="45" />
        <asp:DataPoint Label="United States" YValues="32" />
      </Points>
    </asp:Series>
  </Series>
  <ChartAreas>
    <asp:ChartArea Name="area" BackColor="Transparent" />
  </ChartAreas>
</asp:Chart>为了演示起见,我在本例中对数据点进行了硬编码。不需要代码隐藏。我的应用程序有正确配置的appSettings和system.webServer/modules条目。注意,图例的字体样式已经显式地设置为Regular。
这将产生以下图表:

好的。现在是问题所在。我们要求图表位于具有渐变背景的HTML区域的顶部。为了避免干扰梯度,我希望图表的背景区域是透明的。如果我将第四行从BackColor="White"改为BackColor="Transparent",我的所有字体都会变得粗体,并失去它们的反别名。请参见下面(图位于灰色div中):

这是图表控件的限制吗?我是否可以制作一个背景透明的图表,仍然有漂亮的字体,或者我是否应该考虑其他选项(例如,探索其他图表框架或修改需求)?
发布于 2013-10-17 10:15:06
将AntiAliasing属性设置为Graphics并检查它。我已经试用了我的曲线图及其工作原理。
<asp:Chart
  ID="chart" 
  runat="server"
  Height="300px" 
  Width="300px"
  BackColor="Transparent"
  ImageStorageMode="UseHttpHandler" 
  AntiAliasing="Graphics">https://stackoverflow.com/questions/18645883
复制相似问题