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
Unable to create Title for Chart
posted

I have created a simple chart in Excel. I've never used the charting capability. My first question is - Do you have any good documentation on how to use all of the Excel for Javascript features. Nothing I find online is sufficient to describe all features and how to use them.

Below is very simplified code. I'm only testing, so haven't even filled the chart with data. Prior to this I've already created the workbook.

var chartTitle;
Chart1 = wschart.shapes().addChart($.ig.excel.ChartType.barClustered, cell1, { x: 0, y: 0 }, cell2, { x: 100, y: 100 });
chartTitle = new $.ig.excel.ChartTitle();
chartTitle.text = "Some Text";
Chart1.chartTitle(chartTitle);

None of the above gives me an error until I Save the Excel document, then I receive the following error.

j.text is not a function

If this is not how to define a title for a chart, please tell me how. I can find no online documentation describing how to do what should be a very simple task.

  • 54937
    Verified Answer
    Offline posted

    I'm sorry. It looks like we have some issues with the new chart related classes not showing up in the TOC that we'll look into. With regards to the specific question of setting the title of the chart, the text is a method of the ChartTitle (actually of its base ChartTextAreaBase) and so would be invoked as text() to get the current FormattedString instance or text(new $.ig.excel.FormattedString("Some Text")) to set it to a new FormattedString instance.