Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
215
I hava a problem with: labels axisX, labels of legend, and width columns, HELP PLEASE
posted

ok, my code is:

***********************************************************************

                                  STEP 1  GENERATE GRAPHIC

***********************************************************************

DataTable myDataTable = new DataTable();

AxisItem myFinalAxisX = new AxisItem();
AxisItem myFinalAxisY = new AxisItem();
ChartArea myFinalChartArea = new ChartArea();
ChartLayerAppearance myFinalColumnLayer = new ChartLayerAppearance();
CompositeLegend myFinalLegend = new CompositeLegend();

if (this.State == Tipos_Estado[1].ToString()) { myDataTable = myDataTableNormal; } else { myDataTable = myDataTableInyeccion; }
Limpiar_Grafico();
uc_prova.ChartType = ChartType.Composite;

myFinalAxisX = Configurar_Eje_X();
myFinalAxisY = Configurar_Eje_Y(myDataTable);
myFinalChartArea = Configurar_Area_Coordenadas(myFinalAxisX, myFinalAxisY);
uc_prova.CompositeChart.ChartAreas.Add(myFinalChartArea);

myFinalColumnLayer = Configurar_Apariencia_Columnas(myFinalChartArea, myFinalAxisX, myFinalAxisY, myDataTable);
uc_prova.CompositeChart.ChartLayers.Add(myFinalColumnLayer);

myFinalLegend = Configurar_Leyenda(myFinalColumnLayer);
uc_prova.CompositeChart.Legends.Add(myFinalLegend);
Configurar_Titulo();
Configurar_Leyenda_Flotante();
Configurar_Apariencia_Texto(myDataTable);

***********************************************************************

                                  STEP 2  CLEAR GRAPHIC

***********************************************************************

private void Limpiar_Grafico()

{
uc_prova.CompositeChart.ChartAreas.Clear();
uc_prova.CompositeChart.ChartLayers.Clear();
uc_prova.CompositeChart.Legends.Clear();
}

***********************************************************************

                                 STEP 3  CONFIG AXIS X

***********************************************************************

private AxisItem Configurar_Eje_X()

{
AxisItem axisX = new AxisItem();
axisX.OrientationType = AxisNumber.X_Axis;
axisX.DataType = AxisDataType.String;
axisX.SetLabelAxisType = SetLabelAxisType.GroupBySeries;
axisX.Labels.ItemFormatString = "";
axisX.Labels.Orientation = TextOrientation.VerticalLeftFacing;
axisX.Labels.Layout.Behavior = AxisLabelLayoutBehaviors.UseCollection;
axisX.Labels.Layout.BehaviorCollection.AddRange(this.GetCustomLayoutBehaviors());
axisX.Labels.SeriesLabels.Layout.Behavior = AxisLabelLayoutBehaviors.UseCollection;
axisX.Labels.SeriesLabels.Layout.BehaviorCollection.AddRange(this.GetCustomLayoutBehaviors());
axisX.Labels.FontSizeBestFit = true;
axisX.Labels.WrapText = true;
axisX.Labels.SeriesLabels.FontSizeBestFit = true;
axisX.Labels.SeriesLabels.WrapText = true;
axisX.ScrollScale.Visible = true;
axisX.ScrollScale.Scale = 0.2;
return axisX;
}

***********************************************************************

                                   STEP 4  CONFIG AXIS Y

***********************************************************************

private AxisItem Configurar_Eje_Y(DataTable myGenDataTables)

{
AxisItem axisY = new AxisItem();
axisY.OrientationType = AxisNumber.Y_Axis;
axisY.DataType = AxisDataType.Numeric;
axisY.Labels.ItemFormatString = "";
axisY.Labels.FontSizeBestFit = true;
axisY.Labels.WrapText = true;
axisY.ScrollScale.Visible = true;
axisY.ScrollScale.Scale = 0.4;

axisY.RangeMin = 0;
int RangeMax = Convert.ToInt32(myGenDataTables.Compute("max(" + Columna + ")", string.Empty));
axisY.RangeMax = Math.Round(RangeMax + 0.2 * RangeMax);


return axisY;
}

***********************************************************************

                                  STEP 5  CONFIG AREA

***********************************************************************

private ChartArea Configurar_Area_Coordenadas(AxisItem X , AxisItem Y)

{
ChartArea myChartArea = new ChartArea();
myChartArea.Bounds = new Rectangle(0, 0, 85, 100);
myChartArea.BoundsMeasureType = MeasureType.Percentage;
myChartArea.Axes.Add(X);
myChartArea.Axes.Add(Y);
return myChartArea;
}

***********************************************************************

                                  STEP 6  CONFIGURATE COLUMLAYER

***********************************************************************

private ChartLayerAppearance Configurar_Apariencia_Columnas (ChartArea myGenChartArea, AxisItem X, AxisItem Y , DataTable myGenDataTable){

ChartLayerAppearance myColumnLayer = new ChartLayerAppearance();
myColumnLayer.ChartType = ChartType.ColumnChart;
myColumnLayer.ChartArea = myGenChartArea;

if (Filtro == Tipos_Filtro[0].ToString())
{
NumericSeries series = GetNumericSeries(myGenDataTable);
uc_prova.CompositeChart.Series.Add(series);
myColumnLayer.Series.Add(series);
uc_prova.Data.ZeroAligned = true;
uc_prova.DataBind();
}
else
{
DataTable ListaSeries = myGenDataTable.DefaultView.ToTable(true, "Operario");
int BigCount = 0;
foreach (DataRow row in ListaSeries.Rows)
{
int mycount = 0;
DataRow[] FiltroListaSeries = myGenDataTable.Select("Operario='" + row[0].ToString() + "'");
mycount = FiltroListaSeries.Count();
if (mycount > BigCount) { BigCount = mycount; }
}
foreach (DataRow row in ListaSeries.Rows)
{
NumericSeries series = GetNumericSeriesBound(row[0].ToString(), myGenDataTable, BigCount);
uc_prova.CompositeChart.Series.Add(series);
myColumnLayer.Series.Add(series);
uc_prova.Data.ZeroAligned = true;
uc_prova.DataBind();
}
}
myColumnLayer.AxisX = X;
myColumnLayer.AxisY = Y;

return myColumnLayer;
}

***********************************************************************

                                  STEP 7 SET DATA WITHOUT SERIES

***********************************************************************

private NumericSeries GetNumericSeries(DataTable myDataSet)

{
NumericSeries series = new NumericSeries();
series.Label = "";
series.Data.DataSource = myDataSet;

series.Data.LabelColumn = "Operario";
series.Data.ValueColumn = SelecBoton;
return series;
}

***********************************************************************

                                  STEP 8 SET DATA WITH SERIES

***********************************************************************

private NumericSeries GetNumericSeriesBound(string operario, DataTable myDataSet, int NumColums)

{
NumericSeries series = new NumericSeries();
series.Label = operario;
DataRow[] FiltroDataSet = myDataSet.Select("Operario='" + operario + "'");
DataTable table = FiltroDataSet.CopyToDataTable();
int miniCount = FiltroDataSet.Count();
for (int i = 0; i < (NumColums - miniCount); i++)
{
DataRow minRow = table.NewRow();
minRow.SetField("Operario", operario);
table.Rows.Add(minRow);
}
series.Data.DataSource = table;
series.Data.LabelColumn = this.Filtro.ToString();
series.Data.ValueColumn = SelecBoton;
return series;
}

***********************************************************************

                                  STEP 9  GENERATE LEGEND

***********************************************************************

private CompositeLegend Configurar_Leyenda(ChartLayerAppearance myGenColumnLayer) {

CompositeLegend myLegend = new CompositeLegend();
myLegend.ChartLayers.Add(myGenColumnLayer);
Rectangle(90, 5, 10, 100); }
myLegend.Bounds = new Rectangle(85, 5, 15, 100);
myLegend.BoundsMeasureType = MeasureType.Percentage;
myLegend.Border.CornerRadius = 10;
myLegend.Border.Thickness = 0;
myLegend.LabelStyle.FontSizeBestFit = true;
myLegend.LabelStyle.WrapText = true;
return myLegend;
}

***********************************************************************

                                 STEP 10  CONFIG TITLE

***********************************************************************

private void Configurar_Titulo() {

uc_prova.TitleTop.Extent = 55;
uc_prova.TitleTop.FontColor = Color.Black;
uc_prova.TitleTop.Font = new Font(FontFamily.GenericSansSerif,13, FontStyle.Bold);
uc_prova.TitleTop.FontSizeBestFit = true;
uc_prova.TitleTop.HorizontalAlign = StringAlignment.Far;
if (Filtro == Tipos_Filtro[1].ToString()) { uc_prova.TitleTop.Text = Tipos_Agrupaciones[0].ToString(); }
else
if (Filtro == Tipos_Filtro[2].ToString()) { uc_prova.TitleTop.Text = Tipos_Agrupaciones[1].ToString(); }
else
{ uc_prova.TitleTop.Text = Tipos_Filtro[3].ToString(); }
uc_prova.TitleTop.VerticalAlign = StringAlignment.Near;
uc_prova.TitleTop.Visible = true;
uc_prova.TitleTop.WrapText = true;
}

***********************************************************************

                                  STEP 11  CONFIG TOOLTIP

***********************************************************************

private void Configurar_Leyenda_Flotante()

{
uc_prova.Tooltips.BackColor = Color.Red;
uc_prova.Tooltips.BorderColor = Color.Yellow;
uc_prova.Tooltips.BorderThickness = 4;
uc_prova.Tooltips.Display = Infragistics.UltraChart.Shared.Styles.TooltipDisplay.MouseMove;
uc_prova.Tooltips.FontColor = Color.Beige;
uc_prova.Tooltips.HighlightDataPoint = true;
uc_prova.Tooltips.HighlightFillColor = Color.Red;
uc_prova.Tooltips.HighlightOutlineColor = Color.Yellow;
uc_prova.Tooltips.UseControl = true;
}

***********************************************************************

                                  STEP 12  CONFIG TEXTAPPEARANCE

***********************************************************************

private void Configurar_Apariencia_Texto(DataTable myGenDataTable)

{
int rowIndx = 0;

foreach (DataRow FiltroDataSet in myGenDataTable.Rows)
{
var chartApperance = new ChartTextAppearance();
chartApperance.ChartTextFont = new Font("Verdana", 12f, FontStyle.Bold);
chartApperance.Visible = true;
chartApperance.ItemFormatString = "";
chartApperance.Row = rowIndx++;
chartApperance.VerticalAlign = StringAlignment.Far;
uc_prova.ColumnChart.ChartText.Add(chartApperance);
}
}

well...

***********************************************************************

                                  THESE ARE MY PROBLEMS

***********************************************************************

STEP 3 SET AXIS X

Sometimes the label series shown me vertically (one letter above another)
Sometimes it is shown me the label of the column but the labels do not appear in the series
I do not get to put a fixed size column, this belongs to the series or not
(I want this so that if the area occupies 200 columns wide and occupy more that I appear without the scroll d to scaling, if there is a better way)

 STEP 4 SET AXIS Y
I do not get to set the maximum range even getting well the value of "int RangeMax", so that left me a space above the columns i do not see so close

STEP 7 WITHOUT DATA SET SERIES
I do not get to put a fixed size column
(I want this so that if the area occupies 200 columns wide and occupy more that I appear without the scroll d to scaling, if there is a better way)

STEP 8 SET DATA WITH SERIES
I do not get to put a fixed size column when they belong to a series
(I want this so that if the area occupies 200 columns wide and occupy more that I appear without the scroll d to scaling, if there is a better way)


STEP 9 GENERATE LEGEND
Sometimes when you have little space overlap and cut the words, instead d do as the x axis in these if I aprecen well "..." to avoid stepping on other labels

STEP 10 CONFIG TITLE
Is there any way to put the title on a fixed site? Or put a percentage value and not always this in the same location? I say this thinking of resize that can suffer my program and of course, I can not configure my screen 25 "and then see it on a 15" or 30 "since that would change enough

STEP 11 CONFIG TOOLTIP
I can not get the information box appears with passing the mouse over a column, but if I get this column change of style, color and other

STEP 12 CONFIG TEXTAPPEARANCE
The text did not appear