I have one more issue of stacking column with adding series of chart type lines, but the stacking column series is visible on chart until I add new lines series.
can anyone guide me what should be done if I want to add 2 column series with 3-line series with column to be stacked.
Code: Select all
columnChart.InitChart(new Chart()
{
Type = DotNet.Highcharts.Enums.ChartTypes.Column,
Style = "fontWeight: 'bold', fontSize: '17px'",
DefaultSeriesType = ChartTypes.Column,
Width = 1100,
Height = 400,
BackgroundColor = new BackColorOrGradient(System.Drawing.Color.FromArgb(27, 35, 67)),
BorderColor = System.Drawing.Color.FromArgb(27, 35, 67),
BorderRadius = 0,
BorderWidth = 2,
});
columnChart.SetXAxis(new XAxis()
{
Type = AxisTypes.Category,
GridLineColor = System.Drawing.Color.FromArgb(55, 96, 146),//#376092
Labels = new XAxisLabels { Rotation = 45, Style = "color:'white' ,fontWeight: 'normal'" },
Title = new XAxisTitle() { Text = "Secured Site Activity 16 - Week Forecast", Style = "fontWeight: 'bold', fontSize: '17px'" },
Categories = new string[] { GlobalCV.celldate.GetValue(1, 1).ToString(), GlobalCV.celldate.GetValue(2, 1).ToString(), GlobalCV.celldate.GetValue(3, 1).ToString(), GlobalCV.celldate.GetValue(4, 1).ToString(), GlobalCV.celldate.GetValue(5, 1).ToString(), GlobalCV.celldate.GetValue(6, 1).ToString(), GlobalCV.celldate.GetValue(7, 1).ToString(), GlobalCV.celldate.GetValue(8, 1).ToString(), GlobalCV.celldate.GetValue(9, 1).ToString(), GlobalCV.celldate.GetValue(10, 1).ToString(), GlobalCV.celldate.GetValue(11, 1).ToString(), GlobalCV.celldate.GetValue(12, 1).ToString(), GlobalCV.celldate.GetValue(13, 1).ToString(), GlobalCV.celldate.GetValue(14, 1).ToString(), GlobalCV.celldate.GetValue(15, 1).ToString(), GlobalCV.celldate.GetValue(16, 1).ToString(), GlobalCV.celldate.GetValue(17, 1).ToString() }
});
columnChart.SetYAxis(new YAxis()
{
Title = new YAxisTitle()
{
Text = "No of Operatives",
Style = "color:'white',fontWeight: 'normal'",
},
ShowFirstLabel = true,
ShowLastLabel = true,
Min = 0
});
columnChart.SetLegend(new Legend
{
Enabled = true,
Align = HorizontalAligns.Right,
ItemStyle = "color:'white' ,fontWeight: 'normal'",
VerticalAlign = VerticalAligns.Top,
Y = 200,
Layout = Layouts.Vertical
});
columnChart.SetPlotOptions(new PlotOptions { Column = new PlotOptionsColumn { Stacking = Stackings.Normal, Grouping = true } });
dValue = (object)(GlobalCV.DEmp); dValue1 = (object)(GlobalCV.BudgetTarget);
dCValue = (object)(GlobalCV.BudgetTarget + GlobalCV.CBudgetTarget);
columnChart.SetSeries(new Series[]
{
new Series{
Name = "Actual Concrete Works",
Color = Color.FromArgb(131,130,134),// #3E80C1
Data = new Data( new [] { GlobalCV.cellCopdata.GetValue(1),GlobalCV.cellCopdata.GetValue(2),GlobalCV.cellCopdata.GetValue(3),GlobalCV.cellCopdata.GetValue(4),GlobalCV.cellCopdata.GetValue(5),GlobalCV.cellCopdata.GetValue(6),GlobalCV.cellCopdata.GetValue(7),GlobalCV.cellCopdata.GetValue(8),GlobalCV.cellCopdata.GetValue(9),GlobalCV.cellCopdata.GetValue(10),GlobalCV.cellCopdata.GetValue(11),GlobalCV.cellCopdata.GetValue(12),GlobalCV.cellCopdata.GetValue(13),GlobalCV.cellCopdata.GetValue(14),GlobalCV.cellCopdata.GetValue(15),GlobalCV.cellCopdata.GetValue(16),GlobalCV.cellCopdata.GetValue(17) })
},
new Series{
Name = "Actual Deck Works",
Color = Color.FromArgb(62,128,193),// #3E80C1
Data = new Data( new [] { GlobalCV.cellopdata.GetValue(1,1),GlobalCV.cellopdata.GetValue(2,1),GlobalCV.cellopdata.GetValue(3,1),GlobalCV.cellopdata.GetValue(4,1),GlobalCV.cellopdata.GetValue(5,1),GlobalCV.cellopdata.GetValue(6,1),GlobalCV.cellopdata.GetValue(7,1),GlobalCV.cellopdata.GetValue(8,1),GlobalCV.cellopdata.GetValue(9,1),GlobalCV.cellopdata.GetValue(10,1),GlobalCV.cellopdata.GetValue(11,1),GlobalCV.cellopdata.GetValue(12,1),GlobalCV.cellopdata.GetValue(13,1),GlobalCV.cellopdata.GetValue(14,1),GlobalCV.cellopdata.GetValue(15,1),GlobalCV.cellopdata.GetValue(16,1),GlobalCV.cellopdata.GetValue(17,1) })
},
new Series{
Name = "Deck & Concrete Target",
Type =ChartTypes.Line,
Color = Color.FromArgb(131,130,134),// #FFCD1C
Data = new Data( new [] { dCValue, dCValue, dCValue, dCValue, dCValue, dCValue, dCValue, dCValue, dCValue, dCValue, dCValue, dCValue, dCValue, dCValue, dCValue, dCValue, dCValue }),
},
new Series{
Name = "Deck Target",
Type =ChartTypes.Line,
Color = Color.FromArgb(255,205,28),// #FFCD1C
Data = new Data( new [] { dValue, dValue, dValue, dValue, dValue, dValue, dValue, dValue, dValue, dValue, dValue, dValue, dValue, dValue, dValue, dValue, dValue }),
},
new Series{
Name = "Directly Employed Operatives",
Type =ChartTypes.Line,
Color = Color.FromArgb(146,208,80),// "#92D050",
Data = new Data( new [] { dValue1, dValue1, dValue1, dValue1, dValue1, dValue1, dValue1, dValue1, dValue1, dValue1, dValue1, dValue1, dValue1, dValue1, dValue1, dValue1, dValue1 }),
},
}
);
Above code is not working as I merge two types of series: stacked column and line.