4

How to draw a chart which looks exactly the same as one on the picture using C# and .net 4 built-in chart control ? Important are X and Y axis and there markings, and I don't want any graph line, just empty chart.

alt text

I'd be relly grateful for code snipet. Best regards, Primoz.


EDIT: Problems that I have

  • don't know how to put sign for degrees Celsius in the corner
  • dont' know how to put date and time in four hour interval on the X axis

I'm using win forms and bult-in chart control.

2 Answers 2

6

The units for date/time axes are days. Since there are 6 4-hour intervals in a day, to get 4-hour intervals on the X-axis, use AxisX.Interval = 1.0/6;

Alternately, you can set the interval type to hours and then set it to 4:

AxisX.IntervalType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Hours;
AxisX.Interval = 4;

I don't see any obvious way to put the axis name in the corner. You can come close with a hack like this:

var title = new System.Windows.Forms.DataVisualization.Charting.Title("\x00b0C");
title.Position.Y = 90;
title.Position.X = 5;
chart.Titles.Add(title);
Sign up to request clarification or add additional context in comments.

Comments

0

It depends on which technology you prefer. WPF for example has a great support for charting, take a look here: http://wpf.codeplex.com/

Example code: http://www.studentguru.gr/blogs/solidus/archive/2009/10/08/wpf-toolkit-part-1.aspx, http://www.c-sharpcorner.com/UploadFile/mahesh/BarChartWPF11192009112620AM/BarChartWPF.aspx

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.