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
{ uc_prova.CompositeChart.ChartAreas.Clear(); uc_prova.CompositeChart.ChartLayers.Clear(); uc_prova.CompositeChart.Legends.Clear(); }
STEP 3 CONFIG AXIS 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
{ 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
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
{ 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
{ 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
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
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
{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
{ 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
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 seriesI 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 YI 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 SERIESI 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 SERIESI 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 LEGENDSometimes 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 TITLEIs 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 TOOLTIPI 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 TEXTAPPEARANCEThe text did not appear
Hi Carles,
I tried to answer most of your questions but to answer certain one’s I need more information.
Step3: The orientation of Label series is vertical because it is set to VerticalLeftFacing. Are you trying to set Label orientation property to some other value?
When the label string gets too large and if they overlap on each other than the chart does not display those labels. I have to research this further to find a resolution for this issue.
Step4: You can set the Extent property off the AxisAppearance to modify the breadth of any margin between an Axis and the edge of the control. You can refer to the link below to read more about this.
http://help.infragistics.com/doc/WinForms/2016.1/CLR4.0/?page=Infragistics4.Win.UltraWinChart.v16.1~Infragistics.UltraChart.Resources.Appearance.AxisAppearance~Extent.html
Step7: You can set width for the UltraChart columns but it will be same for all the columns so can you please clarify what you are trying to achieve here?
Step8: Please send us a mocked picture that shows the desired Chart Appearance.
Step9: Please clarify what you are trying to achieve here.
Step10: You can set Chart title at a fixed position by setting the Extent property off the TitleAppearance object. Please refer to the below link to read more about it. You can refer to the link below to read more about this.
http://help.infragistics.com/doc/WinForms/2016.1/CLR4.0/?page=Infragistics4.Win.UltraWinChart.v16.1~Infragistics.UltraChart.Resources.Appearance.TitleAppearance~Extent.html
Step11: I don’t see anything in code that will hide the ToolTips. Are you using any custom formatting for the ToolTip that Chart is not able to render?
Step12: What text are you trying to set as the ChartText? In code I can only see ChartTextApperance being set not the actual ChartText. Please clarify?
I will further look into this issue as soon as I receive this information.
Sincerely,Sahaja KokkalagaddaAssociate Software Developer
Hi Sahaja Kokkalagadda
THIS OK:
STEP 3 SET AXIS XI mean what you see in the picture, I'd like him to stay like the picture that indicated that this good, if not possible, k is complete with ... i not to be put vertically as shown here
STEP 4 SET AXIS YI left as shown in the picture, I try to set with:axisY.RangeMax = Math.Round (RangeMax + 0.2 * RangeMax);to have a 2% margin, the Math.round works, but when the chart show this margin is not seen
STEP 7 WITHOUT DATA SET SERIESwhat I'm trying to accomplish here is the following:If I do not put on:axisX.ScrollScale.Scale = 0.2;does not generate any horizontal scroll but fits me the chart the size of the area, I would like to define the size of the columas so that if the graph leaves the area, then me the scroll to see the rest appear.
To force the scroll I do scaling and therefore some pretty thicker columns are displayed and makes the expected effect
STEP 8 SET DATA WITH SERIESas in STEP 7
STEP 9 GENERATE LEGENDas you see in the image, the labels of the legend are somewhat overlapping and words are cut, and I would like to have the same effect as the label serial photo that indicated that this good, if not possible, to be completed with "...." But they do not overlap
and the seriel labels disappear
STEP 10 CONFIG TITLEin the first image appears as interests me, but if enlarge the image remains fixed in the position where I was, but I'm not interested position or give a margin for practical purposes would be something like, as seen in the second image, as I wish it were attached to graph to make it as the title of the legend
STEP 11 CONFIG TOOLTIPas you see in the picture, I just change the column color me, and I'd like to see the "floating window" as in the example
i want this
STEP 12 CONFIG TEXTAPPEARANCEAs you can see in the code, I try to leave me the text within the column as seen in the image, but it does not appear, and I have visible
thank you very much