protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
LoadChartType();
WebChart1.DataSource = Winnovative.DataSources.GetTestData();
WebChart1.ChartType = Winnovative.ChartType.Bars3D;
LoadRotationDegrees();
DdlRotateX.SelectedValue = WebChart1.Charts3D.RotateAxisX.ToString();
DdlRotateY.SelectedValue = WebChart1.Charts3D.RotateAxisY.ToString();
DdlRotateZ.SelectedValue = WebChart1.Charts3D.RotateAxisZ.ToString();
}
}
protected void DdlChartType_SelectedIndexChanged(object sender, EventArgs e)
{
WebChart1.ChartType = (Winnovative.ChartType)Enum.Parse(typeof(Winnovative.ChartType), DdlChartType.SelectedValue);
DdlRotateX.SelectedValue = WebChart1.Charts3D.RotateAxisX.ToString();
DdlRotateY.SelectedValue = WebChart1.Charts3D.RotateAxisY.ToString();
DdlRotateZ.SelectedValue = WebChart1.Charts3D.RotateAxisZ.ToString();
}
private void LoadChartType()
{
DdlChartType.Items.Clear();
string[] types = Enum.GetNames(typeof(Winnovative.ChartType));
for (int i = 0; i <= types.Length - 1; i++)
{
if (types[i].Contains("3D"))
{
DdlChartType.Items.Add(types[i]);
}
}
}
private void LoadRotationDegrees()
{
DdlRotateX.Items.Clear();
for (int i = 0; i < 360; i = i + 5)
{
DdlRotateX.Items.Add(i.ToString());
}
DdlRotateY.Items.Clear();
for (int i = 0; i < 360; i = i + 5)
{
DdlRotateY.Items.Add(i.ToString());
}
DdlRotateZ.Items.Clear();
for (int i = 0; i < 360; i = i + 5)
{
DdlRotateZ.Items.Add(i.ToString());
}
}
protected void DdlRotateX_SelectedIndexChanged(object sender, EventArgs e)
{
WebChart1.Charts3D.RotateAxisX = Convert.ToInt32(DdlRotateX.SelectedValue);
}
protected void DdlRotateY_SelectedIndexChanged(object sender, EventArgs e)
{
WebChart1.Charts3D.RotateAxisY = Convert.ToInt32(DdlRotateY.SelectedValue);
}
protected void DdlRotateZ_SelectedIndexChanged(object sender, EventArgs e)
{
WebChart1.Charts3D.RotateAxisZ = Convert.ToInt32(DdlRotateZ.SelectedValue);
}