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
You can use the properties suggested in each step to achieve the desired chart appearance.
Step3: If you want the Axis labels to be vertically aligned like the way shown in the picture then you can achieve that by setting TextOrientation property to Custom and VerticalAligh property to Near.
Step4: RangeMax property will set the maximum range for data on that specific axis. To set axis margin you have to use Margins property of that specific axis. You can refer to the below link on how to set the axis margins.
http://help.infragistics.com/doc/WinForms/2016.1/CLR4.0/?page=Chart_Axis_Margins.html
Step7&8: I’m glad you were able to resolve these issues, Please let me know if you need any further assistance regarding these two issues.
Step9: You can increase the legend size to resolve this issue. By increasing the SpanPercentage of the legend you can make the legend occupy more chart space and thus display its labels completely. For example you can do something like this.
UltraChart1.Legend.SpanPercentage = 25;
Step10: You can display Chart title on the right edge of the chart using TitleRight property, it returns an Appearance object that you can use to access all formatting properties of title box. You can adjust the location of this title by using the Margins property off the TitleRight object. To read more about TitleRight property please refer to the below link.
http://help.infragistics.com/doc/WinForms/2016.1/CLR4.0/?page=Infragistics4.Win.UltraWinChart.v16.1~Infragistics.Win.UltraWinChart.UltraChart~TitleRight.html
Step11: You can refer to the below KB article on how to add custom tool tips for UltraChart.
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.Aspx?ArticleID=1016
Step12: Chart text is centered by default, but you can set the HorizontalAlign property to specify the horizontal alignment of chart text. Please refer to the below link to read more about Chart text’s HorizontalAlign property.
http://help.infragistics.com/doc/WinForms/2016.1/CLR4.0/?page=Infragistics4.Win.UltraWinChart.v16.1~Infragistics.UltraChart.Resources.Appearance.ChartTextAppearance~HorizontalAlign.html
Please let me know if I may be of further assistance.
Hi Sahaja
Step 3:What I ask here is:Because if you use the same code in the picture that you see in step 3, the label serial appear vertically and indicated that the picture is fine, they appear horizontally and if something can not be added ....
eg DONE: If you have to put "my house," says "my Hou..."while in the other theMAL FACT: If you have to put "my house" puts you: MY-HOU-SE (vertical)And what is even less because I understand does this difference when the 2 are generated with the same code, I do not mean very much code, I mean the 2 call the same function, so they would have to leave identical
Step 4:I DO NOT WANT A MARGIN; I want to calculate the maximum size of the highest column, eg 1000 then apply a 2% for the graphic, quit me with a RangeMax 1200 i and I see a little space, see margin from the highest column at the end of graphic, BUT NOT ADD mARGINS, BUT NOT ENLARGING THE gRAPHIC AND COLUMNS
Step 7 and 8,What I mean is that, you see, wider columns appear, and I want you to visually always look the same, what I mean is that the scroll is if the graph is larger than the area,What I would like to know is how I can put graphics that are larger than the area, and they do not fit the size of it, because now if you do not put a scaled, to fit the area, the size of the columns also I changed, so I wanted to know how to set a column width, and, if they leave the area because you generate the scroll to see what is missing
Step 9Okay thanks, but I do not intend agrandarles space, what I want is to leave me like serial labels photo that goes well, not occupying more space, but if you do not fit you add ....eg ECHO WELL: if you have to put "my house," says "my hou ..."
Step 11 and Step 12 will look at me and I commented articles to see if it has served me
Thank you very much
For Step3, Please refer to the attached sample which demonstrates how to set the Orientation property for series labels and let me know if you have any questions.