Sorry, posted it in the wrong forum, ASP.NET instead of ASP.NET AJAX, however the question was:
Im trying to make a RadChart with dynamic series, which are added from the code behind. Beneath i have the code server side with a dynamic added serie to the radchart:
Here is the code of the RadChart:
Whatever i try, the barwidthpercent can't be set from the code behind,
the bars keep a distance between each other.
I can't see what im doing wrong either, whenever i try to make a serie in the client side, the barwidthpercent does work, but the problem of that is that i cant dynamicly add series to the chart, depending on how much i need. Any solution?
thanks in advance
Im trying to make a RadChart with dynamic series, which are added from the code behind. Beneath i have the code server side with a dynamic added serie to the radchart:
| private void InitRadChart() |
| { |
| RadChart1.ChartTitle.TextBlock.Text = "Pensioen overzicht"; |
| RadChart1.Chart.Series.Clear(); |
| RadChart1.PlotArea.XAxis.AutoScale = false; |
| RadChart1.PlotArea.XAxis.AddRange(intPrePensioenLeeftijd, intEindeXAsLeeftijd, 1); |
| int intHuidigInkomenRest = intHuidigInkomen%5000; |
| RadChart1.PlotArea.YAxis.AutoScale = false; |
| RadChart1.PlotArea.YAxis.AddRange(0, intHuidigInkomen-intHuidigInkomenRest+10000 , 5000); |
| ChartSeries csPrePensioen = new ChartSeries("PrePensioen", ChartSeriesType.StackedBar); |
| int intPPAOWGerechtigdeLeeftijd = intAOWGerechtigdeLeeftijd; |
| int intPPPrePensioenLeeftijd = intPrePensioenLeeftijd; |
| csPrePensioen.ActiveRegionToolTip = "test"; |
| csPrePensioen.Appearance.BarWidthPercent = 100; |
| for (int i = intPPPrePensioenLeeftijd; i < intPPAOWGerechtigdeLeeftijd; i++) |
| { |
| ChartSeriesItem citem = new ChartSeriesItem(); |
| citem.XValue = i; |
| citem.YValue = intPrepensioen; |
| csPrePensioen.AddItem(citem); |
| } |
| csPrePensioen.Appearance.LabelAppearance.Visible = false; |
| RadChart1.Series.Add(csPrePensioen); |
| } |
Here is the code of the RadChart:
| <telerik:RadChart ID="RadChart1" runat="server" Skin="Metal" Height="400px" Width="700px"> |
| <PlotArea> |
| <EmptySeriesMessage Visible="True"> |
| <Appearance Visible="True"> |
| </Appearance> |
| </EmptySeriesMessage> |
| <XAxis> |
| <Appearance Color="Transparent" MajorTick-Color="174, 174, 174"> |
| <MajorGridLines Color="40, 255, 255, 255" PenStyle="Solid" /> |
| <TextAppearance TextProperties-Color="51, 51, 51"> |
| </TextAppearance> |
| </Appearance> |
| <AxisLabel> |
| <TextBlock> |
| <Appearance TextProperties-Color="51, 51, 51"> |
| </Appearance> |
| </TextBlock> |
| </AxisLabel> |
| <Items> |
| <telerik:ChartAxisItem Value="100"> |
| </telerik:ChartAxisItem> |
| </Items> |
| </XAxis> |
| <YAxis> |
| <Appearance Color="Transparent" MajorTick-Color="174, 174, 174" MinorTick-Color="174, 174, 174"> |
| <MajorGridLines Color="40, 255, 255, 255" /> |
| <MinorGridLines Color="40, 255, 255, 255" /> |
| <TextAppearance TextProperties-Color="51, 51, 51"> |
| </TextAppearance> |
| </Appearance> |
| <AxisLabel> |
| <TextBlock> |
| <Appearance TextProperties-Color="51, 51, 51"> |
| </Appearance> |
| </TextBlock> |
| </AxisLabel> |
| </YAxis> |
| <Appearance Corners="Round, Round, Round, Round, 4"> |
| <FillStyle FillType="Image"> |
| <FillSettings BackgroundImage="{plotarea}" ImageAlign="Top" ImageDrawMode="Flip" |
| ImageFlip="FlipY"> |
| </FillSettings> |
| </FillStyle> |
| <Border Color="174, 174, 174" Width="4" /> |
| </Appearance> |
| </PlotArea> |
| <Appearance Corners="Round, Round, Round, Round, 10"> |
| <FillStyle FillType="Image"> |
| <FillSettings ImageDrawMode="Flip" BackgroundImage="{chart}"> |
| </FillSettings> |
| </FillStyle> |
| <Border Color="111, 111, 111"></Border> |
| </Appearance> |
| <ChartTitle> |
| <Appearance> |
| <FillStyle MainColor="Transparent"> |
| </FillStyle> |
| </Appearance> |
| <TextBlock> |
| <Appearance TextProperties-Font="Arial, 16pt"> |
| </Appearance> |
| </TextBlock> |
| </ChartTitle> |
| <Legend> |
| <Appearance Position-AlignedPosition="TopRight" Dimensions-Margins="16%, 3%, 1px, 1px"> |
| <ItemTextAppearance TextProperties-Color="Black"> |
| </ItemTextAppearance> |
| <FillStyle MainColor="Transparent"> |
| </FillStyle> |
| <Border Color="Transparent"></Border> |
| </Appearance> |
| </Legend> |
| </telerik:RadChart> |
I can't see what im doing wrong either, whenever i try to make a serie in the client side, the barwidthpercent does work, but the problem of that is that i cant dynamicly add series to the chart, depending on how much i need. Any solution?
thanks in advance