HighCharts之图表背景设置
2016-05-10 19:29
274 查看
为HighCharts设置XAxis的PlotBands属性,全部代码如下:
Highcharts chart = new Highcharts("HC" + divName)
.InitChart(new Chart
{
DefaultSeriesType = CT_type,
Width = _width,
Height = _height,
ClassName = _Title,
BackgroundColor = null
}).SetCredits(new Credits { Enabled = false })
.SetTitle(new Title
{
Text = _Title
})
.SetXAxis(new XAxis
{
Title = new XAxisTitle { Text = "单位:" + unitName },
Categories = xCategoryList.ToArray(),
Reversed = false,
Opposite = false,
PlotBands = new[]{
new XAxisPlotBands{
Color=ColorTranslator.FromHtml("#FCFFC5"),
From=7,
To=12,
Label=new XAxisPlotBandsLabel {Text="上午工作时间"}
},
new XAxisPlotBands{
Color=ColorTranslator.FromHtml("#FCFFC5"),
From=13,
To=18,
Label=new XAxisPlotBandsLabel {Text="下午工作时间"}
}
}
})
.SetYAxis(new YAxis
{
Title = new YAxisTitle { Text = "单位:" + SeriesUnit },
Min = 0,
PlotLines = new[]
{
new YAxisPlotLines
{
Value = 0,
Width = 1,
Color = ColorTranslator.FromHtml("#808080")
} }
})
.SetTooltip(new Tooltip
{
Formatter = ToolTip_info,
ValueDecimals = 2
})
.SetPlotOptions(new PlotOptions
{
Column = new PlotOptionsColumn
{
BorderWidth = 2,
BorderColor = ColorTranslator.FromHtml("#edc240")
}
})
.SetLegend(new Legend
{
Enabled = false
})
.SetSeries(new[]
{
new Series { Name ="", Data = new Data(yDataSeriesList.ToArray()),Color=ColorTranslator.FromHtml("#f5e2a7")}
}
);
return chart.ToHtmlString();
Highcharts chart = new Highcharts("HC" + divName)
.InitChart(new Chart
{
DefaultSeriesType = CT_type,
Width = _width,
Height = _height,
ClassName = _Title,
BackgroundColor = null
}).SetCredits(new Credits { Enabled = false })
.SetTitle(new Title
{
Text = _Title
})
.SetXAxis(new XAxis
{
Title = new XAxisTitle { Text = "单位:" + unitName },
Categories = xCategoryList.ToArray(),
Reversed = false,
Opposite = false,
PlotBands = new[]{
new XAxisPlotBands{
Color=ColorTranslator.FromHtml("#FCFFC5"),
From=7,
To=12,
Label=new XAxisPlotBandsLabel {Text="上午工作时间"}
},
new XAxisPlotBands{
Color=ColorTranslator.FromHtml("#FCFFC5"),
From=13,
To=18,
Label=new XAxisPlotBandsLabel {Text="下午工作时间"}
}
}
})
.SetYAxis(new YAxis
{
Title = new YAxisTitle { Text = "单位:" + SeriesUnit },
Min = 0,
PlotLines = new[]
{
new YAxisPlotLines
{
Value = 0,
Width = 1,
Color = ColorTranslator.FromHtml("#808080")
} }
})
.SetTooltip(new Tooltip
{
Formatter = ToolTip_info,
ValueDecimals = 2
})
.SetPlotOptions(new PlotOptions
{
Column = new PlotOptionsColumn
{
BorderWidth = 2,
BorderColor = ColorTranslator.FromHtml("#edc240")
}
})
.SetLegend(new Legend
{
Enabled = false
})
.SetSeries(new[]
{
new Series { Name ="", Data = new Data(yDataSeriesList.ToArray()),Color=ColorTranslator.FromHtml("#f5e2a7")}
}
);
return chart.ToHtmlString();
相关文章推荐
- [bzoj4551][TJOI&HEOI2016]树
- NYOJ - 168 房间安排
- HDU 1392.Surround the Trees【凸包(求凸包周长)】【5月10】
- 笔试题51. LeetCode OJ (38)
- C++实验5—求和
- shell浅谈之二运算符和IF条件判断
- POJ 3087 Shuffle'm Up
- [Python] RiceRocks游戏 Mini-project #8
- Spark SQL和DataFrame的学习总结
- [读书笔记]Clean Code (8-完结)
- Java--类的继承--回合制对战游戏
- java中如何自定义线程
- java中static{}语句块详解
- RabbitMq、ActiveMq、ZeroMq、kafka之间的比较,资料汇总
- Android 内功心法(1.4)——android常用设计模式之代理模式
- Table of Contents - Spring
- Log4J日志组件
- 第11周阅读程序(5-1)
- webshell智能查杀
- androidView树的绘图流程