ASP Chart. Multiple X axis values - c#

I have been trying to have a chart with horizontal bars, with 2 series, one of them has huge values (1000,5000) and the other one tends to have smaller ones (10,100).
Something like this but on horizontal:
ASP Chart with multiple X axis columns
The problem is that I'm unable to have some kind of different range/legend for each one.
The small one stays small, but I would like to have some kind of proportional, having 2 legends on bottom.
How could I do that?
I have tried different things like using this statement:
seriesSmall.XAxisType = AxisType.Secondary;
chart.ChartAreas[0].AxisX2.Maximum = 200
But it did not work out...

seriesSmall.YAxisType = AxisType.Secondary;

Related

How to keep PointWidth fixed and add scrollbar in Range bar Chart

I have a gantt chart contrains tasks.
I declared the PointWidth as 0.25
GanttChart.Series["Tasks"]["PointWidth"] = "0.25";
this works good when I have few tasks but whenever I have more tasks the pointWidth (range) becomes smaller and smaller!
I want to keep it 0.25 and to put scrollbar when there are many tasks.
The CustomProperty PointWidth is in percent of the visible axis.
So with one point the bar or column is really fat and the more data points you add the thinner they will get.
If you want to keep a fixed width while changing the number of data points you need to use PixelPointWidth instead.
Note however that by default now the bars/columns get closer and closer to each other until the overlap.
To give them enough room and show scollbars instead, you need to enable the built-in zooming mechanism as MSChart will not use normal Scrollbars.
This should help:
Series s = chart1.Series[0];
s.SetCustomProperty("PixelPointWidth", "12"); // 12 pixels
var ca = chart1.ChartAreas[0];
ca.AxisX.ScrollBar.Enabled = true;
ca.AxisX.ScaleView.Size = 30; // show a value range of 30
chart1.Refresh(); // usally not needed, but we change a custom property
Note that the ScaleView.Size is in data values. This is the 3rd of the three coordinate system in the chart: percentages, pixels and values! Very powerful and rather tricky..

Oxyplot C# Win Forms - Spreading out data on x axis

I'm plotting relatively large amounts of data (~ 1 million points). The plot is working fine, but it seems that it is forcing all of the points within the viewable window despite default scrolling being enabled.
Any way to make it more readable? E.g. to spread the points out on the x axis. Perhaps zooming? I've looked a while and am rather lost.
You can add the following lines to enable the zooming function.
chart1.ChartAreas[0].CursorX.IsUserEnabled = true;
chart1.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;
chart1.ChartAreas[0].CursorY.IsUserEnabled = true;
chart1.ChartAreas[0].CursorY.IsUserSelectionEnabled = true;
You can certainly choose to zoom only one of the axis.
chart1.ChartAreas[0].AxisX.ScaleView.Zoom(0d, 200d);

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#

how to plot multiple y-axis in chart control

I am creating a web application using c#. I have four values(or series) volt,current,wh and temperature which I will have to plot in a chart control against time which(time) will be shown in x-axis. All things done correctly. But the range of the values are different like one is in range of more than 1000,another lies between 0 to 10,another shows negetive value,etc. I want to create different y-axis for each series.I had created two y-axis which is a property of series(YAxisType),primary and secondary. Is it possible to create multiple y-axis?I had searched in google but didn't get any proper answer. Please help me.
You can only use 2 y-axis(primary and secondary)
But you can create a few chart areas within one chart control
Or you can add a button that will hide one chart control and show another(with others 2 axis)

Dot Net Charting - Stack two series, leave the other as normal bar chart

I have a dotnetcharting graph with 3 series. I can change the style of the whole graph to stacked.
ChartIn.YAxis.Scale = Scale.Stacked;
But I want to just stack two out of the three series. So that for each there are two bars combined into one stack with another whole bar next to it.
Can this be done?
In the end I made the data I wanted separated from the stack into a separate filled line series. Not ideal but it looked fine.
ChartThree.SeriesCollection[3].Type = SeriesType.AreaLine;
The way to accomplish this is by creating an additional scale and setting the extra series's YAxis to that scale. The second scale can be stacked independently of whether or not the first scale is stacked. Note that you will need to adjust the ranges on the second scale in order to make the values show up in the correct relative size.
Here's an example that produces a chart with two separately stacked sets of data (using a chart that has previously been populated with a total of 4 series):
//set main chart to stacked
Chart.YAxis.Scale = Scale.Stacked;
//create new axis, assign it to relevant series, and set it's scale to stacked
Axis a2 = new Axis();
Chart.SeriesCollection[2].YAxis = a2;
Chart.SeriesCollection[3].YAxis = a2;
a2.Scale = Scale.Stacked;
//tie the scales together to ensure proper relative display
Chart.YAxis.SynchronizeScale.Add(a2);

Categories