Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7594839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:31:16+00:00 2026-05-30T21:31:16+00:00

I need to create a chart in excel in a delphi application based on

  • 0

I need to create a chart in excel in a delphi application based on some data from a table.

I created the excel worksheet and filled n rows of data from the table. Now I need to make the chart based on the data.

We have to add two Legent entries(categories) – D5:D15 and E5:E15
and one Horizontal(Category) Axis labels -F5:F15

I tried the following to get this.
When executed I got the error message

Method ‘setsourcedata’ not supported by automation object.

I tried the SeriesCollection.item.value method then also the system gave the same message.

procedure TForm1.Make_a_Chart;
var
  Sheets,Ch1 : Variant;
begin
  ch1 := XLApp.ActiveWorkBook.Sheets[1].ChartObjects.Add ( 500,100,400,200 ); // creates a new chart in the specified 
  Sheets := XLApp.Sheets;
  ch1.Chart.ChartWizard (
                         Sheets.Item['Delphi Data'].Range['D5:D15'],   // 1  Source
                         xlBarStacked, //  2  The chart type.
                         8,            //  3  Format - The option number for the built-in autoformats. Can be a number from 1 through 10, depending on the gallery type.
                         2,            //  4  PlotBy - Specifies whether the data for each series is in rows or columns. Can be one of the following XlRowCol constants.
                         1,            //  5  CategoryLabels - An integer specifying the number of rows or columns within the source range that contain category labels.
                         1,            //  6  SeriesLabels - An integer specifying the number of rows or columns within the source range that contain series labels.
                         False,        //  7  HasLegend - 'true' to include a legend.
                         'My Report',  // 8  Title - The Chart control title text.
                         'Y Axis',      // 9  CategoryTitle - The category axis title text.
                         'X Axis',      // 10  ValueTitle - The value axis title text
                         2                //  11  ExtraTitle - The series axis title for 3-D charts or the second value axis title for 2-D charts.
                       );
  ch1.setsourcedata(Sheets.Item['Delphi Data'].Range['E5:E15'],xlColumns,2);
  ch1.Chart.ChartType := xlBarStacked;
// ch1.SeriesCollection.Item[1].Values := Sheets.Item['Delphi Data'].Range['E5:E15'];
end;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T21:31:18+00:00Added an answer on May 30, 2026 at 9:31 pm

    You are calling SetSourceData on a ChartObject object, not a Chart object. The ChartObject object is a container for the Chart object. The Chart object has the method SetSourceData, so use this:

    ch1.Chart.SetSourceData(Sheets.Item['Delphi Data'].Range['E5:E15'],xlColumns,2);
    

    Edit: Your codesample is very confusing. Please, when asking a question, try to tidy your code. I see a lot of unused variables and you use a variable ch1 that isn’t declared in the var section.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create a Chart which will grab data from external sources when
I need to create Stock CandleStick chart from scratch, Because we have some complex
I need to create excel sheet from my Java code which contains charts like
I am using excel to draw charts from c#, but i need the chart
I need to create an excel file from scratch in VB.NET given a DataTable
I need to create a column chart from values that I have stored in
I have created and Excel 2007 based dynamic charting application that that charts various
I need to create an excel file with simple text data. Concretely, it will
i need to create a chart similar to this: link text Do you have
I need to create a historical timeline starting from 1600's to the present day.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.