Can we draw Tertiary Y Axis with the use of chart control - c#

I want to draw a graph which has 2 different Y axis with one X Axis. Can we take different Y axis for different series? In first series I want candlestick graph and in second column chart, both charts should be in same chart area and should not be mixed with each other.
For example you can see the picture below

A ChartArea can have two x-axes and two y-axes.
The secondary axes are called
chartArea.AxisX2
and
chartArea.AxisY2
Enable them like this:
chartArea.AxisY2.Enabled = AxisEnabled.True;
Now you can style them as usual..
You can relate a Series to one of the Axes by setting the AxisType like this:
yourSeries.YAxisType = AxisType.Secondary;
Talking about axes: It is worth knowing that you can move them relative to each other by setting their Crossing; see here for an example..

Related

add space between .net chart and lable

How can I move the labes down?
I would like to add some space between the chart and the labels. It is possible?
I'm using System.Web.UI.DataVisualization.Charting.Chart
Like in this edited in mspaint:
This answer will be under the assumption that you are using CustomLabels on the X-axis:
It is possible, but I am not aware of such a setting. But I can offer a pragmatic solution (i.e. a bit of a hack): Namely you reenable the gridtickmarks on the X-axis, but set Color to Transparent, after that you can adjust the distance to the axis by using MajorTickMark.Size (default 1), the tick marks will not be visible:
chart.ChartAreas[0].AxisX.MajorTickMark.Enabled = true;
chart.ChartAreas[0].AxisX.MajorTickMark.LineColor = Color.Transparent;
chart.ChartAreas[0].AxisX.MajorTickMark.Size = 1;
// You can increase MajorTickMark.Size to increase distance to the axis
And incase someone want to have both visible tickmarks and labels on an axis:
Look into using DataPoint.AxisLabel in your series rather than using CustomLabels on the X-axis. DataPoint.AxisLabel will add a label on the axis for each datapoint. The axis-labels will then have the same distance to the axis as normal interval labels. There is a trick to it, that if the first and last data point in a series have an AxisLabel set the axis interval numbers will be hidden and leave only the axis labels.

Fit as much on the x axis as possible in chart control

I have a chart that has times on X axes. How can I remove the gaps in between the points on the X axes? I think that it might be called interval or scale or something but I'm not sure where in the properties I can find it.
I assume that you are using Microsoft Chart controls and you are trying to fit the "time" labels within the XAxis length.
You can set the LabeAutoFitStyle property of the ChartArea's XAxis as fitted for your requirement. See this MSDN link for different LabelAutoFitStyles.
chart1.ChartAreas[ChartName].AxisX.LabelAutoFitStyle = LabelAutoFitStyles.LabelsAngleStep45;
If you want to change the intervals and number of intervals used in display, use AxisX.Interval and AxisX.IntervalAutoMode property.

vs2010 chart. How to group Y axis value

I have a bar chart. My X-axis are Names and my Y axis are age values. The default bar chart is set to intervals but I want a range (a yes and no chart). I want to make a Y axis displaying something like "under 13", "13-21","+21" and graphing it correctly. How do I do that? I been researching this for a while.
I just need to learn how to do this. But my real project is similar.

Show gridline in chart

I have a c# chart control that shows dates along the horizontal (x) axis. I want to show gridlines only on thosex axis points that represent the start of the month. How may I do this.
I guess you mean mscharts so it could be
chartArea.AxisX.MinorGrid.Enabled = false;
The ones corresponding to the datapoints is the MajorGrid which can also be toggled similarly.
you can also do the same for the Y axis too.

Microsoft Chart Controls: Label multiple y values and variable y axis?

I am currently using Microsoft Chart Controls to generate a box plot chart. I have enabled the IsValueShownAsLabel property of the chart's series, but only the first y-value(lower whisker) value is being labeled. Is there a way to enable the labeling of all y-values in the chart?
Also, is there a way to get a different axis for each data point? The different data points of the chart are not related when it comes to value ranges, so many data points with small y-values are difficult to read on the chart. I have currently enabled scrolling as a workaround, but am not satisfied with the result. I would instead like to have a different y-axis for each data point, so that the y-values for each data point take up the full height of the chart, with the min and max whisker values serving as the y-axis minimum and maximum points. Is this possible?
To get different axis you will need to look into the properties under ScaleBreakStyle under AxisY
Set something like
Chart1.ChartAreas[0].AxisY.ScaleBreakStyle.Enabled = true;
Chart1.ChartAreas[0].AxisY.ScaleBreakStyle.BreakLineStyle = Charting.BreakLineStyle.Wave;
// set this to an even lower value if required
Chart1.ChartAreas[0].AxisY.ScaleBreakStyle.CollapsibleSpaceThreshold = 15;
Not sure on how to get multiple values but can you try setting those values specifically to the labels in these format #VALY1,#VALY2 depending on the number of Y values available.

Categories

Resources