Home All Groups Group Topic Archive Search About

Change Dynamic control properties at run time

Author
6 Jan 2006 3:23 PM
jaawaad
I'm creating webcharts control dynamically based on user input as to
how many charts they would like to see. I'm running into problem as to
how to set properties for those charts at run time so they behave and
look all the same.

Creating dynamic chart code looks something like this....

/////////////////////////////////////////////////////////////////////////////////
Sub CreateChartControl(ByVal sender As Object, ByVal e As EventArgs)
   Dim ds1 As DataSet = CreateDataSet()
   Dim charttest As ColumnChart = New ColumnChart

    For Each row As DataRow In ds1.Tables(0).Rows
         charttest.Data.Add(New ChartPoint(row("LNAME").ToString,
CType(row _

("AGE"), Integer)))
     Next

   Dim z As Integer

   For z = 1 To 3
         ReDim Preserve mycharts(z)
         mycharts(z) = New ChartControl
         form1.Controls.Add(mycharts(z))
         mycharts(z).Visible = True
         mycharts(z).Charts.Add(charttest)
         mycharts(z).RedrawChart()
   Next z
End Sub

///////////////////////////////////////////////////////////////////////

Is there a way to call a routine from FOR loop to format each chart
control and set the properties.

Here are some chartcontrol properties i would like to change at run
time...

<web:ChartControl Runat="server" ID="chartControl1"
            ChartPadding="30"
            BottomChartPadding="20"
            TopPadding="20"
            Padding="20" Width="848px" Height="438px"
            BorderStyle="outset" GridLines="Both"
            Legend-Position="Bottom" Legend-Width="30">
            <Background Type="LinearGradient"
                                Color="#C0FFC0"
                                EndPoint="900, 900"
                                LinearGradientMode="BackwardDiagonal"
/>
            <Border Color="102, 153, 255" />
            <ChartTitle Text="Web Chart Example"
                             Font="Tahoma, 12pt,
                             style=Bold" ForeColor="White"

StringFormat="Center,Near,Character,LineLimit" />
        </web:ChartControl>

Thanks,
Nick

AddThis Social Bookmark Button