> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chartbrew.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Quick Create Chart

> Quick create a chart with all its chart dataset configs in one API call

<Note>
  Set per-series visualization bindings on each `chartDatasetConfigs[]` item.
  That includes `xAxis`, `yAxis`, `yAxisOperation`, `dateField`, `dateFormat`, `conditions`, `formula`, and `legend`.
</Note>

<Note>
  `legend` is chart-specific label text. If you omit it, Chartbrew falls back to the dataset name.
</Note>


## OpenAPI

````yaml POST /project/{project_id}/chart/quick-create
openapi: 3.0.1
info:
  title: Chartbrew API reference
  description: The OpenAPI specification for Chartbrew
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.chartbrew.com
security:
  - bearerAuth: []
paths:
  /project/{project_id}/chart/quick-create:
    post:
      description: Quickly create a chart with all its chart dataset configs in one go
      parameters:
        - name: project_id
          in: path
          description: ID of the project
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QuickNewChart'
      responses:
        '200':
          description: Created chart with all chart dataset configs
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Chart'
        '400':
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Not authorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Access denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    QuickNewChart:
      type: object
      required:
        - project_id
        - name
        - type
      description: >-
        Create a chart with all its chart dataset configs in one API call.
        Per-series bindings belong in each chartDatasetConfigs item.
      properties:
        project_id:
          type: integer
          description: ID of the project
        name:
          type: string
          description: Name of the chart
        type:
          type: string
          description: The type of chart
          enum:
            - line
            - bar
            - pie
            - doughnut
            - radar
            - polar
            - table
            - kpi
            - avg
            - gauge
            - matrix
            - markdown
        subType:
          type: string
          description: >-
            The sub-type of chart, currently only AddTimeseries is supported for
            accumulating timeseries data
        public:
          type: boolean
          default: false
          description: Whether the chart is public
        shareable:
          type: boolean
          default: false
          description: Whether the chart is shareable
        displayLegend:
          type: boolean
          default: false
          description: Whether to display the chart.js legend
        pointRadius:
          type: integer
          description: 0 to hide, integer value to set the point radius
        dataLabels:
          type: boolean
          default: false
          description: Whether to display the data labels on each data point on the chart
        startDate:
          type: string
          format: date-time
          description: Used to inject a fixed start date into the chart
        endDate:
          type: string
          format: date-time
          description: Used to inject a fixed end date into the chart
        dateVarsFormat:
          type: string
          description: The format of the date variables in the chart
        includeZeros:
          type: boolean
          default: true
          description: Whether to include zero-valued data points in the chart
        currentEndDate:
          type: boolean
          default: false
          description: >-
            Whether to use the current end date as the end date for the chart -
            this moves the start date to match the original period length
        fixedStartDate:
          type: boolean
          default: false
          description: Whether to force the start date to remain fixed
        timeInterval:
          type: string
          default: day
          enum:
            - second
            - minute
            - hour
            - day
            - week
            - month
            - year
          description: The time interval of the chart
        autoUpdate:
          type: integer
          description: >-
            The interval in seconds at which the chart should be automatically
            updated
        draft:
          type: boolean
          default: true
          description: >-
            Whether the chart is a draft and should be hidden from dashboard
            viewers
        mode:
          type: string
          default: chart
          enum:
            - chart
            - kpichart
          description: >-
            Chart mode shows just the chart, kpichart shows a KPI on top of the
            chart.
        maxValue:
          type: integer
          description: Cap the maximum shown value on the chart
        minValue:
          type: integer
          description: Cap the minimum shown value on the chart
        disabledExport:
          type: boolean
          description: Whether to disable the export button for the chart
        onReport:
          type: boolean
          default: true
          description: Whether to display the chart on the report
        xLabelTicks:
          type: string
          default: default
          enum:
            - default
            - half
            - third
            - fourth
            - showAll
          description: How many ticks to display on the x-axis
        stacked:
          type: boolean
          default: false
          description: Whether to stack the chart - only works for bar charts
        horizontal:
          type: boolean
          default: false
          description: >-
            Whether to display the chart horizontally - only works for bar
            charts
        showGrowth:
          type: boolean
          default: false
          description: Whether to show the growth percentage at the top of the chart
        invertGrowth:
          type: boolean
          default: false
          description: When negative growth is meant to be positive and vice versa
        layout:
          type: object
          description: >-
            The layout of the chart - in the format of react-grid-layout. If not
            provided, will be automatically calculated based on existing charts
            in the project.
          additionalProperties:
            type: array
            items:
              type: number
        isLogarithmic:
          type: boolean
          default: false
          description: Whether to use a logarithmic scale for the y-axis
        content:
          type: string
          description: The content used for type=markdown
        ranges:
          type: object
          description: The ranges to display on the chart - only works for gauge charts
          properties:
            ranges:
              type: array
              items:
                type: object
                properties:
                  min:
                    type: number
                  max:
                    type: number
                  label:
                    type: string
        dashedLastPoint:
          type: boolean
          default: false
          description: >-
            Whether to dash the last point on the chart - only works for line
            charts
        defaultRowsPerPage:
          type: integer
          default: 10
          description: Default number of rows per page for table charts
        chartDatasetConfigs:
          type: array
          description: >-
            Array of chart dataset configs to create with the chart. The
            chart_id will be automatically set.
          items:
            $ref: '#/components/schemas/QuickNewChartDatasetConfig'
            type: object
    Chart:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        type:
          type: string
          enum:
            - line
            - bar
            - pie
            - doughnut
            - radar
            - polar
            - table
            - kpi
            - avg
            - gauge
            - matrix
            - markdown
        subType:
          type: string
        chartData:
          type: object
        chartDataUpdated:
          type: string
          format: date-time
        project_id:
          type: string
        public:
          type: boolean
        shareable:
          type: boolean
        ChartDatasetConfigs:
          type: array
          items:
            $ref: '#/components/schemas/ChartDatasetConfig'
            type: object
    Error:
      type: object
      properties:
        message:
          type: string
        error:
          type: string
    QuickNewChartDatasetConfig:
      type: object
      description: >-
        Chart dataset config to create. chart_id is automatically set. Per-chart
        bindings such as xAxis, yAxis, dateField, and conditions belong here.
      required:
        - dataset_id
      properties:
        dataset_id:
          type: integer
          description: ID of the dataset to bind to the chart
        xAxis:
          type: string
          description: >-
            Chart-specific x-axis or dimension field using traversal syntax -
            root[].field
        xAxisOperation:
          type: string
          description: Chart-specific x-axis operation
        yAxis:
          type: string
          description: >-
            Chart-specific y-axis or metric field using traversal syntax -
            root[].field
        yAxisOperation:
          type: string
          description: >-
            Chart-specific operation to perform on the y-axis - none, sum, avg,
            min, max, count
          enum:
            - none
            - count
            - count_unique
            - sum
            - avg
            - min
            - max
        dateField:
          type: string
          description: >-
            Chart-specific date field using traversal syntax. Specifies which
            field should be used for date filtering.
        dateFormat:
          type: string
          description: Chart-specific date format to use for date filtering. e.g YYYY-MM-DD
        conditions:
          type: array
          description: Chart-specific conditions layered on top of the dataset
          items:
            type: object
            properties:
              id:
                type: string
              field:
                type: string
                description: Field using traversal syntax - root[].field
              operator:
                type: string
                enum:
                  - is
                  - isNot
                  - greaterThan
                  - lessThan
                  - greaterThanOrEqual
                  - lessThanOrEqual
                  - contains
                  - notContains
                  - isNull
                  - isNotNull
                description: Comparison operator
              value:
                type: string
              displayValues:
                type: boolean
                description: Whether to display the values in the dropdown UI
        formula:
          type: string
          description: >-
            The formula (e.g {val / 100}) used to transform the data points
            values. Can be used to pre-(a)pend strings to numbers too £{val}
        datasetColor:
          type: string
          description: The color of the dataset
        fillColor:
          type: string
          description: The color of the dataset fill
        fill:
          type: boolean
          default: false
          description: Whether to fill the dataset
        multiFill:
          type: boolean
          default: false
          description: >-
            Useful for the UI to prompt the user to select multiple colors for
            the dataset
        legend:
          type: string
          description: >-
            The chart-specific legend label for this dataset. If not provided,
            will fall back to the dataset name.
        pointRadius:
          type: integer
          description: Point radius for the dataset
        excludedFields:
          type: array
          items:
            type: string
          description: The fields to exclude from the dataset - used for tables
        sort:
          type: string
          enum:
            - asc
            - desc
          description: The sort order of the dataset
        columnsOrder:
          type: array
          items:
            type: string
          description: The order of the columns in the dataset - used for tables
        order:
          type: number
          default: 1
          description: The order of the dataset in the chart
        maxRecords:
          type: integer
          description: The maximum number of records to display in the dataset
        goal:
          type: integer
          description: The goal of the dataset - used to display a progress bar for KPIs
        configuration:
          type: object
          description: >-
            Additional configuration options for the dataset. Currently used to
            give values to variables.
          properties:
            variables:
              type: array
              items:
                type: object
                properties:
                  name:
                    type: string
                    description: Variable name from DataRequest VariableBinding
                  value:
                    description: Override value (string, number, etc.)
                    oneOf:
                      - type: string
                      - type: number
                      - type: boolean
    ChartDatasetConfig:
      type: object
      properties:
        id:
          type: string
          format: uuid
        chart_id:
          type: integer
        dataset_id:
          type: integer
        xAxis:
          type: string
          description: >-
            Chart-specific x-axis or dimension field using traversal syntax -
            root[].field
        xAxisOperation:
          type: string
          description: Chart-specific x-axis operation
        yAxis:
          type: string
          description: >-
            Chart-specific y-axis or metric field using traversal syntax -
            root[].field
        yAxisOperation:
          type: string
          description: >-
            Chart-specific operation to perform on the y-axis - none, sum, avg,
            min, max, count
        dateField:
          type: string
          description: >-
            Chart-specific date field using traversal syntax. Specifies which
            field should be used for date filtering.
        dateFormat:
          type: string
          description: Chart-specific date format to use for date filtering. e.g YYYY-MM-DD
        conditions:
          type: array
          description: Chart-specific conditions layered on top of the dataset
          items:
            type: object
            properties:
              id:
                type: string
              field:
                type: string
                description: Field using traversal syntax - root[].field
              operator:
                type: string
                enum:
                  - is
                  - isNot
                  - greaterThan
                  - lessThan
                  - greaterThanOrEqual
                  - lessThanOrEqual
                  - contains
                  - notContains
                  - isNull
                  - isNotNull
                description: Comparison operator
              value:
                type: string
              displayValues:
                type: boolean
                description: Whether to display the values in the dropdown UI
        formula:
          type: string
        datasetColor:
          type: string
        fillColor:
          type: string
        fill:
          type: boolean
          default: false
        multiFill:
          type: boolean
          default: false
        legend:
          type: string
        pointRadius:
          type: integer
        excludedFields:
          type: array
          items:
            type: string
        sort:
          type: string
        columnsOrder:
          type: array
          items:
            type: string
        order:
          type: integer
          default: 0
        maxRecords:
          type: integer
        goal:
          type: integer
        configuration:
          type: object
          description: >-
            Additional configuration options for the dataset. Currently used to
            give values to variables.
          properties:
            variables:
              type: array
              items:
                type: object
                properties:
                  name:
                    type: string
                    description: Variable name from DataRequest VariableBinding
                  value:
                    description: Override value (string, number, etc.)
                    oneOf:
                      - type: string
                      - type: number
                      - type: boolean
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````