Skip to content

Unable to use shortTitle in .series() #673

Open
@Cmd-B

Description

@Cmd-B

In my ChartRenderer.js I was able to use shortTitle as seen below to remove the database prefix off of my table (antd) column titles.

  table: ({ resultSet }) => (
    <Table
      pagination={false}
      columns={resultSet.tableColumns().map(c => ({ title: c.shortTitle, key: c.key, dataIndex: c.key }))}
      dataSource={resultSet.tablePivot()}
    />
  )

When attempting to use this on my bar graph (chartjs) I was unable to get a similar result.

bar: ({ resultSet }) => {
    const data = {
      labels: resultSet.categories().map(c => c.category),
      datasets: resultSet.series().map((s, index) => ({
        label: s.shortTitle,
        data: s.series.map(r => r.value),
        backgroundColor: COLORS_SERIES[index],
        fill: false
      }))
    };
    const options = {
      scales: {
        xAxes: [
          {
            stacked: true
          }
        ]
      }
    };
    return <Bar data={data} options={options} />;

here is where I am hoping to expose shortTitle:
https://github.com/cube-js/cube.js/blob/master/packages/cubejs-client-core/src/ResultSet.js#L74-L80

Metadata

Metadata

Assignees

No one assigned

    Labels

    client:coreIssues relating to the JavaScript client SDKenhancementNew feature proposalhelp wantedCommunity contributions are welcome.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions