Namespace: System.Web.Helpers
Assembly: System.Web.Helpers (in System.Web.Helpers.dll)
有没有办法设置系列颜色?这种淡黄色很难发现...
图表代码:
new Chart(width: w, height: h, theme: ChartTheme.Blue)
.AddLegend("Legenda")
.SetYAxis(min: 0, max: 30)
.AddSeries(
name: "Temperatura",
chartType: DataVisualization.SeriesChartType.FastLine.ToString(),
xValue: dataRange.Select(d => d.RecordDate.ToString("dd/MM")).ToList(),
yValues: dataRange.Select(d => d.TemperatureAvg).ToList())
.AddSeries(
name: "Ponto de orvalho",
chartType: DataVisualization.SeriesChartType.FastLine.ToString(),
xValue: dataRange.Select(d => d.RecordDate.ToString("dd/MM")).ToList(),
yValues: dataRange.Select(d => d.DewAvg).ToList())
.Write();
答案 0 :(得分:0)
您需要设置主题并定义系列的颜色。如下所示:
string customSeriesColor = @"<Chart BorderlineDashStyle=""Solid"" BorderWidth=""1"">
<ChartAreas>
<ChartArea Name=""Default"" _Template_=""All"">
<AxisY Interval=""50"">
<LabelStyle Font=""Verdana, 70px"" />
</AxisY>
<AxisX Interval=""200"">
<LabelStyle Font=""Verdana, 70px"" />
</AxisX>
</ChartArea>
</ChartAreas>
<Titles>
<Title Font=""Times New Roman, 16pt, style=Bold"" Name=""Title"" Text=""Costs"">
</Title>
</Titles>
<Series>
<Series Name=""Temperatura"" BorderWidth=""1"" Color=""Red"">
</Series>
<Series Name=""Ponto de orvalho"" BorderWidth=""1"" Color=""Blue"">
</Series>
</Series>
<Legends>
<Legend _Template_=""All"" BackColor=""Transparent"" Font=""Trebuchet MS, 12.25pt, style=Bold"" IsTextAutoFit=""False"" />
</Legends>
<BorderSkin SkinStyle=""Emboss"" />
</Chart>";
您的图表代码如下:
new Chart(width: w, height: h, theme: customSeriesColor)