Telerik Forums
Reporting Forum
1 answer
165 views
I am programmatically building my bar chart, but I have been unable to set the colors for the bar chart bars. Any suggestions or ideas? I am using Q2 2011 Telerik Reporting.


private void chart1_NeedDataSource(object sender, EventArgs e)
    {
        /*
            Need to just do two things in the designer        
            1.) AutoLayout = True
            2.) Docking = Fill
         
        */
        DataTable dt = this.rptDt;

        this.chart1.DataSource = dt;
        chart1.Legend.Appearance.GroupNameFormat = "Qtr #VALUE";
        //return;

        //absolutely necessary these two lines of code:
        this.chart1.DataGroupColumn = "qtr";
        this.chart1.PlotArea.XAxis.DataLabelsColumn = "equipment";


        this.chart1.PlotArea.XAxis.AutoScale = true;
        this.chart1.Docking = DockingStyle.Fill;
        this.chart1.ChartTitle.TextBlock.Text = "Quarterly Equipment Failure";

        this.chart1.PlotArea.YAxis.Appearance.MajorGridLines.Visible = false;
        this.chart1.PlotArea.YAxis.Appearance.MinorGridLines.Visible = false;

        this.chart1.PlotArea.XAxis.Appearance.MajorGridLines.Visible = false;
        this.chart1.PlotArea.XAxis.Appearance.MinorGridLines.Visible = false;

        this.chart1.ClearSkin();
        this.chart1.Skin = string.Empty;
        this.chart1.SeriesPalette = string.Empty;

        this.chart1.Style.BackgroundColor = System.Drawing.Color.WhiteSmoke;
        this.chart1.PlotArea.Appearance.FillStyle.MainColor = Color.White;
        this.chart1.PlotArea.Appearance.FillStyle.FillType = Telerik.Reporting.Charting.Styles.FillType.Solid;
        //this.chart1.PlotArea.XAxis.Appearance.LabelAppearance.FillStyle.MainColor = System.Drawing.Color.Black;
        this.chart1.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Color = System.Drawing.Color.Black;
        this.chart1.PlotArea.YAxis.Appearance.TextAppearance.TextProperties.Color = System.Drawing.Color.Black;

        //chart1.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = 180;

        chart1.DefaultType = ChartSeriesType.Bar;
        chart1.SeriesOrientation = ChartSeriesOrientation.Horizontal;
        //chart1.SeriesOrientation = ChartSeriesOrientation.Vertical;

        ChartSeries cs = new ChartSeries();
        ChartSeriesItem csi;// = new ChartSeriesItem();       

        //Make 4 Series that are the Quarters (1,2,3,4)
        for (int i = 1; i < 5; i++)
        {
            cs = new ChartSeries("Qtr " + i.ToString(), ChartSeriesType.Bar);
            //add the new series to the chart:
            switch (i)
            {
                case 1:
                    cs.Appearance.LineSeriesAppearance.Color = System.Drawing.Color.Blue;
                    cs.Appearance.FillStyle.MainColor = System.Drawing.Color.Blue;                    
                    break;
                case 2:
                    cs.Appearance.LineSeriesAppearance.Color = System.Drawing.Color.Red;
                    cs.Appearance.FillStyle.MainColor = System.Drawing.Color.Red;
                    
                    break;
                case 3:
                    cs.Appearance.LineSeriesAppearance.Color = System.Drawing.Color.Yellow;
                    cs.Appearance.FillStyle.MainColor = System.Drawing.Color.Yellow;                    
                    break;
                case 4:
                    cs.Appearance.LineSeriesAppearance.Color = System.Drawing.Color.Green;
                    cs.Appearance.FillStyle.MainColor = System.Drawing.Color.Green;
                    break;
            }

            //make the bars solid instead of gradient
            cs.Appearance.FillStyle.FillType = Telerik.Reporting.Charting.Styles.FillType.Solid;
            cs.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.SeriesName;

            chart1.Series.Add(cs);
        }



        //now add each equipment fail count to the respective quarter:        
        //build the bars manually:
        foreach (DataRow r in dt.Rows)
        {
            //1.) Make a new series item for each new distinct Equipment item:
            csi = new ChartSeriesItem(Convert.ToDouble(r["failcount"]), r["failcount"].ToString());
            csi.Name = r["equipment"].ToString().Trim();

            csi.Appearance.FillStyle.MainColor = System.Drawing.Color.Purple;
            csi.Appearance.FillStyle.FillType = Telerik.Reporting.Charting.Styles.FillType.Solid;

            chart1.Series[Convert.ToInt32(r["qtr"]) - 1].AddItem(csi);
            
        }

        //show the years we used for the data:
        string msg = string.Empty;
        if (this.ReportParameters["YearsUsedInQuery"].Value.ToString().IndexOf("-") > 0)
            msg = "Years ";
        else
            msg = "Year ";

        this.chart1.PlotArea.YAxis.AxisLabel.TextBlock.Text = msg + this.ReportParameters["YearsUsedInQuery"].Value.ToString();
        this.chart1.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.TextProperties.Color = System.Drawing.Color.Black;
        this.chart1.PlotArea.YAxis.AxisLabel.Visible = true;

        //this.chart1.DataSource = dt;
        ///*
        foreach (ChartSeries cs1 in chart1.Series)
        {
            switch (cs1.Index + 1)
            {
                case 1:                     
                    cs1.PlotArea.XAxis.Appearance.Color = System.Drawing.Color.Blue;
                    foreach (ChartSeriesItem ci in cs1.Items)
                    {
                        ci.Appearance.FillStyle.MainColor = System.Drawing.Color.Purple;
                        ci.Appearance.Border.Color = System.Drawing.Color.Purple;
                        ci.Appearance.Exploded = true;
                        ci.Appearance.FillStyle.FillType = Telerik.Reporting.Charting.Styles.FillType.Solid;
                    }
                    break;
                case 2:
                    cs1.PlotArea.XAxis.Appearance.Color = System.Drawing.Color.Red;
                    break;
                case 3:
                    cs1.PlotArea.XAxis.Appearance.Color = System.Drawing.Color.Yellow;
                    break;
                case 4:
                    cs1.PlotArea.XAxis.Appearance.Color = System.Drawing.Color.Green;
                    break;
            }
        }
         //* */
    }
IvanDT
Telerik team
 answered on 18 Oct 2011
5 answers
1.2K+ views
Hi
 i want to show running total against each row . mydata is such as follows
A/C Debit Credit Balance
1 500 200 300
1 100 400
1 50 350
2 200 200
2 100 300
2 100 200

Here Balance is running total of Debit-Credit calculate w.r.t Acc No
where it is mentioned that running total support is not present in Q1 2009
is this already possible in Q1 2010 Version?
Please reply me s soon as possible

Peter
Telerik team
 answered on 18 Oct 2011
6 answers
589 views
Hi, 

I am new to Telerik Reporting and I am wondering how can I achieve the page break totals. I searched the forum but could not find any code snippet on how to use RunningValue function. When I converted the existing crystal report to Telerik report all the page running totals were not converted. Could you please guide me with some information.

Regards,
Suresh
Peter
Telerik team
 answered on 18 Oct 2011
1 answer
108 views
What I want to achieve is simple, but somehow I can't figure it out.
I want to create a product list that grouped by it's model.
But I want to put product model inline with details (see the picture attached).
Is it possible to do this?
Squall
Top achievements
Rank 1
 answered on 18 Oct 2011
2 answers
81 views
Hello.

I am using Telerik Reporting Q2 2011 and i am trying to STRIKEOUT some Telerik.Reporting.TextBox fields in the Telerik Silverlight Report - customer is very firm about striking fields (not underscoring, not bolding, not coloring....) but STRIKOEUT the field value.

  In the attachement there is a printscreen of how i set Strikeout property of the textBox and in the DESIGNER view TextBox field  has a visible line drawn across but when i RUN the Silverlight application text box field is NEVER striked out. (and styles for bold,italic,underscore etc works FINE only STRIKOEOUT style never shows in the field).

 Is this some SL or Telerik bug which is causing this effect? Maybe SL 5 will fix it? 

  Is there some workaround for this maybe? 

Setting Font-Strikeout

Thank you
Damir
john doe
Top achievements
Rank 1
 answered on 17 Oct 2011
3 answers
182 views
I am playing with the new WPF ReportViewer and am wondering if there is a secret to getting it to fill a container without overflow? It does just great when a specific height and width are set, but if I remove the height and width settings from the XAML tag and just let it fill up the enclosing grid cell, when my reports are long it overflows. Instead of the edge of the ReportViewer being contained and the vertical scrollbar being activated, it just pushes beyond the edge of the window.

Any tips or ideas? I'd like to have a window that users can resize, and ideally I'd like to do so without having to code something that catches a resize-type event and calculates a new specific size for the report viewer.

Thanks in advance for any ideas.....

J
Ashif
Top achievements
Rank 1
 answered on 14 Oct 2011
3 answers
342 views
HI,

When i implemented the telerik report viewer in my asp.net MVC application the report viewer tool bar icons are misalighned and appearing twice. Print, Refresh and the navigation icons are appearing twice.

Please find an attached screen shot of the report viewer that i am working on.

Appreciate your response to fix this cosmetic issue.

Thanks,
Pradeep K S
pradeep
Top achievements
Rank 1
 answered on 14 Oct 2011
4 answers
75 views
I got this Javascript error in my WebViewer (roughly translated in english):
"unable to get the value of 'rows' property: object not set to instance (null)"

Then Visual Studio 2010 stops in the following js function:

ReportViewer.prototype.get_Height = function ()
{
    var reportTable = document.getElementById(this.reportTableId);
    var lastRow = reportTable.rows[reportTable.rows.length - 1];
    var oldDisplay = lastRow.style.display;
    lastRow.style.display = "none";
 
    var viewer = document.getElementById(this.clientID);
    var clientHeight = viewer.clientHeight;
    lastRow.style.display = oldDisplay;
    return clientHeight;
}

the extact line that fires the error is:
var lastRow = reportTable.rows[reportTable.rows.length - 1];

I'm using Q2 2011 SP1.
Thank you.
Tsvetoslav
Telerik team
 answered on 14 Oct 2011
5 answers
694 views
Dear support team,

is there a way to print a vertical Line in the whole document (in details).
The line is printed only in the lines with values (See image).

Thank you in advance,
George.
Navarino Technology Department.
Alfredo
Top achievements
Rank 1
 answered on 13 Oct 2011
1 answer
148 views
Hello,

    Is there a zooming facility available in the chart report. I have the zoom feature available in the Report Viewer but it zoom’s the entire page. The feature I would like to have is to zoom in the chart for clear view. The report I have consists of the table in the detail section and the chart in the Report Header section, and now I would like to zoom in the chart only not in the detail section.

I am using visual studio 2010, Telerik Reporting (licensed -TV446243)

Regards,
Saravanan.R

Steve
Telerik team
 answered on 13 Oct 2011
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?