Combine bar chart and line chart in excel using C# - c#

I am able to create bar chart and displaying strip line through MS Chart below snap:
Same chart I am trying to create in C# at run time feel like to export the chart in excel. Can anyone guide me how can draw the Strip line on bar chart OR can combine bar chart line chart so line chart seems displaying the strip line.

one possible approach is to add a new series like this:
add a new series to the bar chart, using 2 cells equal to the value where you want to have vertical line (x column in illustration)
select the new series bars and change chart type to X Y (Scatter) - the one with both markers and lines so you can then select it again
edit data range for the new series, so x-values point to your value and y-values to 0 and 1
change the right axis to Minimum: Fixed 0,0, Maximum: Fixed 1,0 and change major tick lines and axis labels to None
remove markers and change line style

Related

Removing Label Legend "Other" in a Pie Chart using RDLC

Is there a way on how to display the original label legend in the pie chart instead of displaying "Other"?
I have a Pie Chart that has 5 Slices each slice has their own data in percent. But I have a problem for some of my data when the last slice which is 5 has 0 data and slices for 1-4 has their data but the Legend displays only the 3 Slice and the 4 & 5 slices display their Legend as "Other".
Please see screenshot below:
Thanks in advance for the help. :)
Click on the actual pie in the chart to select the chart series. In the properties windows expand Custom Attributes.
You will probably have this set to 'Single Slice'. If you change this to 'None' the all slices are shown and displayed on the legend.

Nevron Chart X Axis

I have some charts and want if user zoom into a chart, other charts show the same range on X-axis and left lines of charts fit in a common vertical line(as shown in the picture)
how to that in Nevron charts?
The following code shows how to synchronize the ranges of the x axes as well as how to align the charts left panels:
Synchronize the axis range:
// make axes master slave
chart1.Axis(StandardAxis.PrimaryX).Slaves.Add(chart2.Axis(StandardAxis.PrimaryX));
chart2.Axis(StandardAxis.PrimaryX).Slaves.Add(chart1.Axis(StandardAxis.PrimaryX));
Align the charts:
// align the charts
NSideGuideline guideline = new NSideGuideline(PanelSide.Left);
guideline.Targets.Add(chart1);
guideline.Targets.Add(chart2);
nChartControl1.Document.RootPanel.Guidelines.Add(guideline);

Windows Charts Forms C# Auto labeling of the points on X

I'm having some issues with Windows charts and the points displayed on the x-axis.
I have two plots of data in a line chart based upon set data points, e.g. 200,400,600,800,1000. I also use a 3rd & 4th series to colour areas depending which line is higher. To do this I've had to add extra points where the two lines intersect. This then throws out the labels on the x axis as the chart automatically labels the points something odd such as:
|
|
|
|
=========================
120......370.....590.....730......850
Is there a way I can explicitly specify the datapoints on the axis that I want to use, other than the min-maximum value function?
So you want to customize the X axis labels to match your data? If so you can define custom labels and a customize event to do that. This was posted on StackOverflow by the user Somebody
How to set values in x axis MSChart using C#

Dotnetcharting stacked bar chart displaying like regular bar chart

I have a dotnetcharting chart that I want to display as a Stacked Bar chart, but when it actually displays it shows up as a regular bar chart with the bars next to each other.
I have Chart.YAxis.Scale = Scale.Stacked; and I checked and it is getting set properly. Does anyone know why it isn't working properly?
I found that if you create a new Axis for a Series you have to change the Series's Axis and not the Chart's Axis. So what I needed to do was: timeLossStackedBarChart.SeriesCollection[0].YAxis.Scale = Scale.Stacked;

Dynamic Points with shading

I am programming in C# on VB2010 and I am wanting to shade under the line that is made on my chart. I have a chart with 7 separate values on the X-axis and adjust them with a trackbar for the height on the Y-axis. First I would like to know how to have my line (I'm currently using the Spline type Series chart) display shading under where the line is to the bottom of my chart; and to also have my chart display the new value on the chart immediately after moving the trackbar so that I don't have to click on the chart to update the display.

Categories