Hi All,
I used StackedChart in my project. I want my columns are a fixed width in chart. Currently the width of the columns auto-sizes to the width of the screen. Ex: My chart has one column since the width of this column auto-size to the width of the screen.
Any ideas?
Thanks.
To do this you can use ChartDrawItem Event. The code could be something like:
this.ultraChart1.ChartDrawItem += new Infragistics.UltraChart.Shared.Events.ChartDrawItemEventHandler(ultraChart1_ChartDrawItem);
...
private const int columnWidth = 100;
{
Box box = e.Primitive as Box;
}
int dWidth = box.rect.Width - columnWidth;
box.rect.Width = columnWidth;
box.rect.X += dWidth / 2;
Hello All,
I was having a very similar problem when making a composite chart with a vertical bar chart and line chart. The bars expand to fill the chart window and I need them to be a fixed width and spaced evenly across the chart so I can line up data points in the line chart with the middle of the bars. I was trying to reproduce you code in vb and was having a problem with the following line:
Teodor Taushanov"]Box box = e.Primitive as Box;
My c# is not as sharp as it should be because i don't use it as much. However, I thought that this would accomplish the same action:
Dim mybox As Box = CType(e.Primitive, Box)
This does not work for the following reasson
Value of type 'infragistics.ultrachart.core.primitives.primitive' cannot be converted to 'infragistics.ultragultraguage.resources.box'
Can any one shed some light on the subject?
TIA
Patrick
Teodor -
The code compiled ok but tripped a runtime error:
Unable to cast object of type 'Infragistics.UltraChart.Core.Primitives.GraphicsContext' to type 'Infragistics.UltraChart.Core.Primitives.Box'.
This seems to be working correctly.
Try
If mybox Is Nothing Or mybox.DataPoint Is Nothing Then
lbl_Overview_user_messages.Text += "myBox is nothing <br/>"
Return
End If
lbl_Overview_user_messages.Text += "myBox is Something <br/>"
If dWidth <= 0 Then
mybox.rect.X += dWidth / 4
End Try
End Sub
I put the code in the project, but din't function properly, the application send error with the following sentence
Dim mybox As Infragistics.UltraChart.Core.Primitives.Box = CType(e.Primitive, Infragistics.UltraChart.Core.Primitives.Box)
What was the error?
This is error --> ex.message "Specified cast is not valid."
http://community.infragistics.com/forums/p/52899/315379.aspx#315379
i also got the following error "Unable to cast object of type 'Infragistics.UltraChart.Core.Primitives.GraphicsContext' to type 'Infragistics.UltraChart.Core.Primitives.Box'."
Private Sub ucColumnChart_FillSceneGraph(ByVal sender As Object, ByVal e As Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs) Handles ucCoulmnChart.FillSceneGraph Dim texts As New List(Of Text)() For Each prim As Primitive In e.SceneGraph 'Dim box As Box = TryCast(prim, Box) Dim boxs As Box = Nothing boxs = CType(prim, Box) If boxs Is Nothing OrElse boxs.DataPoint Is Nothing Then Continue For End If
Dim text As New Text() text.labelStyle.HorizontalAlign = StringAlignment.Center text.labelStyle.VerticalAlign = StringAlignment.Center text.SetTextString(boxs.Value.ToString()) text.bounds = boxs.rect texts.Add(text) Nextend sub
i need to include text labels in 3D column chart.
Have you tried the code from this post:
http://news.infragistics.com/forums/p/5914/25885.aspx#25885
Hi,
I have two charts in page, I filled chart 2 when the user clicked column bar of chart1.
The problem are width size of column bar chart2.
Thanks
Could you please provide a little bit more information what is this picture is not as expected?