为什么高图中的文字没有放在正确的位置?

时间:2014-02-16 08:07:55

标签: c# javascript asp.net-mvc-4 highcharts

我在我的网络应用程序中使用了highchart dll并在c#代码中创建了图表而不是javascript.my问题显示在下面的图片中(文本向左​​移动,它们不在正确的位置),我该如何解决它?

  Highcharts charts = new Highcharts("chart");
charts.InitChart(new Chart { DefaultSeriesType = ChartTypes.Pie})
                        .SetPlotOptions(new PlotOptions
                        {
                            Pie = new PlotOptionsPie
                            {
                                ShowInLegend = true,
                                AllowPointSelect = true,
                                DataLabels = new PlotOptionsPieDataLabels
                                {
                                    Enabled = true,
                                    Formatter = "function() { return this.point.name +' : '+  this.percentage.toFixed(2)+' %'; }"

                                }
                            }
                        })
                          .SetTooltip(new Tooltip
                          {
                              Enabled = true,
                              Formatter = @"function(){return '<b>'+this.series.name +'</b> <br/>'+this.point.name + ' : ' +  this.percentage.toFixed(2)+' % '; }"
                          })
                          .SetLegend(new Legend
                          {
                              Align = HorizontalAligns.Center,
                              VerticalAlign = VerticalAligns.Bottom,
                              Layout = Layouts.Horizontal,
                              BorderWidth = 0                                      
                         });
             charts.SetTitle(new Title { Text = chartTitleV + " بر اساس " + chartTitleH.TrimEnd(',').ToString() })
            .SetXAxis(new XAxis { Categories = HorCategory })
            .SetYAxis(new YAxis { Title = new YAxisTitle { Text = chartTitleV } })
            .SetSeries(new[]
                    {
                        new Series {Name =  chartTitleH.TrimEnd(',').ToString(), Data = new Data(Results )}
                            });

enter image description here

3 个答案:

答案 0 :(得分:1)

尝试在工具提示选项中将useHTML设置为true。

答案 1 :(得分:0)

看不到页面的HTML代码,但我认为问题可能在于设置html元素的'dir'属性......因为我看到文本是用阿拉伯语写的,所以dir =“ rtl“应该设置。

答案 2 :(得分:0)

我改变div的方向

<div dir="ltr" id="chart2" style="height: 300px"></div>