Y-Axis items get cut++

Thread is closed for posting
2 posts, 0 answers
  1. Warnestam
    Warnestam avatar
    83 posts
    Member since:
    Sep 2006

    Posted 15 Sep 2008 Link to this post

    Hi,

    I have some questions with a chart that is constructed with the following code (the aspx does not change any properties);
    System.Drawing.Color COLOR_LINE = System.Drawing.Color.FromArgb(0xcc, 0xcc, 0xcc);  
            System.Drawing.Color COLOR_FUEL = System.Drawing.Color.FromArgb(0xaf, 0x93, 0x26);  
            System.Drawing.Color COLOR_EMPTY = System.Drawing.Color.FromArgb(0xcc, 0xcc, 0xcc);  
            System.Drawing.Color COLOR_BACKGROUND = System.Drawing.Color.FromArgb(0xff, 0xff, 0xff);  
     
     
            int maxLevel = 10000;  
            int currentLevel = 8000;  
     
            int level1 = currentLevel;  
            int level2 = maxLevel - level1;  
     
            // Current level  
            ChartSeries series1 = new ChartSeries();  
            series1.Name = String.Format("Current level: {0}", currentLevel);  
            series1.Type = ChartSeriesType.StackedBar;  
            series1.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Gradient;  
            series1.Appearance.FillStyle.MainColor = COLOR_FUEL;  
            series1.Appearance.FillStyle.SecondColor = System.Drawing.Color.Transparent;  
            series1.Appearance.LabelAppearance.Visible = false;  
            series1.Appearance.Border.Color = COLOR_LINE;  
            series1.AddItem(level1);  
            chart.Series.Add(series1);  
     
            // Max level  
            ChartSeries series2 = new ChartSeries();  
            series2.Name = String.Format("Max level: {0}", maxLevel);  
            series2.Type = ChartSeriesType.StackedBar;  
            series2.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Gradient;  
            series2.Appearance.FillStyle.MainColor = COLOR_EMPTY;  
            series2.Appearance.FillStyle.SecondColor = System.Drawing.Color.Transparent;  
            series2.Appearance.LabelAppearance.Visible = false;  
            series2.Appearance.Border.Color = COLOR_LINE;  
            series2.AddItem(level2);  
            chart.Series.Add(series2);  
     
            // Settings  
            chart.Appearance.Border.Visible = false;  
            chart.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid;  
            chart.Appearance.FillStyle.MainColor = System.Drawing.Color.Transparent;  
            chart.ChartTitle.Visible = false;  
            chart.PlotArea.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid;  
            chart.PlotArea.Appearance.FillStyle.MainColor = System.Drawing.Color.Transparent;  
            chart.PlotArea.Appearance.Border.Visible = false;  
            chart.PlotArea.XAxis.LayoutMode = Telerik.Charting.Styles.ChartAxisLayoutMode.Between;  
            chart.Legend.Appearance.Border.Color = COLOR_LINE;  
            chart.PlotArea.XAxis.Appearance.LabelAppearance.Visible = false;  
            chart.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.Border.Color = System.Drawing.Color.Red;  
            chart.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.Border.Width = 1;  
            chart.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.Border.Visible = true;  
     
            chart.PlotArea.YAxis.Appearance.LabelAppearance.Dimensions.Width = Telerik.Charting.Styles.Unit.Pixel(300);  
            chart.PlotArea.YAxis.AxisLabel.Appearance.Dimensions.Width = Telerik.Charting.Styles.Unit.Pixel(299);  
            chart.PlotArea.YAxis.AxisLabel.Appearance.Position.Auto = false;  
            chart.PlotArea.YAxis.Appearance.TextAppearance.Position.Auto = false;  
            chart.PlotArea.YAxis.Appearance.TextAppearance.Dimensions.Width = Telerik.Charting.Styles.Unit.Pixel(200);  
     
     
            chart.Appearance.BarWidthPercent = 50;  
            chart.Width = new Unit(350, UnitType.Pixel);  
            chart.Height = new Unit(250, UnitType.Pixel); 

    Q1) The values on the Y-Axis get cut
    Q2) Is it possible to adjust the space between the Y-axis and the bar?
    Q3) How do I prevent the legend to overlap the bar?
    Q4) Can I add a extra row of information in the legend?
    Q5) Can the width of the area inside the axis be set in pixel

    Best regards

    Robert
  2. Warnestam
    Warnestam avatar
    83 posts
    Member since:
    Sep 2006

    Posted 16 Sep 2008 Link to this post

    I normally use my Rad-Help file which didn't helped me in this case. But I found good information at http://www.telerik.com/help/aspnet-ajax/radchartbasics.html.

    So I try to answer my own quesitons here;

    Q1) The values on the Y-Axis get cut

    Increase the margins (RadChart.PlotArea.Appearance.Dimensions.Margins)

    Q2) Is it possible to adjust the space between the Y-axis and the bar?

    Can be done using the same margins as in Q1 togehter with RadChart.Appearance.BarWidthPercent.

    Q3) How do I prevent the legend to overlap the bar?

    Also using margins to minimize the area for my single stackbar.

    Q4) Can I add a extra row of information in the legend?

    Yes of course. RadChart.PlotArea.Chart.Legend.AddLabel

    Q5) Can the width of the area inside the axis be set in pixel
     
    Solved again using the margin property.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top