Problems with customising
Posted: Mon Jul 26, 2010 2:50 pm
Hi,
I have som problems customising teechart. I would like to end up with the first attached layout. Currently my main problems are:
[*]It doesn't seem possible to remove the border around the chart.[/*]
[*]No matter how I set the Height, Width, Rectangle, AutoSize, Size etc. properties on Chart.Legend I can't seem to control the size of the Legend.[/*]
[*]I would like not to use WebChart if possible.[/*]
The chart is created like this:
My current attached attempt is configured like this:
I am looking forward to hearing from you.
I have som problems customising teechart. I would like to end up with the first attached layout. Currently my main problems are:
[*]It doesn't seem possible to remove the border around the chart.[/*]
[*]No matter how I set the Height, Width, Rectangle, AutoSize, Size etc. properties on Chart.Legend I can't seem to control the size of the Legend.[/*]
[*]I would like not to use WebChart if possible.[/*]
The chart is created like this:
Code: Select all
TChart wc = new TChart();
wc.Axes.Right.Minimum = 0;
FormatChart(wc.Chart);
wds.ApplyToChart(wc.Chart);
// Iterate through each specified series, and apply
// their data to the chart.
foreach (WikiSeriesData cds in wds.Series)
{
// Creata the series for representing this,
Series s = cds.CreateSeries(wc);
// Fill it up with appropriate data,
cds.FillSeries(s, wds);
// And add it to the chart,
wc.Series.Add(s);
}
Guid cacheId = Guid.NewGuid();
// Display the date and time for the graph
wc.Footer.Text = "Generated " + DateTime.Now.ToString();
wc.Export.Image.PNG.Save(GetPhysicalChartPath(cacheId));
// Return the Guid of this new chart,
return cacheId;
Code: Select all
TChart Chart = new TChart();
Chart.Height = 550;
Chart.Width = 710;
Chart.Panel.Gradient.Visible = false;
Chart.Panel.Pen.Visible = false;
Chart.Panel.Color = ColorTranslator.FromHtml("#dbf1fa");
Chart.Header.Font.Size = 12;
Chart.Header.Font.Bold = true;
Chart.Walls.Left.Visible = false;
Chart.Walls.Right.Visible = false;
Chart.Walls.Back.Visible = false;
Chart.Walls.Bottom.Visible = false;
Chart.Axes.Left.Grid.Style = System.Drawing.Drawing2D.DashStyle.Solid;
Chart.Axes.Left.Grid.Color = Color.Black;
Chart.Axes.Left.Ticks.Visible = false;
Chart.Axes.Left.MinorTicks.Visible = false;
Chart.Axes.Left.AxisPen.Visible = false;
Chart.Axes.Bottom.Grid.Visible = false;
Chart.Axes.Bottom.Ticks.Visible = false;
Chart.Axes.Bottom.MinorTicks.Visible = false;
Chart.Axes.Bottom.AxisPen.Color = Color.Black;
Chart.Axes.Bottom.AxisPen.Width = 1;
Chart.Footer.Font.Color = Color.Gray;
Chart.Legend.Visible = true;
Chart.Legend.Shadow.Visible = false;
Chart.Legend.Pen.Visible = false;
Chart.Legend.Color = ColorTranslator.FromHtml("#9edbf1");
Chart.Legend.CustomPosition = false;
Chart.Legend.AutoSize = true;
Chart.Legend.Height = 125;
Chart.Legend.Width = 125;
Chart.Legend.Size.Width = 125;
Chart.Legend.Size.Height = 125;
Chart.Legend.ShapeBounds = new Rectangle(Chart.Legend.ShapeBounds.X, Chart.Legend.ShapeBounds.Y, 125, 125);
Chart.Legend.ResizeChart = true;
Chart.Legend.Symbol.DefaultPen = false;
Chart.Legend.Symbol.Pen.Visible = false;
Chart.Series[0].Color = ColorTranslator.FromHtml("#3db7e4");
Chart.Series[1].Color = ColorTranslator.FromHtml("#053762");
Chart.Series[2].Color = ColorTranslator.FromHtml("#6a0041");
Chart.Series[3].Color = ColorTranslator.FromHtml("#676535");
Chart.Series[4].Color = ColorTranslator.FromHtml("#df8d2f");
Chart.Series[5].Color = ColorTranslator.FromHtml("#24a78f");
Chart.Series[6].Color = ColorTranslator.FromHtml("#c6d644");
Chart.Series[7].Color = ColorTranslator.FromHtml("#cc1c55");
Chart.Series[8].Color = ColorTranslator.FromHtml("#5b3900");
foreach (Series s in Chart.Series)
{
if (s is Line)
((Line)s).LinePen.Width = 4;
}