remove white spaces below winforms graph - c#

I have created a chart in winforms and host it in WPF using winformhost. When I am implementing this in wpf, there is a space below my graph. If I reduce the size of chart, chart becomes small. How to remove that space below the graph?
Here is my code.
XAML.cs
var chartArea = new ChartArea("EQGraph");
Chart chart1 = this.FindName("EQGraph") as Chart;
chart1.ChartAreas.Add("EQGraph");
chart1.Series.Add("Front Left");
chart1.ChartAreas[0].AxisX.Maximum = 20000;
chart1.ChartAreas[0].AxisX.Minimum = 10;
chart1.ChartAreas[0].AxisX.IsLogarithmic = true;
chart1.ChartAreas[0].AxisX.MinorGrid.Interval = 1;
chart1.ChartAreas[0].AxisX.MinorGrid.Enabled = true;
chart1.ChartAreas[0].AxisY.Maximum = 20;
chart1.ChartAreas[0].AxisY.Minimum = -50;
chart1.ChartAreas[0].AxisY.Interval = 5;
chart1.ChartAreas[0].AxisX.MinorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.DashDotDot;
chart1.ChartAreas[0].AxisY.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.DashDotDot;
chart1.ChartAreas[0].AxisX.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 10F, System.Drawing.FontStyle.Bold);
chart1.ChartAreas[0].AxisY.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 10F, System.Drawing.FontStyle.Bold);
chart1.ChartAreas[0].AxisX.Title = "Frequency(Hz)";
chart1.ChartAreas[0].AxisY.Title = "Gain";
int[] xValuesFrontLeft = { 10, 100, 1000, 5000, 4200, 8499 };
int[] yValuesFrontLeft = { 16, 10, -5, -10, 35, -40 };
chart1.Series["Front Left"].Points.DataBindXY(xValuesFrontLeft, yValuesFrontLeft);
chart1.Series["Front Left"].ChartType = SeriesChartType.Spline;
XAML
<DockPanel Grid.Column="3" Grid.Row="1" Grid.RowSpan="9" Background="#FFFBF9F9">
<WindowsFormsHost x:Name="host" Height="500">
<winformchart:Chart x:Name="EQGraph" Dock="Fill">
<winformchart:Chart.Series >
<winformchart:Series Name="series" ChartType="Line"/>
</winformchart:Chart.Series>
<winformchart:Chart.ChartAreas>
<winformchart:ChartArea/>
</winformchart:Chart.ChartAreas>
</winformchart:Chart>
</WindowsFormsHost>
</DockPanel>

I don't think you need to create new ChartArea to place your graph, because your graph is placed inside WindowsFormsHost in XAML already, and it's docked, so it will be the same size as it's host. Use that chart like this:
// Remove these lines
// var chartArea = new ChartArea("EQGraph");
// Chart chart1 = this.FindName("EQGraph") as Chart;
// chart1.ChartAreas.Add("EQGraph");
// Now you will be adding values, series and properties to your graph inside WinFormsHost
Chart chart1 = EQGraph;
You could also replace chart1 with EQGraph inside your code directly, at all places:
EQGraph.Series.Add("Front Left");
EQGraph.ChartAreas[0].AxisX.Maximum = 20000;
EQGraph.ChartAreas[0].AxisX.Minimum = 10;
EQGraph.ChartAreas[0].AxisX.IsLogarithmic = true;
EQGraph.ChartAreas[0].AxisX.MinorGrid.Interval = 1;
EQGraph.ChartAreas[0].AxisX.MinorGrid.Enabled = true;
EQGraph.ChartAreas[0].AxisY.Maximum = 20;
EQGraph.ChartAreas[0].AxisY.Minimum = -50;
EQGraph.ChartAreas[0].AxisY.Interval = 5;
EQGraph.ChartAreas[0].AxisX.MinorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.DashDotDot;
EQGraph.ChartAreas[0].AxisY.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.DashDotDot;
EQGraph.ChartAreas[0].AxisX.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 10F, System.Drawing.FontStyle.Bold);
EQGraph.ChartAreas[0].AxisY.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 10F, System.Drawing.FontStyle.Bold);
EQGraph.ChartAreas[0].AxisX.Title = "Frequency(Hz)";
EQGraph.ChartAreas[0].AxisY.Title = "Gain";
int[] xValuesFrontLeft = { 10, 100, 1000, 5000, 4200, 8499 };
int[] yValuesFrontLeft = { 16, 10, -5, -10, 35, -40 };
EQGraph.Series["Front Left"].Points.DataBindXY(xValuesFrontLeft, yValuesFrontLeft);
EQGraph.Series["Front Left"].ChartType =SeriesChartType.Spline;

Related

Viewing applications in WPF with errors

I have an application that breaks the image when the screen size changes
Below is the screen
Where can the mistake be? What can cause this situation? I do not even know where to look because it is not a permanent error only once and once is gone
This is how I load items with a line and number per view:
<ItemsControl ItemsSource="{Binding ConnectorsGridsHorizontal, Mode=TwoWay}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Grid />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
Function drawing 1 element:
public Grid DrawConnector1(Thickness margin, int nr, bool rotate, bool rightSide)
{
Grid grid = new Grid();
grid.Margin = margin;
grid.HorizontalAlignment = HorizontalAlignment.Left;
grid.Width = S10;
grid.Height = 128;
grid.VerticalAlignment = System.Windows.VerticalAlignment.Center;
Line line = new Line();
line.X1 = S10HALF;
line.X2 = S10HALF;
line.Y1 = 0;
line.Y2 = 128;
line.StrokeDashArray = new System.Windows.Media.DoubleCollection() { 4, 2, 1, 2 };
line.Stroke = System.Windows.Media.Brushes.Green;
line.StrokeThickness = 4;
grid.Children.Add(line);
Grid inGrid = new Grid();
inGrid.Width = S10;
inGrid.Height = HF;
inGrid.Background = System.Windows.Media.Brushes.Black;
grid.Children.Add(inGrid);
Border br = new Border();
br.BorderThickness = new Thickness(0);
br.CornerRadius = new CornerRadius(10);
br.Background = System.Windows.Media.Brushes.White;
br.Margin = new Thickness(-10, -10, -10, -10);
br.Width = 20;
br.Height = 20;
br.VerticalAlignment = rightSide ? VerticalAlignment.Top : VerticalAlignment.Bottom;
br.RenderSize = new System.Windows.Size(br.ActualWidth + 1, br.ActualHeight + 1);
if (SelectedConnector + 1 == nr) br.Background = System.Windows.Media.Brushes.Green;
else br.Background = System.Windows.Media.Brushes.White;
if (DisableGreenMark) br.Background = System.Windows.Media.Brushes.White;
TextBlock txtBlock = new TextBlock();
txtBlock.FontSize = 16;
txtBlock.Text = nr.ToString();
txtBlock.Foreground = new SolidColorBrush(Colors.Black);
txtBlock.VerticalAlignment = VerticalAlignment.Center;
txtBlock.HorizontalAlignment = HorizontalAlignment.Center;
br.Child = txtBlock;
grid.Children.Add(br);
Binding b = new Binding("S60_20");
b.Mode = BindingMode.Default;
grid.SetBinding(Canvas.TopProperty, b);
return grid;
}
GIF:
I'm also using SnapsToDevicePixels="true"
To start with, try doing this:
br.HorizontalAlignment = HorizontalAlignment.Stretch;
br.Margin = new Thickness(0, 0, 0, 0);
Do not use margin with a negative value
Stretch will provide you with an element extension
Side cut is probably caused by too narrow a strip for the element:
You have:
grid.Width = S10;
line.X1 = S10HALF;
line.X2 = S10HALF;
This indicates that you have the width set to probably 10
and Here you have set to 20
br.Width = 20;
br.Height = 20;
I also suggest changing here:
grid.Width = S10 * 2;
line.X1 = S10HALF * 2;
line.X2 = S10HALF * 2;

ImageMagick create circle count on top of image

Hey all I have the following Magick.net code:
List<string> lFiles = new List<string>();
bool isBlankImage = false;
lFiles.Add(#"C:\Users\David\Pictures\1.jpg");
lFiles.Add(#"C:\Users\David\Pictures\blank.png");
lFiles.Add(#"C:\Users\David\Pictures\blank.png");
lFiles.Add(#"C:\Users\David\Pictures\blank.png");
lFiles.Add(#"C:\Users\David\Pictures\blank.png");
IMagickImage roundImg = new MagickImage();
IMagickImage mask = new MagickImage();
IMagickImage shadow = new MagickImage();
IMagickImage result = new MagickImage();
foreach (string tempFBProfileImg in lFiles)
{
roundImg = new MagickImage(tempFBProfileImg);
if (Regex.IsMatch(tempFBProfileImg.ToLower(), #"\bblank.png\b"))
{
result.Extent(360, 100, Gravity.West);
images.Add(result);
isBlankImage = true;
break;
}
else
{
mask = new MagickImage("xc:black", 100, 100);
mask.Settings.FillColor = MagickColors.White;
mask.Draw(new DrawableCircle(50, 50, 50, 90));
mask.HasAlpha = false;
roundImg.Resize(100, 100);
roundImg.Composite(mask, CompositeOperator.CopyAlpha);
roundImg.Draw(new DrawableStrokeColor(MagickColors.Black),
new DrawableStrokeWidth(1),
new DrawableFillColor(MagickColors.None),
new DrawableCircle(50, 50, 50, 90));
shadow = new MagickImage("xc:none", 100, 100);
shadow.Settings.FillColor = MagickColors.Black;
shadow.Draw(new DrawableCircle(50, 50, 50, 90));
shadow.Blur(0, 5);
roundImg.Composite(shadow, CompositeOperator.DstOver);
images.Add(roundImg);
images.First().BackgroundColor = MagickColors.None;
result = images.SmushHorizontal(-35);
result.Resize(100, 100);
result.Write(#"C:\Users\David\Pictures\final2.png");
}
}
var imgText = new MagickImage(MagickColors.Blue, 0, 0);
imgText.Settings.FontPointsize = 24;
imgText.BackgroundColor = MagickColors.White;
imgText.Settings.FillColor = MagickColors.Black;
imgText.Settings.TextAntiAlias = true;
imgText.Settings.FontFamily = "Arial";
imgText.Read("label: 10+", 45, 25);
string caption = "label:10+";
//imgText = new MagickImage(caption, settings);
//imgText.Draw(new DrawableText(100, 20, "10+"));
imgText.Page = new MagickGeometry(300, 100, 0, 0);
result.Composite(imgText, CompositeOperator.Over);
result.Write(#"C:\Users\David\Pictures\final2.png");
And this comes out looking like this:
But what I am looking to want it to look like is this:
I'm having issues with just making a red circle with a black outline and shadow with the text XX+ inside it. Also, I've looked high and low to find out how i can position it where I need it but I am unable to find it. I thought that MagickGeometry would be it but it turns out that its not.
Update 1
Changing some code I now get this:
Changed code:
roundImg.Composite(mask, CompositeOperator.CopyAlpha);
roundImg.Draw(new DrawableStrokeColor(MagickColors.Black),
new DrawableStrokeWidth(1),
new DrawableFillColor(MagickColors.None),
new DrawableCircle(50, 50, 50, 90));
imgText.Composite(roundImg, CompositeOperator.Over);
imgText.Settings.FontPointsize = 24;
imgText.BackgroundColor = MagickColors.Red;
imgText.Settings.FillColor = MagickColors.White;
imgText.Settings.TextAntiAlias = true;
imgText.Settings.FontFamily = "Arial";
imgText.Read("label: 10+", 45, 25);
//string caption = "label:This is a very long caption line";
//imgText = new MagickImage(caption, settings);
//imgText.Draw(new DrawableText(100, 20, "10+"));
imgText.Page = new MagickGeometry(360, 100, 0, 0);
result.Composite(imgText, CompositeOperator.Over);
result.Write(#"C:\Users\David\Pictures\final2.png");
update 2
Ok I have the code correct for the round circle with number in it:
MagickImage circleText = new MagickImage(MagickColors.Transparent, 29, 29);
MagickImage circle = new MagickImage(MagickColors.Transparent, 29, 29);
circleText.Settings.BorderColor = MagickColors.Black;
circleText.Settings.FontPointsize = 16;
circleText.Settings.FontWeight = ImageMagick.FontWeight.Bold;
circleText.BackgroundColor = MagickColors.Transparent;
circleText.Settings.FillColor = MagickColors.White;
circleText.Settings.TextGravity = Gravity.Center;
circleText.Settings.TextAntiAlias = true;
circleText.Settings.FontFamily = "Arial";
circleText.Border(2);
circleText.Read("label: 10+", 29, 29);
circle.Draw(new DrawableStrokeColor(MagickColors.Black),
new DrawableStrokeWidth(1),
new DrawableFillColor(MagickColors.Red),
new DrawableCircle(14, 14, 10, 1));
circleText.Composite(circle, CompositeOperator.DstOver);
result.Composite(circleText, CompositeOperator.Over);
result.Write(#"C:\Users\David\Pictures\final2.png");
Which produces the image:
But now I can not seem to get the border for the text to show up and I'm still stuck on how to move the circle to its intended spot?
update 3
I finally got it to move over where I need it to be using this code:
MagickImage circleText = new MagickImage(MagickColors.Transparent, 29, 29);
MagickImage circle = new MagickImage(MagickColors.Transparent, 29, 29);
MagickImage _shadow = new MagickImage();
circleText.Settings.BorderColor = MagickColors.Black;
circleText.Settings.FontPointsize = 16;
circleText.Settings.FontWeight = ImageMagick.FontWeight.Bold;
circleText.BackgroundColor = MagickColors.Transparent;
circleText.Settings.FillColor = MagickColors.White;
circleText.Settings.TextGravity = Gravity.Center;
circleText.Settings.TextAntiAlias = true;
circleText.Settings.FontFamily = "Arial";
circleText.Border(2);
circleText.Read("label: 10+", 29, 29);
circle.Draw(new DrawableStrokeColor(MagickColors.Black),
new DrawableStrokeWidth(1),
new DrawableFillColor(MagickColors.Red),
new DrawableCircle(14, 14, 10, 1));
_shadow = new MagickImage("xc:none", 29, 29);
_shadow.Settings.FillColor = MagickColors.Black;
_shadow.Draw(new DrawableCircle(14, 14, 10, 1));
_shadow.Blur(0, 15);
circle.Composite(_shadow, CompositeOperator.DstOver);
circleText.Composite(circle, CompositeOperator.DstOver);
result.Composite(circleText, 68, 9, CompositeOperator.Over);
result.Write(#"C:\Users\David\Pictures\final2.png");
BUT when I try to add the shadow to the circle it comes out looking like this:
Not sure why the shadow is coming out being a square when its using the exact circle x,y,w,h as the original red circle...

How do i adjust the Y Axis scale for the line chart using c#

I am using System.Web.UI.DataVisualization.Charting to generate line chart which I am populating at run-time. Y axis of the graph is a percent value that currently scales from -150% to +150%. I want to adjust the scale so that Y Axis label will always scale from -100% to +100%. Any help is appreciated. Thank you.
This is the sample code i have for the chart:
Chart c = new Chart();
c.AntiAliasing = AntiAliasingStyles.All;
c.TextAntiAliasingQuality = TextAntiAliasingQuality.High;
c.Width = 800;
c.Height = 450;
ChartArea ca = new ChartArea();
ca.Position.X = 0;
ca.Position.Y = 10;
ca.Position.Width = 100;
ca.Position.Height = 80;
ca.BackColor = Color.FromArgb(248, 248, 248);
ca.BackSecondaryColor = Color.FromArgb(255, 255, 255);
ca.BackGradientStyle = GradientStyle.TopBottom;
ca.AxisY.IsMarksNextToAxis = true;
ca.AxisY.LineColor = Color.FromArgb(157, 157, 157);
ca.AxisY.MajorTickMark.Enabled = true;
ca.AxisY.MajorTickMark.LineColor = Color.FromArgb(157, 157, 157);
ca.AxisY.LabelStyle.ForeColor = Color.FromArgb(89, 89, 89);
ca.AxisY.LabelStyle.Format = "{0:p}";
ca.AxisY.LabelStyle.IsEndLabelVisible = true;
ca.AxisY.Interval = 1;
ca.AxisY.LabelStyle.Font = new Font("Calibri", 4, FontStyle.Regular);
ca.AxisY.MajorGrid.LineColor = Color.FromArgb(234, 234, 234);
ca.AxisX.IsMarksNextToAxis = true;
ca.AxisX.LineColor = Color.FromArgb(157, 157, 157);
ca.AxisX.MajorTickMark.Enabled = true;
ca.AxisX.MajorTickMark.LineColor = Color.FromArgb(157, 157, 157);
ca.AxisX.LabelStyle.IsEndLabelVisible = true;
ca.AxisX.LabelStyle.ForeColor = Color.FromArgb(89, 89, 89);
ca.AxisX.MajorGrid.LineWidth = 0;
ca.AxisX.IsMarginVisible = false;
ca.AxisX.Interval = 0;
c.ChartAreas.Add(ca);
List<RawData> rawData = (List<RawData>)rawDataDao.GetDataByDateRange(start.Value, end.Value);
if(rawData.Count > 0)
{
Series s = new Series();
s.Font = new Font("Lucida Sans Unicode", 6f);
s.Color = System.Drawing.ColorTranslator.FromHtml(GetCombinedColorByIndex(possibleSensors.IndexOf(sensor)));
s.BorderColor = Color.FromArgb(159, 27, 13);
s.BackSecondaryColor = Color.FromArgb(173, 32, 11);
s.BackGradientStyle = GradientStyle.LeftRight;
s.ChartType = SeriesChartType.Line;
s.XValueType = ChartValueType.DateTime;
s.Name = sensor.SensorName;
foreach (RawData d in workingRawData)
{
System.DateTime x = DateTime.Parse(d.Dt.Value.ToString("", CultureInfo.CreateSpecificCulture("en-US")));
DataPoint p = new DataPoint(x.ToOADate(), Convert.ToDouble(d.Reading));
p.AxisLabel = d.Dt.Value.ToString();
s.Points.Add(p);
}
c.Series.Add(s);
}
If the axis is zoomable, set the scaleview to the range you need
ca.AxisY.ScaleView.Zoom(-100, 100);

Chart without Axis Lines

I'm trying to create chart programmatically. Here is code
static void Main(string[] args)
{
var xvals = new[]
{
new DateTime(2012, 4, 4),
new DateTime(2012, 4, 5),
new DateTime(2012, 4, 6),
new DateTime(2012, 4, 7)
};
var yvals = new[] { 1, 3, 7, 12 };
// create the chart
var chart = new Chart();
chart.Width = 600;
chart.Height = 350;
var chartArea = new ChartArea();
chartArea.AxisX.IsMarginVisible = false;
chartArea.AxisY.IsMarginVisible = false;
chartArea.AxisX.LabelStyle.Format = "dd";
chartArea.AxisX.MajorGrid.LineWidth = 0;
chartArea.AxisY.MajorGrid.LineWidth = 0;
chartArea.AxisY.LabelStyle.Font = new Font("Consolas", 8);
chartArea.AxisX.LabelStyle.Font = new Font("Consolas", 8);
chart.ChartAreas.Add(chartArea);
var series = new Series();
series.Name = "Series1";
series.ChartType = SeriesChartType.Line;
chart.Series.Add(series);
chart.Series["Series1"].Points.DataBindXY(xvals, yvals);
chart.SaveImage("chart.png", ChartImageFormat.Png);
}
I'm getting following output,
How can I remove Axis Lines both X and Y? So that my output will only the blue line.
chartArea.AxisY.LineWidth = 0;
chartArea.AxisX.LineWidth = 0;
chartArea.AxisX.LabelStyle.Enabled = false;
chartArea.AxisY.LabelStyle.Enabled = false;
chartArea.AxisX.MajorTickMark.Enabled = false;
chartArea.AxisY.MajorTickMark.Enabled = false;
Fixed my problem

Specific way to show a serie in MSChart using c#

I wonder if there is any way to show this serie as follows, the chartype is column.
I'm aware that I need an (X,Y) pair to show the datapoint in the graph, but the thing is that I need to show a Y value in a range of x, to clarify this, let's put an example:
The X axis shows the hours and Y axis production values, in this case the production started at 7:30, so from 7:30 to 8 the production was let's say 20 units; from 8-9, 60 units; 9-10, 45 units and from 10-10:35 18 units.
Can I accomplish that with MSChart, or perhaps any other one that you guys suggest me? This is a winform app.
Thanks
You should take a look at the MS Chart site. The Downloads tab has WinForms examples that you can download as a WinForms project, run in Visual Studio, and view the code for the chart you want. The Chart controls are included with .Net 4, but can be downloaded and added as a reference for .Net 3.5.
What you want is a Column chart. You set the values as a series on the chart, and then you can pick the width of the column to show the range of x-values you want.
The basic idea is you create a Chart, ChartArea, and Series, and optionally a Title and Legend.
You add one or more Series objects to the ChartArea, then add the ChartArea, Title, and Legend to the Chart.
You add DataPoints individually to the Series, as in the example below, or you set the Chart.DataSource to something like a DataTable and use DataBinding.
Here's a snippet from the Column Chart example:
System.Windows.Forms.DataVisualization.Charting.Chart chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.DataPoint dataPoint1 = new System.Windows.Forms.DataVisualization.Charting.DataPoint(36890, 32);
System.Windows.Forms.DataVisualization.Charting.DataPoint dataPoint2 = new System.Windows.Forms.DataVisualization.Charting.DataPoint(36891, 56);
System.Windows.Forms.DataVisualization.Charting.DataPoint dataPoint3 = new System.Windows.Forms.DataVisualization.Charting.DataPoint(36892, 35);
System.Windows.Forms.DataVisualization.Charting.DataPoint dataPoint4 = new System.Windows.Forms.DataVisualization.Charting.DataPoint(36893, 12);
System.Windows.Forms.DataVisualization.Charting.DataPoint dataPoint5 = new System.Windows.Forms.DataVisualization.Charting.DataPoint(36894, 35);
System.Windows.Forms.DataVisualization.Charting.DataPoint dataPoint6 = new System.Windows.Forms.DataVisualization.Charting.DataPoint(36895, 6);
System.Windows.Forms.DataVisualization.Charting.DataPoint dataPoint7 = new System.Windows.Forms.DataVisualization.Charting.DataPoint(36896, 23);
System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.Title title1 = new System.Windows.Forms.DataVisualization.Charting.Title();
chart1.BackGradientStyle = System.Windows.Forms.DataVisualization.Charting.GradientStyle.TopBottom;
chart1.BorderlineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Solid;
chart1.BorderlineWidth = 2;
chart1.BorderSkin.SkinStyle = System.Windows.Forms.DataVisualization.Charting.BorderSkinStyle.Emboss;
chartArea1.Area3DStyle.Inclination = 15;
chartArea1.Area3DStyle.IsClustered = true;
chartArea1.Area3DStyle.IsRightAngleAxes = false;
chartArea1.Area3DStyle.Perspective = 10;
chartArea1.Area3DStyle.Rotation = 10;
chartArea1.Area3DStyle.WallWidth = 0;
chartArea1.AxisX.LabelAutoFitMaxFontSize = 8;
chartArea1.AxisX.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 8.25F, System.Drawing.FontStyle.Bold);
chartArea1.AxisX.LabelStyle.Format = "MM-dd";
chartArea1.AxisX.LabelStyle.IsEndLabelVisible = false;
chartArea1.AxisX.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
chartArea1.AxisX.MajorGrid.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
chartArea1.AxisY.LabelAutoFitMaxFontSize = 8;
chartArea1.AxisY.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 8.25F, System.Drawing.FontStyle.Bold);
chartArea1.AxisY.LabelStyle.Format = "C0";
chartArea1.AxisY.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
chartArea1.AxisY.MajorGrid.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
chartArea1.BackColor = System.Drawing.Color.OldLace;
chartArea1.BackGradientStyle = System.Windows.Forms.DataVisualization.Charting.GradientStyle.TopBottom;
chartArea1.BackSecondaryColor = System.Drawing.Color.White;
chartArea1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
chartArea1.Name = "Default";
chartArea1.ShadowColor = System.Drawing.Color.Transparent;
chart1.ChartAreas.Add(chartArea1);
legend1.BackColor = System.Drawing.Color.Transparent;
legend1.Enabled = false;
legend1.Font = new System.Drawing.Font("Trebuchet MS", 8.25F, System.Drawing.FontStyle.Bold);
legend1.IsTextAutoFit = false;
legend1.Name = "Default";
chart1.Legends.Add(legend1);
chart1.Location = new System.Drawing.Point(16, 64);
chart1.Name = "chart1";
series1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(26)))), ((int)(((byte)(59)))), ((int)(((byte)(105)))));
series1.ChartArea = "Default";
series1.Legend = "Default";
series1.Name = "Series1";
series1.Points.Add(dataPoint1);
series1.Points.Add(dataPoint2);
series1.Points.Add(dataPoint3);
series1.Points.Add(dataPoint4);
series1.Points.Add(dataPoint5);
series1.Points.Add(dataPoint6);
series1.Points.Add(dataPoint7);
series1.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime;
chart1.Series.Add(series1);
chart1.Size = new System.Drawing.Size(412, 296);
chart1.TabIndex = 0;
title1.Font = new System.Drawing.Font("Trebuchet MS", 14.25F, System.Drawing.FontStyle.Bold);
title1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(26)))), ((int)(((byte)(59)))), ((int)(((byte)(105)))));
title1.Name = "Title1";
title1.ShadowColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
title1.ShadowOffset = 3;
title1.Text = "Column Chart";
chart1.Titles.Add(title1);

Categories