0.3.17 • Published 5 years ago

generic-dashboard v0.3.17

Weekly downloads
1,204
License
-
Repository
-
Last release
5 years ago

generic-dashboard

generic build of dashboard customizing ng2-angular-chart

Table of Contents

Install

npm i generic-dashboard --save

Usage

Import the GenericDashboardModule in your app.module.ts:

import { GenericDashboardModule } from 'generic-dashboard';

@NgModule({
  // ...
  imports: [
    GenericDashboardModule
  ]
  // ...
})

in addition you should add link for the follwing styles and scripts in your application

If you are using Angular CLI you can follow the example below...

angular.json

"styles": [
  "src/styles.scss",
+ "node_modules/bootstrap/dist/css/bootstrap.css"
+ "node_modules/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.css"
],
"scripts": [
+ "node_modules/jquery/dist/jquery.min.js",
+ "node_modules/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.concat.min.js"
],

index.html

  <link rel="icon" type="image/x-icon" href="favicon.ico">
+ <link rel="stylesheet" href="http://jobmanager.seldatech.com/images/dashboard/fonts/fontawesome-pro-5.0.13/css/fontawesome-all.min.css" >
+ <link href="https://fonts.googleapis.com/css?family=Montserrat:100,100i,200,200i,300,300i,400i,500,500i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
+ <script src="//cdn.ckeditor.com/4.7.1/full-all/ckeditor.js"></script>
</head>

polyfills.ts

/***************************************************************************************************
 * APPLICATION IMPORTS
 */
+ (window as any).global = window;

create xml according to instruction in xml section

In your templates, use the lib-dashboard component like this:

<lib-dashboard [settings]="dashboardSettings"></lib-dashboard>

and in the corresponding .ts dashboard settings:

//partial example
dashboardSettings = {
  chartsPerRow : 3,
  xmlUrl: 'http://jobmanager.seldatech.com/images/XMLs/xml-file.xml',
  loadingImage : "http://jobmanager.seldatech.com/images/dashboard/loading.gif",
  getChartsOfUserUrl: "http://localhost:25823/api/chart/",
  getIndicatorsOfUserUrl: "http://localhost:25823/api/indicator/",
  getChartDataUrl: "http://localhost:25823/api/chart/chartData/",
  getIndicatorDataUrl: "http://localhost:25823/api/chart/chartData/",
  addChartUrl: "http://localhost:25823/api/chart/",
  updateChartUrl: "http://localhost:25823/api/chart/",
  updateChartOrderUrl: "http://localhost:25823/api/chart/updateOrder",
  deleteChartUrl: "http://localhost:25823/api/chart/",
  noDataText: "No data to show",
  pieTooltip: "Pie",
  barsTooltip: "Bars",
  linesTooltip: "Lines",
  areaTooltip: "Area",
  stackedAreaTooltip: "Stacked area",
  stackedArea100Tooltip: "Stacked area 100%",
  zoomInTooltip: "Zoom in",
  zoomOutTooltip: "Zoom out",
  resetTooltip: "Reset",
  leftTooltip: "Left",
  rightTooltip: "Right",
  }

Settings

The following list of settings are supported by the component. Configure the settings to meet your requirement.

SettingTypeDescriptionDefault Value
chartsPerRowNumberNumber of charts per row3
xmlUrlStringUrl for chart structure xmlhttp://jobmanager.seldatech.com/images/XMLs/xml-file.xml
loadingImageStringUrl for loading imagehttp://jobmanager.seldatech.com/images/dashboard/loading.gif
getChartsOfUserUrlStringUrl to get charts of user - should be get method''
getIndicatorsOfUserUrlStringUrl to get indicators of user - should be get method''
getChartDataUrlStringUrl to get data of specific chart - recieves chart id - should be get method''
getIndicatorDataUrlStringUrl to get data of specific indicator - recieves indicator id - should be get method''
addChartUrlStringUrl for add chart or indicator - should be post method''
updateChartUrlStringUrl for update chart or indicator - should be put methodn''
deleteChartUrlStringUrl for delete chart or indicator - should be delete method''
addChartTextStringText for add chart buttonAdd chart
noDataTextStringText to display when no data to showNo data to show
pieTooltipStringPie chart icon tooltipPie
barsTooltipStringBars chart icon tooltipBars
linesTooltipStringLines chart icon tooltipLines
areaTooltipStringArea chart icon tooltipArea
stackedAreaTooltipStringStacked area chart icon tooltipStacked area
stackedArea100TooltipStringStacked area 100% chart icon tooltipStacked area 100%
zoomInTooltipStringZoom in tooltipZoom in
zoomOutTooltipStringZoom out tooltipZoom out
resetTooltipStringReset tooltipReset
leftTooltipStringLeft tooltipLeft
rightTooltipStringRight tooltipRight
expandTooltipStringExpand tooltipExpand
collapseTooltipStringCollapse tooltipCollapse
editTooltipStringEdit tooltipEdit
deleteTooltipStringDelete tooltipDelete
kpiSettingsTitleStringChart settings dialog titleKPI Settings
defaultChartTextStringlabel for chart type selectDefault chart:
saveTextStringSave button textSave
cancelTextStringCancel button textCancel
selectTextStringText to be show in the dropdown, when no items are selectedSelect Items
selectAllTextStringText to display as the label of select all optionSelect All
unSelectAllTextStringText to display as the label of unSelect optionUnSelect All
componentTypeanyArray of reference to custom componentsnot set

XML

In order to define chart structure you should create xml according to this schema

A two-dimensional diagram is consists of the x-axis range and legend definition, according to the given data the chart is able to calculate the v-axis.

In the kpi section you will need to provide a type. kpi type could be one of the following: 1. "chart"- the simple case. 2. "indicator"- indicators are used for one dimensional data,specific value for specific parameter. 3. "custom-html"- provide ckeditor for your custom html 4. "componentName" - allow you to define your own component and let the user supply inputs in case of needed. inputs are defined by properties and nodes.

 <kpi type='WellcomeComponent' typeLabel="wellcome" iconUrl='http://localhost:25823/api/Content/wellcome.png'>
    <property id='wellcometext' name='wellcometext' type='text' length='10'></property>
  </kpi>
  • iconUrl is optional ,in case you want to override the default provided icon.

In the properties section you should provide chart properties like name , creation date etc. Note : define of property with id 'name' is required. example:

<property id='name' name='Name' type='text' length='10'></property>

In the node section you should provide nodes which describe the x-axis range and the legend. each node can have values that represent the selection options. you need to provide 'id' and 'name' properties for each value. node type can be one of the following: select, multiselect, autocomplete, date

for example:

<node id='ChartValues' type='select' name='Chart values:' >
             <value id='1' name='Orders: Revenues'></value>
             <value id='2' name='Orders: Number of orders'></value>
             <value id='3' name='Orders: Number of sold items'></value>
			 <value id='4' name='Orders: Number of shipped items'></value>
             <value id='5' name='Orders: Shipping costs'></value>
             <value id='6' name='Returns: Number of returns'></value>
			 <value id='7' name='Returns: $ Value of returns'></value>
             <value id='8' name='Inventory: Number of available items'></value>
             <value id='9' name='Inventory: Number of available unique SKUs'></value>
        </node>

another way to provide the values is by setting url address that returns list of id name pairs. you can set the base url in baseUrl attribute of dashboard section. the urls params can be based on previous node by sending its id.

example of a list based on values retrieves from server

<node id='showBy' name='Show by' type='select' url='showByValue/{ChartValues}' searchurl=''></node>

ChartValues parameter now contains the value of the chosen option in "ChartValues" node.

a node might be depends on one or more other nodes. that means that it will not be displayed untill user choose its dependencies. the dependencies are seperated by a semicolon. use 'showIf' property if node should be visibile only in specific values of depends. initialize 'showIf' with values to be shown separated by semicolon or url with dependency as parameter.

example:

<node id='series' type='select' name='Series:' dependOn='showBy;ChartValues;' url='ShowByValuesDetails/{showBy}'></node>

<node id='showBy' dependOn='ChartValues' name='Show by' type='multiselect' showIf='1,2' url='showByValue/{ChartValues}'></node>

<node id='showBy' dependOn='ChartValues' name='Show by' type='multiselect' showIf='isShowByVisible/{ChartValues}' url='showByValue/{ChartValues}'></node>

node value can contain one or more nodes. this is limited for one level only. example:

<node id='dateRange' type='autocomplete' name='Date range:'>
             <value id='1' name='Last 24 hours'></value>
             <value id='2' name='Last 3 days'></value>
			 <value id='3' name='Last 7 days'></value>
             <value id='4' name='Last 14 days'></value>
			 <value id='5' name='Last 30 days'></value>
             <value id='6' name='Month to date'></value>
			 <value id='7' name='Last 60 days'></value>
			 <value id='8' name='Last 90 days'></value>
             <value id='9' name='Last 6 months'></value>
             <value id='10' name='custom'>
				<node id='startDate' type='date' name='start date:'></node>
				<node id='endDate' type='date' name='end date:'></node>
             </value>
        </node>

view full xml example

API

For function supplied for getChartDataUrl: if data is base on 2 diemnsions only, the second column with sum value should be called sum.

License

MIT

0.3.17

5 years ago

0.3.16

5 years ago

0.3.15

5 years ago

0.3.14

5 years ago

0.3.13

5 years ago

0.3.12

5 years ago

0.3.11

5 years ago

0.3.10

5 years ago

0.3.9

5 years ago

0.3.8

5 years ago

0.3.7

5 years ago

0.3.6

5 years ago

0.3.5

5 years ago

0.3.4

5 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.99

5 years ago

0.2.98

5 years ago

0.2.97

5 years ago

0.2.96

5 years ago

0.2.95

5 years ago

0.2.94

5 years ago

0.2.92

5 years ago

0.2.91

5 years ago

0.2.90

5 years ago

0.2.89

5 years ago

0.2.88

5 years ago

0.2.87

5 years ago

0.2.86

5 years ago

0.2.85

5 years ago

0.2.84

5 years ago

0.2.83

5 years ago

0.2.82

5 years ago

0.2.81

5 years ago

0.2.80

5 years ago

0.2.79

5 years ago

0.2.78

5 years ago

0.2.77

5 years ago

0.2.76

5 years ago

0.2.75

5 years ago

0.2.74

5 years ago

0.2.73

5 years ago

0.2.72

5 years ago

0.2.71

5 years ago

0.2.70

5 years ago

0.2.69

5 years ago

0.2.68

5 years ago

0.2.67

5 years ago

0.2.66

5 years ago

0.2.65

5 years ago

0.2.64

5 years ago

0.2.63

5 years ago

0.2.62

5 years ago

0.2.61

5 years ago

0.2.60

5 years ago

0.2.59

5 years ago

0.2.58

5 years ago

0.2.57

5 years ago

0.2.56

5 years ago

0.2.55

5 years ago

0.2.54

5 years ago

0.2.53

5 years ago

0.2.52

5 years ago

0.2.51

5 years ago

0.2.50

5 years ago

0.2.49

5 years ago

0.2.48

5 years ago

0.2.47

5 years ago

0.2.46

5 years ago

0.2.45

5 years ago

0.2.44

5 years ago

0.2.43

5 years ago

0.2.42

5 years ago

0.2.41

5 years ago

0.2.40

5 years ago

0.2.39

5 years ago

0.2.38

5 years ago

0.2.37

5 years ago

0.2.36

5 years ago

0.2.35

5 years ago

0.2.33

5 years ago

0.2.32

5 years ago

0.2.31

5 years ago

0.2.30

5 years ago

0.2.29

5 years ago

0.2.28

5 years ago

0.2.27

5 years ago

0.2.26

5 years ago

0.2.25

5 years ago

0.2.24

5 years ago

0.2.23

5 years ago

0.2.22

5 years ago

0.2.21

5 years ago

0.2.20

5 years ago

0.2.19

5 years ago

0.2.18

5 years ago

0.2.17

5 years ago

0.2.16

5 years ago

0.2.15

5 years ago

0.2.13

5 years ago

0.2.12

5 years ago

0.2.11

5 years ago

0.2.10

5 years ago

0.2.9

5 years ago

0.2.8

5 years ago

0.2.7

5 years ago

0.2.6

5 years ago

0.2.5

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.99

5 years ago

0.1.98

5 years ago

0.1.97

5 years ago

0.1.96

5 years ago

0.1.95

5 years ago

0.1.94

5 years ago

0.1.93

5 years ago

0.1.92

5 years ago

0.1.91

5 years ago

0.1.90

5 years ago

0.1.89

5 years ago

0.1.88

5 years ago

0.1.87

5 years ago

0.1.86

5 years ago

0.1.85

5 years ago

0.1.84

5 years ago

0.1.83

5 years ago

0.1.82

5 years ago

0.1.81

5 years ago

0.1.80

5 years ago

0.1.79

5 years ago

0.1.78

5 years ago

0.1.77

5 years ago

0.1.76

5 years ago

0.1.75

5 years ago

0.1.74

5 years ago

0.1.73

5 years ago

0.1.72

5 years ago

0.1.71

5 years ago

0.1.70

5 years ago

0.1.69

5 years ago

0.1.68

5 years ago

0.1.67

5 years ago

0.1.66

5 years ago

0.1.65

5 years ago

0.1.64

5 years ago

0.1.63

5 years ago

0.1.62

5 years ago

0.1.61

5 years ago

0.1.60

5 years ago

0.1.58

5 years ago

0.1.57

5 years ago

0.1.56

5 years ago

0.1.55

5 years ago

0.1.54

5 years ago

0.1.53

5 years ago

0.1.52

5 years ago

0.1.51

5 years ago

0.1.50

5 years ago

0.1.49

5 years ago

0.1.48

5 years ago

0.1.47

5 years ago

0.1.46

5 years ago

0.1.45

5 years ago

0.1.44

5 years ago

0.1.43

5 years ago

0.1.42

5 years ago

0.1.41

5 years ago

0.1.40

5 years ago

0.1.39

5 years ago

0.1.38

5 years ago

0.1.37

5 years ago

0.1.36

5 years ago

0.1.35

5 years ago

0.1.34

5 years ago

0.1.33

5 years ago

0.1.32

5 years ago

0.1.31

5 years ago

0.1.30

5 years ago

0.1.29

5 years ago

0.1.28

5 years ago

0.1.27

5 years ago

0.1.26

5 years ago

0.1.25

5 years ago

0.1.24

5 years ago

0.1.23

5 years ago

0.1.22

5 years ago

0.1.21

5 years ago

0.1.20

5 years ago

0.1.19

5 years ago

0.1.18

5 years ago

0.1.17

5 years ago

0.1.16

5 years ago

0.1.15

5 years ago

0.1.14

5 years ago

0.1.13

5 years ago

0.1.12

5 years ago

0.1.11

5 years ago

0.1.10

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.88

5 years ago

0.0.87

5 years ago

0.0.86

5 years ago

0.0.85

5 years ago

0.0.84

5 years ago

0.0.83

5 years ago

0.0.82

5 years ago

0.0.81

5 years ago

0.0.80

5 years ago

0.0.79

5 years ago

0.0.78

5 years ago

0.0.77

5 years ago

0.0.76

5 years ago

0.0.75

5 years ago

0.0.74

5 years ago

0.0.73

5 years ago

0.0.72

5 years ago

0.0.71

5 years ago

0.0.70

5 years ago

0.0.69

5 years ago

0.0.68

5 years ago

0.0.67

5 years ago

0.0.66

5 years ago

0.0.65

5 years ago

0.0.64

5 years ago

0.0.63

5 years ago

0.0.62

5 years ago

0.0.61

5 years ago

0.0.60

5 years ago

0.0.59

5 years ago

0.0.58

5 years ago

0.0.57

5 years ago

0.0.56

5 years ago

0.0.55

5 years ago

0.0.54

5 years ago

0.0.53

5 years ago

0.0.52

5 years ago

0.0.51

5 years ago

0.0.50

5 years ago

0.0.49

5 years ago

0.0.48

5 years ago

0.0.47

5 years ago

0.0.46

5 years ago

0.0.45

5 years ago

0.0.44

5 years ago

0.0.43

5 years ago

0.0.42

5 years ago

0.0.41

5 years ago

0.0.40

5 years ago

0.0.39

5 years ago

0.0.38

5 years ago

0.0.37

5 years ago

0.0.36

5 years ago

0.0.35

5 years ago

0.0.34

5 years ago

0.0.33

5 years ago

0.0.32

5 years ago

0.0.31

5 years ago

0.0.30

5 years ago

0.0.29

5 years ago

0.0.28

5 years ago

0.0.27

5 years ago

0.0.26

5 years ago

0.0.25

5 years ago

0.0.24

5 years ago

0.0.23

5 years ago

0.0.22

5 years ago

0.0.21

5 years ago

0.0.20

5 years ago

0.0.19

5 years ago

0.0.18

5 years ago

0.0.17

5 years ago

0.0.16

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago