Giter Club home page Giter Club logo

vue-pivottable's Introduction

Vue Pivottable

It is a Vue port of the jQuery-based PivotTable.js

npm npm npm jsdelivr

All Contributors

Documentation

You can view the documentation at https://seungwoo321.github.io/vue-pivottable. It's also lighter by removing vue-plotly from the dependencies.

Live Demo

link

Example Code

# Clone the project
git clone https://github.com/Seungwoo321/vue-pivottable.git

# Go into the cloned directory
cd vue-pivottable/example/

# npm install
npm install

# npm run serve
npm run serve

Open browser to http://localhost:8080

vue-pivottable-demo.gif

Installation

npm i vue-pivottable

Usage

  • Vue Pivottable
<template>
  <vue-pivottable
    :data="[{color: 'blue', shape: 'circle'},{color: 'red', shape: 'triangle'}]"
    :rows="['color']"
    :cols="['shape']"
  >
  </vue-pivottable>
</template>

<script>
import { VuePivottable } from 'vue-pivottable'
import 'vue-pivottable/dist/vue-pivottable.css'
export default {
  components: {
    VuePivottable
  }
}
</script>
  • Vue Pivottable Ui
<template>
  <vue-pivottable-ui
    :data="[{color: 'blue', shape: 'circle'},{color: 'red', shape: 'triangle'}]"
    :rows="['color']"
    :cols="['shape']"
  >
  </vue-pivottable-ui>
</template>

<script>
import { VuePivottableUi } from 'vue-pivottable'
import 'vue-pivottable/dist/vue-pivottable.css'
export default {
  components: {
    VuePivottableUi
  }
}
</script>
<template>
  <vue-pivottable-ui
    :data="[{color: 'blue', shape: 'circle'},{color: 'red', shape: 'triangle'}]"
    renderer-name="Area Chart"
    :rows="['color']"
    :cols="['shape']"
    :renderers="renderers"
  >
  </vue-pivottable-ui>
</template>

<script>
import { VuePivottableUi } from 'vue-pivottable'
import PlotlyRenderer from '@vue-pivottable/plotly-renderer'
import 'vue-pivottable/dist/vue-pivottable.css'
export default {
  components: {
    VuePivottableUi
  },
  computed: {
    renderers () {
      return (() => ({
        'Grouped Column Chart': PlotlyRenderer['Grouped Column Chart'],
        'Stacked Column Chart': PlotlyRenderer['Stacked Column Chart'],
        'Grouped Bar Chart': PlotlyRenderer['Grouped Bar Chart'],
        'Stacked Bar Chart': PlotlyRenderer['Stacked Bar Chart'],
        'Line Chart': PlotlyRenderer['Line Chart'],
        'Dot Chart': PlotlyRenderer['Dot Chart'],
        'Area Chart': PlotlyRenderer['Area Chart'],
        'Scatter Chart': PlotlyRenderer['Scatter Chart'],
        'Multiple Pie Chart': PlotlyRenderer['Multiple Pie Chart']
      }))()
    }
  }
}
</script>

Contributors

Seungwoo321
Seungwoo321

๐Ÿ’ป
rkota
rkota

๐Ÿšง
Jayraj Rathwa
Jayraj Rathwa

๐Ÿ›
cbbdev
cbbdev

๐Ÿšง

Inspired

License

MIT

vue-pivottable's People

Contributors

allcontributors[bot] avatar apeschar avatar cbbdev avatar dependabot[bot] avatar jbrathwa avatar raisercostin avatar rosairekota avatar seungwoo321 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vue-pivottable's Issues

Change default aggregation

Hello,

By default the table counts the items: is there any way to change this behavior (for example with "sum of another column")?

Thank you

Is it possible to have a multiple values to aggregate?

I was thinking if it's possible to have aggregator on multiple columns.

For example:

A | B | C
One | 1 | 2
Two | 1 | 2
One | 1 | 2
One | 1 | 2
Two | 1 | 2

rows: ['A']
vals: ['B', 'C']

average on B and sum on C

Something like that:

Capture

I know it will become rendering problem with graphs....but not so difficult for tables.

It will be a great plus!

Failing import css file

Hi, when i'm trying to import the css file I get the next error.

Error:

Error: Package path ./dist/vue-pivottable.css is not exported from package C:\dev\vue\monedero-vue\node_modules\vue-pivottable

These are my vue and vue-pivottable versions:

"vue": "^2.6.14",
"vue-pivottable": "^0.4.64"

Also this is my eslint config file:

module.exports = {
  root: true,
  env: {
    node: true
  },
  extends: [
    'plugin:vue/essential',
    '@vue/standard'
  ],
  parserOptions: {
    parser: '@babel/eslint-parser'
  },
  rules: {
    'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
  }
}

Workaround

For the moment I was able to remove the error adding the next line in the package json of vue-pivottable in the node_modules folder:

"exports": {
    ".": {
      "import": "./dist/vue-pivottable.mjs",
      "require": "./dist/vue-pivottable.umd.js"
    },
    // I added this line
    "./dist/vue-pivottable.css": "./dist/vue-pivottable.css"
  },

Webpack: Module parse failed: Unexpected token (341:14)

I'm tried to use the module with my vuejs project.

I get the error below:

./node_modules/vue-pivottable/src/PivottableUi.js
Module parse failed: Unexpected token (341:14)
You may need an appropriate loader to handle this file type.
| 	  : h(Pivottable, {
|             props: {
|               ...props,
|               tableMaxWidth: this.tableMaxWidth
|             }
 @ ./node_modules/vue-pivottable/src/index.js 2:0-44
 @ ./src/main.ts
 @ multi (webpack)-dev-server/client?http://0.0.0.0:8081 webpack/hot/dev-server ./src/main.ts

this is my loader?

{
        test: /\.js$/,
        use: utils.scriptLoaders(scriptLoadersOptions).js,
        include: [resolve('src'), resolve('test')]
},

Missing vue-pivottable.css in dist

In version "0.3.2" I'm getting "no such file or directory .../node_modules.com/vue-pivottable/dist/vue-pivottable.css"
Any thoughts how better to fix it?

Doesn't work anymore: Unexpected identifier

image

This happens when I try to add it as a plugin in NuxtJS.

I have tried different combinations of ways to import the component, all with the same error message.

How to reproduce:
Start a new Nuxt project and include this component as a plugin.

data to excel

Is it possible to export the table data to excel?
sorry for my English.

Vue3 support

Hi,

Have you planned to made a Vue3 version ?

Thanks

Main data table outside

Can you pull the main data table outside the first table? It will be easier to style elements.

server side data?

because all the data is in mem, there is a hard limit on the size of data.

I am thinking if it is possible to suport fetch data from the backend on the fly. i.e the pivotData source is some table in DB and all the operation on the frontend is translated to the sql query.

Too much data

Such errors are displayed: [Vue warn]: Error in render: "RangeError: Maximum call stack size exceeded" and RangeError: Maximum call stack size exceeded

export derivers from './helper/utils'

There is useful derivers in pivotable library but those are not exported in vue-pivottable. Could you export those so it's easier to use ? e.g. derivers.bin, derivers.dateFormat .

Filter "too many to list" -> provide search field?

When trying to filter on columns with many values, "too many to list" is shown and filtering is not possible.

What is "too many" and would it be a possibility to include a search field to reduce the list size and allow filtering if you know the concrete value?

Filer out "null" values

My data is structured like that

[
{form1:question1 (question1): "1"},
{form1:question1 (question1): "6"},
{form1:question2 (question2): "B"},
{form1:question2 (question2): "A"},
]

This results in null values. How to filter them out?
Deselecting null from the filter does not work unfortunately.
image

Also is this possible programmatically?
I tried this, but it did not work:

  'form1:question1 (question1)': {
          'null': true // false
   }

how can i save result?

hi all dear
how can i save pivottable result?
im want to get created report and save it to json

rowOrder and colOrder are not working

I tried to change the default value rowOrder and colOrder, my code looks like below

<vue-pivottable-ui :data="pivotData" rowOrder="value_z_to_a" :aggregator-name="aggregatorName" :renderer-name="rendererName" :rows="rows" :cols="cols" :vals="vals" :row-total="rowTotal" :col-total="colTotal" >

Example of derivedAttributes please

Hi,

I have found it very difficult to use the internal utilities of pivottablejs as derivedAttributes. I have used it as a fixed function that doesn't accept any arguments (and hence, does a fixed transform on every record). It would be great if there were a working example for something like "bin" which is inside your "dist/<>.js" file.

Thanks for the great work.

VUE - ScopedSlots

Hi,

Having issues with ScopedSlots not being assigned in Vue (quasar), data is being passed to the Pivottable and Arrays are being built from the headers of the json data table.

  1. Error in render: "TypeError: scopedSlots is not a function" - Found in DraggableAttribute

  2. scopedSlots is not a function - at pvtAttr:

scopedSlots: {
pvtAttr: props => h('slot', scopedSlots(props))
},

The code i'm using:

<script> import {VuePivottableUi} from 'vue-pivottable' import 'vue-pivottable/dist/vue-pivottable.css' let jsonData = require(JSONDATA) export default { name: 'PivotTable', components: { VuePivottableUi }, data() { return { pivotData: jsonData, aggregatorName: 'Sum', rendererName: 'Table Heatmap', rows: ["row1"], cols: ['col1'], vals: ['val1'], } }, mounted() { console.log(this.pivotData) } } </script>

How to hide control cells ?

I have large set of keys and I would like to hide all of them when selection is done, but how?
-> How can I hide first row from pivotable ? I also would like to option to hide all control cells and show only actual data. Is it possible somehow ?

valueFilter doesnt work

hi

i tried to apply the following valueFilter

{saison:{20:true}, lieferant:{"blabla":true}}

but the attributes will not be filtered.
As far as i can see in the vue-console, the props will not be used or is my filter wrong?

rgds
Lukas

how to get filtered data?

After applying some filters on the pivot table, I want to get the filtered data in an array.

in helper/utils.js I found the method

getFilteredData() {
return this.filteredData
}

How can I access filteredData?

A possibility to translate row and field names.

Thanks for making this plugin! We are already using it.

As a developer I request data from an api. The api formats the property names as for example "countryOfOriginCode". It would be great if there was an option to pass an "field translation object" for example:
{ countryOfOriginCode: 'Country' }
In my case, I would translate it into Dutch which is "herkomst".

Keep up the good work.
Greetings,
Thomas

provide support for custom aggregators

Currently, both vue-pivottable and vue-pivottable-ui components use built-in aggregators with only aggregatorName as an option. There is no option to add custom aggregators as in the pivottable.js. Some option is required to add your own aggregator in the given format.

Also, Thank you for providing this amazing vue port. If you want, I can work on this and add PR.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.