Skip to Content
author's profile photo Former Member
Former Member


I am using CRVS2010 and trying to get access to the text of the x and y axis in a graph.

Using the ReportAppServer.ReportDefModel.ChartObject I do not see a way to do this.

I need to get to this text in order to provide foreign language support at runtime.

Is there someway I can do this ?

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Jul 15, 2011 at 05:08 PM

    Hi Doyle,

    Our Charting dll is a third party dll so it's limited in what you can get to. In CR Designer right click on the chart and Select Chart Expert. Those are the only option that at one time could be accessed but in .NET it's even less now.

    You may have to do this in CR Designer using formula to replace the characters.

    I do have this sample code to add a chart at runtime. I may work for you also, delete your existing chart and add this code ti add the new one...

    private void AddChart_Click(object sender, EventArgs e)
        CrystalDecisions.ReportAppServer.ReportDefModel.ChartObject boChartObject;
        CrystalDecisions.ReportAppServer.ReportDefModel.ChartStyle boChartStyle;
        CrystalDecisions.ReportAppServer.ReportDefModel.Section boSection;
        CrystalDecisions.ReportAppServer.DataDefModel.Fields boFields;
        CrystalDecisions.ReportAppServer.DataDefModel.Field boField;
        CrystalDecisions.ReportAppServer.DataDefModel.SummaryField boSummaryField;
        int boFieldIndex;
        rpt.Load("D:\\CPP Net\\RASXIR2Printer2K8\\rcapi_cs_add_chart\\SimpleRCAPIReport.rpt");
        rptClientDoc = rpt.ReportClientDocument;
        boFields = rptClientDoc.DatabaseController.Database.Tables[0].DataFields;
        //Create a chart
        boChartObject = new CrystalDecisions.ReportAppServer.ReportDefModel.ChartObject();
        //create a bar chart style
        boChartStyle = new CrystalDecisions.ReportAppServer.ReportDefModel.ChartStyle();
        boChartStyle.Type = CrystalDecisions.ReportAppServer.ReportDefModel.CrChartStyleTypeEnum.crChartStyleTypeBar;
        //set the chart style to bar chart
        boChartObject.ChartStyle = boChartStyle;
        //set the chart type to advanced chart
        boChartObject.ChartDefinition.ChartType = CrystalDecisions.ReportAppServer.ReportDefModel.CrChartTypeEnum.crChartTypeDetail;
        //set Customer Name field as condition field
        //get the Customer Name field
        boFieldIndex = boFields.Find("Customer Name",
        boField = (CrystalDecisions.ReportAppServer.DataDefModel.Field)boFields[boFieldIndex];
        boField = null;
        //set Last Year's Sales as data field
        //get {Customer.Last Year's Sales field}
        boFieldIndex = boFields.Find("Last Year's Sales",
        boField = (CrystalDecisions.ReportAppServer.DataDefModel.Field)boFields[boFieldIndex];
        //create a Sum({Customer.Last Year's Sales})
        boSummaryField = new CrystalDecisions.ReportAppServer.DataDefModel.SummaryField();
        boSummaryField.SummarizedField = boField;
        boSummaryField.Operation = CrystalDecisions.ReportAppServer.DataDefModel.CrSummaryOperationEnum.crSummaryOperationSum;
        boSummaryField.Type = boField.Type;
        //add summary field to report client document
        rptClientDoc.DataDefController.SummaryFieldController.Add(-1, boSummaryField);
        //set chart coordinates and dimensions (0, 0), width = 7 inches, height = 5 inches
        boChartObject.Left = 0;
        boChartObject.Top = 0;
        boChartObject.Width = 7 * 1440;      // 1 inch = 1440 twips
        boChartObject.Height = 5 * 1440;
        //get report header section
        boSection = rptClientDoc.ReportDefinition.ReportHeaderArea.Sections[0];
        //set chart report area to report header
        boChartObject.ChartReportArea = CrystalDecisions.ReportAppServer.ReportDefModel.CrAreaSectionKindEnum.crAreaSectionKindReportHeader;
        //add chart in the report header
        rptClientDoc.ReportDefController.ReportObjectController.Add(boChartObject, boSection, -1);
        MessageBox.Show("Chart Added", "RAS", MessageBoxButtons.OK, MessageBoxIcon.Information);


    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 15, 2011 at 07:11 PM

    Thanks Don , Can you point me to the part of the api where I can get to the formula(s) ?

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Don Williams

      Don, I think the light bulb just went on for me. I was expecting the ChartObject.ChartStyle.TextOptions to present X and Y label text properties per the VISUAL STUDIO properties window on the Graph !!! Now that I open the Chart in Design view and Select Chart Options I see that the designer presents the Y axis labeled Group Title and the X axis as Data Title and there are properties for both of these on ChartObject.ChartStyle.TextOptions.

      This may be easier than we thought.

      Can you take a look at my other thread of today were I am getting an error on getting a reference to a ISCDReportClientDocument.

      Almost there and thanks a bunch...

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.