Skip to content

How to customizing behavior with perspective.config.js #989

Closed
@Madasamy26

Description

I have read the documentation
https://perspective.finos.org/docs/md/js.html#customizing-behavior-with-perspectiveconfigjs

As per documentation
I have created perspective.config.js
In that I have replaced settings.js content,
If, I change any formatting in that existing type it is working,

but, If we are try to add new type the build is broken,

module.exports.default  = {
  types: {
    price: {
      type:float
      format: {
        style: "decimal",
        minimumFractionDigits: 2,
        maximumFractionDigits: 2
      }
    },
    float: {
      /**
       * Which filter operator should be the default when a column of this
       * type is pivotted.
       */
      filter_operator: "==",

      /**
       * Which aggregate should be the default when a column of this type
       * is pivotted.
       */
      aggregate: "sum",

      /**
       * The format object for this type.  Can be either an
       * `toLocaleString()` `options` object for this type (or supertype),
       * or a function which returns the formatted string for this type.
       */
      format: {
        style: "decimal",
        minimumFractionDigits: 2,
        maximumFractionDigits: 2
      }
    },
    string: {
      filter_operator: "==",
      aggregate: "count"
    },
    integer: {
      filter_operator: "==",
      aggregate: "sum",
      format: {}
    },
    boolean: {
      filter_operator: "==",
      aggregate: "count"
    },
    datetime: {
      filter_operator: "==",
      aggregate: "any",
      format: {
        week: "numeric",
        year: "numeric",
        month: "numeric",
        day: "numeric",
        hour: "numeric",
        minute: "numeric",
        second: "numeric"
      },
      null_value: -1
    },
    date: {
      filter_operator: "==",
      aggregate: "count",
      format: {
        week: "numeric",
        year: "numeric",
        month: "numeric",
        day: "numeric"
      },
      null_value: -1
    },
  }
};

error is like 'ReferenceError: float is not defined'

any help would be appreciated.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions