2.0.0 • Published 1 year ago

pixi-line-chart v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Pixi Line Chart

Simple Line Chart Component for Vue 3.0

Features

  • Ability to add points reactive, push points to points array property, several or one by one
  • Ability to handle big datasets with bottom horizontal navigation
  • Vertical autoscale by min and max values on selected region
  • Full colors and sizes customization
  • Draw data with real values horizontal scale by number or Date timestamp
  • Add different point colors sizes and shapes and each point personal info text

Installation

npm i pixi-line-chart

Props

Prop NameTypeDefaultShort Description
maxHorizontalLabelsNumber20Number of horizontal labels
horizontalLinesNumber5Number of horizontal axe lines
miniChartHorizontalPickerWidthNumber10picker width
miniChartMinimumSelectionNumber10min selection region size
miniChartMaxPintsNumber100auto scale points selection
chartHeightNumber600chart height
mainChartPaddingObject{top: 20, bottom: 80, left: 25, right: 25}padding for big chart
miniChartPaddingObject{top: 5, bottom: 5, left: 25, right: 25}padding for mini chart
isDateTimeBooleantruehorizontal labels type
dateTimeFormatObject{locales: 'en-US', options: {dateStyle:'short', timeStyle:'short'}}format for Date type
colorsObjectsee table belowchart colors customize
labelStylesObjectsee table belowchart labels customize
infoBoxColorFollowBooleantruecolor of infobox will depend on point color
pointsDataArrayData points array, see table below

Colors Object property

Prop NameDefault Color
background#0C0C0C #0C0C0C
line#DBDBDB #DBDBDB
point#7EDDA6 #7EDDA6
horizontalLines#262626 #262626
texts#a8a8a8 #a8a8a8
infoBoxBackground#219653 #219653
infoBoxText#cccccc #cccccc
infoBoxValues#FFFFFF #FFFFFF
infoPoint#219653 #219653
miniChartPickerLines#BAF6D3 #BAF6D3
miniChartSideBackground#121212 #121212
miniChartCenterBackground#219653 #219653
timePickerColor#219653 #219653

labelStyles Object property

Prop NameDefault
fontFamilyRoboto
horizontalLabelsObject
horizontalLabels.fontSize11
horizontalLabels.fontWeightnormal
verticalLabelsObject
verticalLabels.fontSize11
verticalLabels.fontWeightnormal
infoBoxValuesObject
infoBoxValues.fontSize13
infoBoxValues.fontWeightnormal
infoBoxTextObject
infoBoxText.fontSize11
infoBoxText.fontWeightnormal

Point Object property

Prop NameTypeDefaultis RequiredShort description
xNumbertruex coord as number or Date timestamp for data if isDateTime true
yNumbertruey coord number
colorStringtruepoint color
sizeNumbertruepoint size
shapeStringtruepoint shape 'circle', 'rectangle' or 'star'
infoStringfalseadditional point info text for infobox

Example

<template>
  <div>
    <pixi-line-chart
            :pointsData="points"
            :is-date-time="false"
            :main-chart-padding="{top: 20, bottom: 60, left: 25, right: 25}"
    />
    <button @click="add">ADD POINT</button>
    <button @click="addArr">ADD ARRAY</button>
  </div>
</template>

<script>
  import pixiLineChart from "./components/pixiLineChart";
  export default {
    name: "App",
    components: {
      pixiLineChart
    },
    data: ()=>({
      points: [],
      x: 100
    }),
    methods: {
      add(){
        this.points.push({x: this.x, y: Math.tan(Math.random())*Math.random()*150, color: '#3e41e5', shape: 'circle', size: 4, info: "BUY ME A NUGGET"});
        this.x += 100;
      },
      addArr(){
        this.points.push(
                ...[
                  {x: this.x, y: Math.tan(Math.random())*Math.random()*150, color: '#e2030b', shape: 'circle', size: 4, info: "BUY ME A NUGGET"},
                  {x: this.x+100, y: Math.tan(Math.random())*Math.random()*150, color: '#e2030b', shape: 'circle', size: 4, info: "BUY ME A NUGGET"},
                  {x: this.x+150, y: Math.tan(Math.random())*Math.random()*150, color: '#e2030b', shape: 'circle', size: 4, info: "BUY ME A NUGGET"},
                  {x: this.x+200, y: Math.tan(Math.random())*Math.random()*150, color: '#e2030b', shape: 'circle', size: 4, info: "BUY ME A NUGGET"}
                ]
        );
        this.x += 300
      }
    }
  };
</script>

License

MIT

2.0.0

1 year ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago