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
585
Problems with chartsize using a composite Chart
posted

Hello NG,

 I'm creating a composite Chart within a TD of a table, the compositechart should have 100 % width and 400px height. Unfortunately the chart get's centered within the TD. Here is my code

Me.UltraChart2.ChartType = ChartType.Composite

Me.UltraChart2.BorderWidth = New Unit(0)

'Create the chart area

Dim myChartArea As New ChartArea()

myChartArea.Border.Thickness = 0

myChartArea.BoundsMeasureType = MeasureType.Percentage

myChartArea.Bounds =
New Rectangle(0, 0, 100, 100)

Me.UltraChart2.CompositeChart.ChartAreas.Add(myChartArea)

' Create a Y axis

Dim yAxis As New AxisItem()

yAxis.axisNumber = AxisNumber.Y_Axis

yAxis.DataType = AxisDataType.Numeric

yAxis.SetLabelAxisType = SetLabelAxisType.GroupBySeries

yAxis.Labels.ItemFormatString = "<DATA_VALUE:###,###,###,##0.00>"

yAxis.Labels.Font = New Font("Verdana", 7)

yAxis.TickmarkStyle = AxisTickStyle.Smart

yAxis.LineThickness = 1

myChartArea.Axes.Add(yAxis)

' Create the X axis

Dim xAxisForColumnChart As New AxisItem()

xAxisForColumnChart.OrientationType = AxisNumber.X_Axis

xAxisForColumnChart.DataType = AxisDataType.String

xAxisForColumnChart.Labels.Orientation = TextOrientation.VerticalLeftFacing

xAxisForColumnChart.SetLabelAxisType = SetLabelAxisType.GroupBySeries

xAxisForColumnChart.Labels.ItemFormatString = "<ITEM_LABEL>"

xAxisForColumnChart.Labels.Font = New Font("Verdana", 7)

xAxisForColumnChart.LineThickness = 1

xAxisForColumnChart.Labels.SeriesLabels.Visible = False

'Create the chart layer

myChartArea.Axes.Add(xAxisForColumnChart)

Dim columnLayer As New ChartLayerAppearance()

columnLayer.ChartType = ChartType.ColumnChart

columnLayer.ChartArea = myChartArea

columnLayer.AxisX = xAxisForColumnChart

columnLayer.AxisY = yAxis

Me.UltraChart2.CompositeChart.ChartLayers.Add(columnLayer)

'Assign the series data

Dim columnSeries As NumericSeries = Me.GetNumericSeriesForColumnChart()Me.UltraChart2.CompositeChart.Series.Add(columnSeries)

columnLayer.Series.Add(columnSeries)

' Create the X axis

Dim xAxisForLineChart As New AxisItem()

xAxisForLineChart.OrientationType = AxisNumber.X2_Axis

xAxisForLineChart.DataType = AxisDataType.String

xAxisForLineChart.SetLabelAxisType = SetLabelAxisType.ContinuousData

xAxisForLineChart.LineThickness = 0

xAxisForLineChart.Margin.Near.Value = 0

xAxisForLineChart.Margin.Far.Value = 0

'Create the chart layer

myChartArea.Axes.Add(xAxisForLineChart)

Dim lineLayer As New ChartLayerAppearance()

lineLayer.ChartType = ChartType.LineChart

lineLayer.ChartArea = myChartArea

lineLayer.AxisX = xAxisForLineChart

lineLayer.AxisY = yAxis

Me.UltraChart2.CompositeChart.ChartLayers.Add(lineLayer)

Dim lineSeries As NumericSeries = Me.GetNumericSeriesForLineChart()

Me.UltraChart2.CompositeChart.Series.Add(lineSeries)

lineLayer.Series.Add(lineSeries)

Thanks in advance for your help

Stefan

Parents
  • 585
    Offline posted

    Hello NG,

     just solved the problem, the x and y axis extend was set to 100 ... sry ;-)

     Stefan

Reply Children
No Data