none
Creating a combined chart in code RRS feed

  • Question

  • Hi all;

    I'm trying to create a chart in my AddIn (C#, COM - not VSTO). This chart has several series that may be of different types (i.e. column and line). And I have the data for each individual series held separately, even though several series may have the same X axis data points. A couple of questions:

    1. Is it correct that a chart has no concept of a group of series all being a column graph set and another group being a line graph set? Is it that a chart has a collection of series, each series has a type, and it then works it's magic on display?
    2. If all the series are the same chart type, then I do I set just ChartObject.Chart.ChartType? But if I have several types, then I do not set ChartObject.Chart.ChartType and instead for each series do I set Series.SeriesType for each?
    3. When setting the range for a series, is the chart any better if the backing Range in a worksheet shares the X data? Or is it just as good if each series has a Range that has no shared cells with any other series? I ask because it's a lot easier for me if they each are totally distinct (because of how I get the data).
    4. And a corollary to #3, if one series is missing an X value another has in it, is that a problem? For example, I'm graphing sales per day for stores and one store is closed Mondays and therefore has no number for that day. (It's XML data so it's not a null or 0, the data just doesn't exist.)
    5. When setting the data for a series, is it best if I call Series.Name, Series.XValues, and Series.Values to give it the series title and data? Or is another set of calls better?

    thanks - dave


    What we did for the last 6 months - Made the world's coolest reporting & docgen system even more amazing

    Wednesday, October 24, 2018 9:42 PM

All replies

  • Hi David,

    I'm not sure that what is your final demand.

    I remmcomend you could split your question into several parts and raise some examples for them so that we can solve your issue more targeted.

    Best Regards,

    Bruce


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.

    Thursday, October 25, 2018 8:55 AM
    Moderator
  • Hi Bruce;

    I broke out the questions as you requested. Please let me know if any of them are unclear, and if so, what exactly you need me to add to the question.

    1. Q1
    2. Q2
    3. Q3
    4. Q4
    5. Q5

    thanks - dave


    What we did for the last 6 months - Made the world's coolest reporting & docgen system even more amazing

    Thursday, October 25, 2018 12:24 PM