更改ActionResult中HighCharts中的标题样式
Change Style of Title in HighCharts in ActionResult
这是我的代码:
public ActionResult SeriesWinsChart()
{
Highcharts chart = new Highcharts("chart")
.InitChart(new Chart { PlotShadow = false })
.SetTitle(new Title { Text = "Series Wins" })
.SetCredits(new Credits { Enabled = false })
//.SetTooltip(new Tooltip { Formatter = "function() { return '<b>'+ this.point.name +'</b>: '+ this.y; }" })
.SetPlotOptions(new PlotOptions
{
Pie = new PlotOptionsPie
{
AllowPointSelect = true,
Cursor = Cursors.Pointer,
DataLabels = new PlotOptionsPieDataLabels
{
Color = ColorTranslator.FromHtml("#000000"),
ConnectorColor = ColorTranslator.FromHtml("#000000"),
Formatter = "function() { return '<b>'+ this.point.name +'</b>: '+ this.y; }"
}
}
})
.SetSeries(new Series
{
Type = ChartTypes.Pie,
Name = "Series Wins",
Data = new Data(new object[]
{
new object[] { "Test1", db.Teams.Where(x => x.TeamName == "Team1").Sum(x => x.SeriesWins)},
new object[] { "Test2", db.Teams.Where(x => x.TeamName == "Team2").Sum(x => x.SeriesWins)}
})
});
return View(chart);
}
这是在局部视图中进行渲染。。所以我的代码只是:
@model DotNet.Highcharts.Highcharts
@(Model)
我已经对此主题进行了研究,但它涉及JS,我知道这就是HighCharts的来源,但我能在ActionResult中更改标题的样式和字体大小吗?
在您的SetTitle()函数中,您可以按如下方式传递css,如字体、颜色等:
.SetTitle(new Title { Text = "Series Wins", Style = "font: 'normal 14px Verdana, sans-serif',color : 'red'" })
如果有帮助,请告诉我!
相关文章:
- Wordpress标题和子菜单样式对IE的不满
- 更改标题样式在 Chrome 中不起作用
- 如何在dgrid中设置列内容的样式,而不设置列标题的样式
- 设置 Jquery 对话框标题栏样式
- 为HTML文本区域设置标题属性的样式
- 更改ActionResult中HighCharts中的标题样式
- 有没有办法在页面达到某个 #anchor 点时更改我的<标题>样式
- 样式 动态添加的表标题和列
- 样式标题工具提示在表格中不起作用
- 如何将样式添加到圆环图c3.js的标题中
- D3可以't将样式设置为带标题的对象
- 没有应用不同标题的CSS样式表-即使没有rel="alternative"
- 使用Javascript更改SO标题栏样式
- 如何用变量改变标题栏样式
- Dojo -在标题之外添加外部样式表
- 如何对下拉列表项的标题属性应用样式
- 用HTML和Javascript创建Mac OS X标题栏样式的菜单
- 指定& # 39;标题# 39;属性不允许在样式表中应用
- 从数据标题中删除内联样式表
- 将工具提示标题样式设置为'pull-left'