How to force displaying specific dates on DateTimeAxis - c#

Is it possible to force the display of grid lines on the chart with the dates for the extreme data points?
I've tried almost every configuration of following Chart DateTimeAxis properties: IntervalType, Interval, Minimum and Maximum but I wasn't satisfied with the result.
Setting properties Minimum and Maximum didn't solve the problem.
For instance (IntervalType="Days" , Interval="4" , Minimum="1/1/2010" , Maximum="1/31/2010"):
If I'm lucky I will generate some random data where only one extreme point will have the date with grid line.
Does somebody have an idea how to solve the problem mentioned above?
Edited to add
I added a bounty to this question since I really need a fast solution for this issue.
I am binding a series of specific pairs to my chart and I'd like to display excactly those given DateTime values on the x-axis.
Since these are usually dates like 6/30/11, 6/30/12 and so on, I can't use the Interval/IntervalType properties because adding 1 year or 365 days to 6/30/11 doesn't necessarily result in 6/30/12.
So what I need to do is either disable the "automatic axis label generation" of the DateTime axis or use another axis type.
LinearAxis doesn't work because it expects double values and CategoryAxis is not an option because it displays the axis labels between two tickmarks instead of underneath them.
I am very grateful for any help!
To be perfectly clear, here is what axis labels I need (taken from another chart component):
This is what I get so far with the Silverlight 4 Toolkit:
€: I also opened a thread in the official Silverlight Toolkit Support Forums.

The vertical lines are set where you specify an interval.
There is no vertical line for the data for 1/31/2010 as it does not fall on an interval.

Related

Formatting numbers on a graph on the horizontal axis in reporting services SSRS

I am working with report services from Visual Studio 2019 and I am making a stacked bar type chart where I need to format the values to percentage, and indeed I have been able to do it but I can not format the horizontal axis, it shows me very large numbers, I have tried in axis properties > axis range and interval, but putting an interval, maximum, etc, has not worked I am already losing my mind, I have searched many sites where the different solutions do not work for me.
I need to show in the horizontal axis values like 0, 20, 40, 60, etc... but as you can see they are too big values, is there any way to format those numbers to show me only the first two digits or something like that? I can not make a division for that because the data is varying, if someone has gone through the same please I need your help, thank you very much.
On the Horizontal Axis properties, you can set the LabelsFormat property in the Property pane or the Custom Format in the Property pop-up to be dynamic based on the values.
=SWITCH(MAX(Fields!DATA.Value) > 1000000, "0,,M;(0,,)M",
MAX(Fields!DATA.Value) > 1000, "0,K;(0,)K",
1 = 1, "0,;(0,)")
This will show values in the millions as 1M, 2M, etc. while thousands would be displayed as 1K, 2K...
The expression ( MAX(Fields!DATA.Value) ) will vary based on the charts' data.

Axis values formatting for chart

In my WinForms project I use the standard Chart control (from the VS toolbox) to display pressure versus time. It must be possible to zoom the graph. This works fine, but the X-axis values in the zoomed graph shows the values in a lot of decimals:
Does anyone have an idea what I can show the values in a better format? For example, in the above graph I would see labels like: 8.00, 10.00, 12.00? I can also live with values like: 7.98, 9.98, 11.98, so with a limited number of decimals.
I've looked in the control designers for the Chart control where I can specify a format string or the number of decimals, but I could not find it.
There is nothing special for this chart. It shows 2 series (not easy to see but you could probably see a blue and a green line). I use for both series the FastLine type of graph. I enabled the zooming by setting IsUserEnabled and IsUSerSelection to true for CursorX and CursorY in the graph designer. As said, this works, but I could not spot a property to customize the format of the values.
Set the LabelStyle.Format property:
chart1.ChartAreas[0].AxisX.LabelStyle.Format = "0.00";
Or
chart1.ChartAreas[0].AxisX.LabelStyle.Format = "{0:0.00}";

Wpf Charting with x axis as time in minutes for one day and y axis as variable inputs range is not specified?

I need x axis as time in minutes as 00:00, 00:01, 00:02 ,00:03 ....00:60,01:00,...59:50,...59:59,00:00
if possible to show current date from system date time. and the x axis has to move to left for the whole day. and continue so on.
and y axis 0 to 65324 or may vary accordingly depending on the points it reads but i thik that is the max limit.
How to draw a line chart in wpf with a free source control?
I have tried to worked with WPF Toolkit but not able to find a solution
and now iam using Dynamic Data Display (D3) which is easy but i dont have this type of example.
You can use OxyPlot. It's free, and I've used it in several of my projects.
You can start with the official page, but here's a good example that will set you on the right trail:
line chart + live data.
You'll have to modify the axis a bit, but it's not too dificult.
Here's a screenshot from the above link:

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)

.NET Chart control - dynamically change y-axis interval

I have a bar graph displaying a number of different series (stacked on each other) and I'm trying to find a way to dynamically change the y-axis interval if the values go above a set value.
If the bars only go up to a maximum of 50, I'd like the interval to be 25 so the bars still 'look' rather small. But if a large spike comes through, the interval needs to be set to 0 so the large spike is more noticeable.
Oh, and this is in C# .NET 3.5
I hope that makes sense :)
Thanks in advance
This is pretty much feasible by tweaking both the size of the axis and the relative intervals dynamically by updating the right properties. Default control behavior is rescaling the axis to adapt to the dataset so this should be no problem (works well for me)
Take a look at the Axis Class MSDN Reference, especially the Interval and IntervalAutoMode Properties. (the MSDN in pretty exhaustive on chart control if you dig enough you'll find everything you might need).
besides I HEAVILY advice you to download the very complete sample application
and play around with it locally. It is pretty exhaustive and you'll have the complete source at hand.
Set IntervalAutoMode="Variable Count" and dint mention any axis interval in the Axis Y element of the chart Area of that chart,it will adjust according to the maximum value.

Categories