Jump to content
Software FX Community

X-axis


mahboob
 Share

Recommended Posts

 

Hi

i send to Code Data size is big so that is not possible

private void TemplateBar(DataSet ds, string strCDS, int ChildMenuID, int ChartNo, string Path)

{

DataView myView = new DataView();

ChartFX.WebForms.

Chart objChart = new ChartFX.WebForms.Chart();CheckBox chk = new CheckBox();

Literal litSpace = new Literal();chk.ID = Path.Replace("/", "");

chk.Text =

" Select";chk.Visible = false;litSpace.Text = " </Br> </Br> </Br>";

objChart.Width = 850;

objChart.Height = 550;

 

try

{

// Setting File Path

// Path = SettingFilePath(strCDS, Server.MapPath("../Charts/") + Path + "/");

phChart.Controls.Add(chk);

phChart.Controls.Add(objChart);

phChart.Controls.Add(litSpace);

 

if (File.Exists(Path + "/" + strCDS + ".chw"))

{

objChart.Import(ChartFX.WebForms.FileFormat.Binary, Path + "/" + strCDS + ".chw");objChart.Visible = true;

}

else

{

// Setting ToolBoxChartsConfiguration.AddToolBox(objChart, true);

// Setting LegendBoxChartsConfiguration.SetLegendsBox(objChart, false);

// Chart TypeobjChart.Gallery = Gallery.Bar;objChart.RenderFormat = ConfigurationSettings.AppSettings["ChartRenderFormat"];

 

// Check Data Avaible or not if (ds.Tables.Count > 0)

{

if (ds.Tables[ChartNo].Rows.Count > 0)

{

myView = new DataView(ds.Tables[ChartNo]);if (myView.Count > 0)

{

DataView objView = ConfigureStudentNoForBarChart(myView);

objProDv.DataView = objView;

cfxCT.DataSource = objProDv;

objChart.Visible = true;objChart.Titles.Add(new TitleDockable());

 

objChart.Titles[0].Text = ds.Tables[ChartNo].Rows[0][

"Heading1"].ToString() + " \n " + ds.Tables[ChartNo].Rows[0]["Heading2"].ToString() + " \n " + ds.Tables[ChartNo].Rows[0]["Heading3"].ToString() + " \n ";objChart.Titles[0].Font = new System.Drawing.Font("Arial", 10, FontStyle.Bold);

objChart.DataSourceSettings.Fields.Add(

new FieldMap("Dim1", FieldUsage.ColumnHeading));objChart.DataSourceSettings.Fields.Add(new FieldMap("Dim2", FieldUsage.RowHeading));objChart.DataSourceSettings.Fields.Add(new FieldMap("Pct_Data", FieldUsage.Value));

 

objChart.DataSource = cfxCT;

objChart.DataGrid.Visible = true;

objChart.DataGrid.ShowHiddenSeries =

true;objChart.DataGrid.ContentLayout = ContentLayout.Center;

objChart.DataGrid.MaxSizePercentage = 100;

if (objChart.Series.Count - 1 >= 0)

{

objChart.Series[0].Text = objChart.Series[0].Text.Remove(0, 1) + " %";

objChart.Series[1].Visible =

false;objChart.Series[1].Text = objChart.Series[0].Text.Replace('%', ' ') + "#";

objChart.Series[1].AxisY = objChart.AxisY2;

objChart.DataGrid.Cells[1].BackColor = ChartsConfiguration.SetColorForNoofStudentsRow();

}

if (objChart.Series.Count - 1 >= 3)

{

objChart.Series[2].Text = objChart.Series[2].Text.Remove(0, 1) + " %";

objChart.Series[3].Visible =

false;objChart.Series[3].Text = objChart.Series[2].Text.Replace('%', ' ') + "#";

objChart.Series[3].AxisY = objChart.AxisY2;

objChart.DataGrid.Cells[3].BackColor = ChartsConfiguration.SetColorForNoofStudentsRow();

}

if (objChart.Series.Count - 1 >= 5)

{

objChart.Series[4].Text = objChart.Series[4].Text.Remove(0, 1) + " %";

objChart.Series[5].Visible =

false;objChart.Series[5].Text = objChart.Series[4].Text.Replace('%', ' ') + "#";

objChart.Series[5].AxisY = objChart.AxisY2;

objChart.DataGrid.Cells[5].BackColor = ChartsConfiguration.SetColorForNoofStudentsRow();

}

// Set Colorif (ds.Tables[ChartNo].Rows[0]["ChartID"].ToString().IndexOf("ENTITY") > -1)

{

ChartsConfiguration.SetColorOnEntityCharts(objChart);

}

else if (ds.Tables[ChartNo].Rows[0]["ChartID"].ToString().IndexOf("YEAR") > -1)

{

ChartsConfiguration.SetColorOnYearCharts(objChart);

}

if (((ChartFX.WebForms.DataProviders.DataViewProvider)(cfxCT.DataSource)).DataView.Count / 3 >= 7)

{

objChart.AllSeries.Volume = 60;

}

else if (((ChartFX.WebForms.DataProviders.DataViewProvider)(cfxCT.DataSource)).DataView.Count / 3 >= 6)

{

objChart.AllSeries.Volume = 50;

}

else if (((ChartFX.WebForms.DataProviders.DataViewProvider)(cfxCT.DataSource)).DataView.Count / 3 >= 4)

{

objChart.AllSeries.Volume = 30;

}

else if (((ChartFX.WebForms.DataProviders.DataViewProvider)(cfxCT.DataSource)).DataView.Count / 3 >= 3)

{

objChart.AllSeries.Volume = 50;

}

else if (((ChartFX.WebForms.DataProviders.DataViewProvider)(cfxCT.DataSource)).DataView.Count / 3 >= 2)

{

objChart.AllSeries.Volume = 20;

}

else

{

objChart.AllSeries.Volume = 10;

}

 

// Bar TextobjChart.AllSeries.PointLabels.Font = new Font("Arial", 8, FontStyle.Bold);

objChart.AllSeries.PointLabels.Visible =

false;objChart.AxisY.Title.Text = ds.Tables[ChartNo].Rows[0]["YaxisLabel"].ToString();

//objChart.AxisX.Title.Text = "\n Number of Fitness Standards Achieved \n";objChart.AxisX.Title.Font = new Font("Arial", 9, FontStyle.Bold);

 

 

objChart.AxisX.LabelAngle = 0;

objChart.AxisY.Title.Font = new Font("verdana", 8, FontStyle.Bold);

objChart.AxisX.Font =

new Font("Arial", 8, FontStyle.Bold);objChart.AxisY.Font = new Font("Arial", 8, FontStyle.Bold);

objChart.DataGrid.Font =

new Font("Arial", 8, FontStyle.Bold);

// Scaleing

objChart.AxisY.Min = 0;

objChart.AxisY.Step = .2;

objChart.AxisY.Max = 1;

objChart.AxisY.DataFormat.CustomFormat = "P0";

objChart.AxisY.LabelsFormat.CustomFormat =

"P0";objChart.AxisY2.DataFormat.Format = AxisFormat.Number;objChart.AxisY2.LabelsFormat.Format = AxisFormat.Number;

 

// Export to PNG

// objChart.Export(FileFormat.Bitmap, Path + "/" + strCDS + ".png");

// Export to Binary

// objChart.Export(ChartFX.WebForms.FileFormat.Binary, Path + "/" + strCDS + ".chw");

}

else

{

objChart.Visible = false;chk.Visible = false;

}

}

else

{

objChart.Visible = false;chk.Visible = false;

}

}

else

{

objChart.Visible = false;chk.Visible = false;

}

}

}

catch (Exception ex)

{

objChart.Visible = false;chk.Visible = false;

Response.Write(ex.Message);

}

finally { }

}

Link to comment
Share on other sites

After importing the chart, the state will be the same as it was when it was exported. In particular the fields collection would be whatever it was at that time.

 

Since you are doing:

 

objChart.DataSourceSettings.Fields.Add(new FieldMap("Dim1", FieldUsage.ColumnHeading));

And not clearing the fields collection, you are in fact adding more fields to it, hence producing the repetitions. Add the following to your code;

objChart.DataSourceSettings.Fields.Clear();

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...