Revision: 58642
Updated Code
at July 26, 2012 19:43 by ptomas
Updated Code
// kodas chtml faile:
// <img src="@Url.Action("grafikas")" alt="Drawing chart with HTML Helper" />
// kodas kontroleryje:
[ActionName("grafikas")] // ---------------- galima keist path pagal regionus!
//[OutputCache(Duration = 3)] // ------------ jei nustatomas keshavimas, kai issaugot bandai gaunasi .bmp failas
public ActionResult DrawChart()
{
/*
* reikia pasiimt i������¡ sistemos userio Guid, tai nereik����¯�¿�½s nieko perduot per parametrus!!!
*/
string[] arrYvalues = new string[10];
string[] arrXvalues = new string[10];
Random rn = new Random();
for (int i = 1; i < 10; i++)
{
arrXvalues[i] = i.ToString();
arrYvalues[i] = i.ToString() + rn.Next(10).ToString();
}
string myTheme =
@"<Chart BackColor=""255, 255, 255"" >
<ChartAreas>
<ChartArea Name=""Default"" BorderColor=""255, 255, 255"" BorderDashStyle=""Solid"" BackColor=""Transparent"" ShadowColor=""Transparent"">
<AxisY LineColor=""64, 64, 64, 64"">
<MajorGrid Interval=""Auto"" LineColor=""64, 64, 64, 64"" />
<LabelStyle Font=""Trebuchet MS, 8.25pt"" />
</AxisY>
<AxisX LineColor=""64, 64, 64, 64"">
<MajorGrid Interval=""Auto"" LineColor=""64, 64, 64, 64"" />
<LabelStyle Interval=""Auto"" Font=""Trebuchet MS, 8.25pt"" />
</AxisX>
</ChartArea>
</ChartAreas>
</Chart>";
var chart = new Chart(width: 500, height: 250, theme: myTheme)
.AddSeries(
chartType: "line",
xValue: arrXvalues,
yValues: arrYvalues)
.GetBytes("png");
return File(chart, "image/bytes");
}
Revision: 58641
Updated Code
at July 26, 2012 18:21 by ptomas
Updated Code
// kodas chtml faile:
// <img src="@Url.Action("grafikas")" alt="Drawing chart with HTML Helper" />
// kodas kontroleryje:
[ActionName("grafikas")] // ---------------- galima keist path pagal regionus!
//[OutputCache(Duration = 3)] // ------------ jei nustatomas keshavimas, kai issaugot bandai gaunasi .bmp failas
public ActionResult DrawChart()
{
/*
* reikia pasiimt i���¡ sistemos userio Guid, tai nereik���s nieko perduot per parametrus!!!
*/
string[] arrYvalues = new string[10];
string[] arrXvalues = new string[10];
Random rn = new Random();
for (int i = 1; i < 10; i++)
{
arrXvalues[i] = i.ToString();
arrYvalues[i] = i.ToString() + rn.Next(10).ToString();
}
string myTheme =
@"<Chart BackColor=""255, 255, 255"" >
<ChartAreas>
<ChartArea Name=""Default"" BorderColor=""255, 255, 255"" BorderDashStyle=""Solid"" BackColor=""Transparent"" ShadowColor=""Transparent"">
<AxisY LineColor=""64, 64, 64, 64"">
<MajorGrid Interval=""Auto"" LineColor=""64, 64, 64, 64"" />
<LabelStyle Font=""Trebuchet MS, 8.25pt"" />
</AxisY>
<AxisX LineColor=""64, 64, 64, 64"">
<MajorGrid Interval=""Auto"" LineColor=""64, 64, 64, 64"" />
<LabelStyle Interval=""Auto"" Font=""Trebuchet MS, 8.25pt"" />
</AxisX>
</ChartArea>
</ChartAreas>
</Chart>";
var chart = new Chart(width: 500, height: 250, theme: myTheme)
.AddSeries(
chartType: "line",
xValue: arrXvalues,
yValues: arrYvalues)
.GetBytes("png");
return File(chart, "image/bytes");
}
Revision: 58640
Updated Code
at July 26, 2012 18:04 by ptomas
Updated Code
// kodas chtml faile:
// <img src="@Url.Action("grafikas")" alt="Drawing chart with HTML Helper" />
// kodas kontroleryje:
[ActionName("grafikas")] // ---------------- galima keist path pagal regionus!
//[OutputCache(Duration = 3)] // ------------ jei nustatomas keshavimas, kai issaugot bandai gaunasi .bmp failas
public ActionResult DrawChart()
{
/*
* reikia pasiimt i�¡ sistemos userio Guid, tai nereik��s nieko perduot per parametrus!!!
*/
string[] arrYvalues = new string[10];
string[] arrXvalues = new string[10];
Random rn = new Random();
for (int i = 1; i < 10; i++)
{
arrXvalues[i] = i.ToString();
arrYvalues[i] = i.ToString() + rn.Next(10).ToString();
}
string myTheme =
@"<Chart BackColor=""255, 255, 255"" >
<ChartAreas>
<ChartArea Name=""Default"" BorderColor=""255, 255, 255"" BorderDashStyle=""Solid"" BackColor=""Transparent"" ShadowColor=""Transparent"">
<AxisY LineColor=""64, 64, 64, 64"">
<MajorGrid Interval=""Auto"" LineColor=""64, 64, 64, 64"" />
<LabelStyle Font=""Trebuchet MS, 8.25pt"" />
</AxisY>
<AxisX LineColor=""64, 64, 64, 64"">
<MajorGrid Interval=""Auto"" LineColor=""64, 64, 64, 64"" />
<LabelStyle Interval=""Auto"" Font=""Trebuchet MS, 8.25pt"" />
</AxisX>
</ChartArea>
</ChartAreas>
</Chart>";
var chart = new Chart(width: 500, height: 250, theme: myTheme)
.AddSeries(
chartType: "line",
xValue: arrXvalues,
yValues: arrYvalues)
.GetBytes("png");
return File(chart, "image/bytes");
}
Revision: 58639
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 26, 2012 18:02 by ptomas
Initial Code
// kodas chtml faile:
// <img src="@Url.Action("grafikas")" alt="Drawing chart with HTML Helper" />
// kodas kontroleryje:
[ActionName("grafikas")] // ---------------- galima keist path pagal regionus!
//[OutputCache(Duration = 3)] // ------------ jei nustatomas keshavimas, kai issaugot bandai gaunasi .bmp failas
public ActionResult DrawChart()
{
/*
* reikia pasiimt iš sistemos userio Guid, tai nereik�s nieko perduot per parametrus!!!
*/
string[] arrYvalues = new string[10];
string[] arrXvalues = new string[10];
Random rn = new Random();
for (int i = 1; i < 10; i++)
{
arrXvalues[i] = i.ToString();
arrYvalues[i] = i.ToString() + rn.Next(10).ToString();
}
string myTheme =
@"<Chart BackColor=""255, 255, 255"" >
<ChartAreas>
<ChartArea Name=""Default"" BorderColor=""255, 255, 255"" BorderDashStyle=""Solid"" BackColor=""Transparent"" ShadowColor=""Transparent"">
<AxisY LineColor=""64, 64, 64, 64"">
<MajorGrid Interval=""Auto"" LineColor=""64, 64, 64, 64"" />
<LabelStyle Font=""Trebuchet MS, 8.25pt"" />
</AxisY>
<AxisX LineColor=""64, 64, 64, 64"">
<MajorGrid Interval=""Auto"" LineColor=""64, 64, 64, 64"" />
<LabelStyle Interval=""Auto"" Font=""Trebuchet MS, 8.25pt"" />
</AxisX>
</ChartArea>
</ChartAreas>
</Chart>";
var chart = new Chart(width: 500, height: 250, theme: myTheme)
.AddSeries(
chartType: "line",
xValue: arrXvalues,
yValues: arrYvalues)
.GetBytes("png");
return File(chart, "image/bytes");
}
Initial URL
Initial Description
grafikas atvaizduojamas kreive, pyrago forma, stulpeliais. Pateikiamas kaip sugeneruotas png failas.
Initial Title
MVC3 atvaizduoti grafika
Initial Tags
Initial Language
C#