|
|
|
|
|
|
|
|
There are currently:
2 anonymous users online.
0 of 1,436 registered users online.
There have been 160339 Page Hits by
118886 users
|
|
|
|
|
Custom Palette
C# Example Code
{
System.Random r= new System.Random();
// Create a simple color palette
const int kNumColors = 32;
Color[] lineColors = new Color[kNumColors];
for(int i=0; i<kNumColors; i++)
{
int col = (255 * i) / kNumColors;
lineColors[i] = Color.FromArgb(255-col, 255, col);
}
chart.SetCustomColorPalette(lineColors);
// Generate the chart
string []lables = {"Left", "Right"};
chart.Legend.Visible = true;
chart.Legend.Style.Font = new Font("Arial", 8);
chart.Legend.Style.FillColor = Color.DarkGray;
chart.CanvasStyle.FillColor = Color.LightGray;
chart.AxisStyle.FillColor = Color.DarkGray;
chart.ChartStyle.FillColor = Color.Gray;
chart.OutputFormat = ImageFormat.Png;
int seriesCount = 32;
for (int i=0;i<seriesCount;i++)
{
chart.Series[i].Type = ChartType.Bar;
chart.Series[i].Name = "P_" + i.ToString();
for (int j=0;j<lables.Length;j++)
{
chart.Series[i].Data.Add(new DataPoint(50 + r.NextDouble()* 100, lables[j]));
}
}
}
ASP.Net C# Example
<%@ Register tagPrefix="SasqChart" Namespace="SasqChart" Assembly="SasqChart" %>
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Drawing2D" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<HTML>
<HEAD>
<title>Simple C# SasqChart Example</title>
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
System.Random r= new System.Random();
// Create a simple color palette
const int kNumColors = 32;
Color[] lineColors = new Color[kNumColors];
for(int i=0; i<kNumColors; i++)
{
int col = (255 * i) / kNumColors;
lineColors[i] = Color.FromArgb(255-col, 255, col);
}
chart.SetCustomColorPalette(lineColors);
// Generate the chart
string []lables = {"Left", "Right"};
chart.Legend.Visible = true;
chart.Legend.Style.Font = new Font("Arial", 8);
chart.Legend.Style.FillColor = Color.DarkGray;
chart.CanvasStyle.FillColor = Color.LightGray;
chart.AxisStyle.FillColor = Color.DarkGray;
chart.ChartStyle.FillColor = Color.Gray;
chart.OutputFormat = ImageFormat.Png;
int seriesCount = 32;
for (int i=0;i<seriesCount;i++)
{
chart.Series[i].Type = ChartType.Bar;
chart.Series[i].Name = "P_" + i.ToString();
for (int j=0;j<lables.Length;j++)
{
chart.Series[i].Data.Add(new DataPoint(50 + r.NextDouble()* 100, lables[j]));
}
}
}
</script>
</HEAD>
<body>
<SasqChart:WebChartControl id="chart" runat="server" width="600" height="400" />
</body>
</HTML>
|