I want this stacked column chart Demo column stacked with this Basic Column with line. What i want is have a line in this stacked column chart.
Note: I've found this example already present in stackoverflow, Stacked bar with line, but can't really make it a stacked column with line.
I'm using HighCharts .Net plugin, my code for stacked bar is:
Highcharts chart = new Highcharts("chart");
chart.SetSeries(new[]
{
new Series { Name = "Title1", Data = new Data(data1) },
new Series { Name = "Title2", Data = new Data(data2) },
new Series { Name = "Title3", Data = new Data(data3) },
new Series { Name = "Title4", Data = new Data(data4) }
});
chart.InitChart(new Chart {DefaultSeriesType = ChartTypes.Column});
chart.SetTitle(new Title{Text = "Graph title" });
chart.SetXAxis(new XAxis { Categories = xaxis });
chart.SetYAxis(new YAxis
{
Min = 0,
Title = new YAxisTitle { Text = "Total hit" },
StackLabels = new YAxisStackLabels
{
Enabled = true,
Style = "fontWeight: 'bold', color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'"
}
});
chart.SetLegend(new Legend
{
Layout = Layouts.Horizontal,
Align = HorizontalAligns.Right,
VerticalAlign = VerticalAligns.Top,
X = -100,
Y = 20,
Floating = true,
BackgroundColor = new BackColorOrGradient(ColorTranslator.FromHtml("#FFFFFF")),
BorderColor = ColorTranslator.FromHtml("#CCC"),
BorderWidth = 1,
Shadow = false
});
chart.SetPlotOptions(new PlotOptions
{
Column = new PlotOptionsColumn
{
Stacking = Stackings.Normal,
DataLabels = new PlotOptionsColumnDataLabels
{
Enabled = true,
Color = Color.White
}
}
});
ltrChart.Text = chart.ToHtmlString();
Can anyone help on this?
Here is a solution with plain JS.
HTML:
JS:
I made a JS fiddle with this example. You can check it here