我正在尝试将 ASP.NET 图表控件用于针对多种语言进行本地化的网站。然而,当我们最近添加中文本地化时,我们遇到了图表问题 - 所有标签都显示了我们实际需要中文字符的方 block ,如下面的示例所示(请注意我不懂中文,所以这可能说什么):
default.aspx(无代码隐藏):
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ChineseChart._Default" %>
<%@ Register Assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Chart runat="server" Height="270px" Palette="None" PaletteCustomColors="0, 192, 96; 0, 96, 48">
<legends>
<asp:Legend Alignment="Center" Docking="Bottom" Name="Legend1" BorderColor="Black">
</asp:Legend>
</legends>
<titles>
<asp:Title Name="Title1" Text="我的示例图表">
</asp:Title>
</titles>
<series><asp:Series Name="富" ChartType="Pie" Legend="Legend1">
<points>
<asp:DataPoint AxisLabel="酒吧" MapAreaAttributes="" ToolTip="" Url="" YValues="65" />
<asp:DataPoint AxisLabel="富" MapAreaAttributes="" ToolTip="" Url="" YValues="24" />
</points>
</asp:Series>
</series>
<chartareas><asp:ChartArea Name="ChartArea1"></asp:ChartArea></chartareas>
</asp:Chart>
</div>
</form>
</body>
</html>
图表生成:
(来源:simonrice.com)
我认为这是字符编码问题,但我在图表对象中找不到任何内容来更改控件的编码。
有什么办法可以解决这个问题吗?
更新:我们还有希腊语和希伯来语版本的网站,这两种语言都没有给我们在图表上带来任何问题。
最佳答案
如果您没有在计算机上安装非拉丁字母语言包,特别是亚洲语言,那么显示这些字符的唯一现成字体是 Arial Unicode MS。
该字体的真正缺点是,在显示使用拉丁字母的英语等语言时,它看起来很糟糕。
关于c# - ASP.NET 图表控件和字符编码问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2362812/