Rearrange LeafCharter files
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.UI.DataVisualization.Charting;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace LeafWeb.Web.Controllers
|
||||
{
|
||||
public class LeafCharterController : Controller
|
||||
{
|
||||
public ActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult ChartSample()
|
||||
{
|
||||
var chart = new Chart
|
||||
{
|
||||
BackColor = Color.FromArgb(255, 255, 255),
|
||||
Width = Unit.Pixel(250),
|
||||
Height = Unit.Pixel(2500)
|
||||
};
|
||||
|
||||
var series = new Series
|
||||
{
|
||||
ChartArea = "ca1",
|
||||
ChartType = SeriesChartType.Line
|
||||
};
|
||||
|
||||
//series.Font = new Font("Verdana", 8.25f, FontStyle.Regular);
|
||||
|
||||
var myRandom = new Random();
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
var dp = new DataPoint();
|
||||
dp.AxisLabel = String.Format("{0}-{1}", i, Guid.NewGuid().ToString().Substring(0, 4));
|
||||
dp.YValues = new double[] { myRandom.Next(5, 100) };
|
||||
series.Points.Add(dp);
|
||||
}
|
||||
|
||||
|
||||
chart.Series.Add(series);
|
||||
|
||||
var area = new ChartArea("ca1");
|
||||
area.Area3DStyle.Enable3D = false;
|
||||
area.AxisX.Interval = 1;
|
||||
//area.BackColor = Color.Transparent;
|
||||
//var labelStyle = new LabelStyle();
|
||||
//labelStyle.Enabled = true;
|
||||
//labelStyle.Font = new Font("Arial", 3f);
|
||||
area.AxisX.LabelStyle.Font = new Font("Verdana", 8.25f, FontStyle.Underline);//Why does it recognize the style but not the font!!!???
|
||||
|
||||
chart.ChartAreas.Add(area);
|
||||
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
chart.SaveImage(ms, ChartImageFormat.Png);
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
return File(ms.ToArray(), "image/png", "mychart.png");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,61 +38,5 @@ namespace LeafWeb.Web.Controllers
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult LeafCharter()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult ChartSample()
|
||||
{
|
||||
var chart = new Chart
|
||||
{
|
||||
BackColor = Color.FromArgb(255, 255, 255),
|
||||
Width = Unit.Pixel(250),
|
||||
Height = Unit.Pixel(2500)
|
||||
};
|
||||
|
||||
var series = new Series
|
||||
{
|
||||
ChartArea = "ca1",
|
||||
ChartType = SeriesChartType.Line
|
||||
};
|
||||
|
||||
//series.Font = new Font("Verdana", 8.25f, FontStyle.Regular);
|
||||
|
||||
var myRandom = new Random();
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
var dp = new DataPoint();
|
||||
dp.AxisLabel = String.Format("{0}-{1}", i, Guid.NewGuid().ToString().Substring(0, 4));
|
||||
dp.YValues = new double[] { myRandom.Next(5, 100) };
|
||||
series.Points.Add(dp);
|
||||
}
|
||||
|
||||
|
||||
chart.Series.Add(series);
|
||||
|
||||
var area = new ChartArea("ca1");
|
||||
area.Area3DStyle.Enable3D = false;
|
||||
area.AxisX.Interval = 1;
|
||||
//area.BackColor = Color.Transparent;
|
||||
//var labelStyle = new LabelStyle();
|
||||
//labelStyle.Enabled = true;
|
||||
//labelStyle.Font = new Font("Arial", 3f);
|
||||
area.AxisX.LabelStyle.Font = new Font("Verdana", 8.25f, FontStyle.Underline);//Why does it recognize the style but not the font!!!???
|
||||
|
||||
chart.ChartAreas.Add(area);
|
||||
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
chart.SaveImage(ms, ChartImageFormat.Png);
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
return File(ms.ToArray(), "image/png", "mychart.png");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user