Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2515
Issue with setSourceData with single point in series
posted

I'm creating a chart that has a single series and a single point in the series. An example is:

chart.setSourceData('sheet!A1:B1', false), where the categories are in column A.

This method call is creating 2 series and is treating the value in B1 as the category value and the series point value. The chart is a barClustered.

Is there a way to work around this issue?

  • 280
    Offline posted

    Hello Ray,

    If you need any further assistance on this, just let us know.

    Best regards, 

    Hristo Popov

  • 54937
    Verified Answer
    Offline posted

    The setSourceData method is a helper method that tries to do some of the logic that Excel does when you select a range and insert a chart but in some cases it differs. You could just directly create the series like this

    var series = chart.seriesCollection().add();
    series.name(new $.ig.excel.SeriesName(sheet, "Sheet1!A1"));
    series.values(new $.ig.excel.SeriesValues(sheet, "Sheet1!B1"));
    

  • 2515
    Offline posted

    ChartTestSinglePoint.zip

    Sample for testing is attached. We are currently using 2018.2 but will be migrating to 2019.1.