Logo v4.1
图片描述内容

没结果

  • 获取支持
  • 预览演示
Logo v4.1
  • 文档
  • 代码片段
  • 开发文档
  • 介绍
  • Getting started
  • Getting Started
  • Gulp
  • Customization
  • Credits
  • Changelog
  • 设计 & Graphics
  • Bootstrap Icons
  • Duotone Icons
  • Illustrations
  • 组件s
  • Accordion
  • Alerts
  • Avatars
  • Badge
  • 面包屑
  • Buttons
  • Cards
  • Collapse
  • Column Divider
  • Devices
  • Divider
  • Dropdowns
  • Icons
  • List Group
  • Lists
  • Legend Indicator
  • Modal
  • Offcanvas
  • Page Header
  • Pagination
  • Popovers
  • Progress
  • Profile
  • Shapes
  • Spinners
  • Steps
  • Tab
  • Tables
  • Text Highlight
  • Toasts
  • Tooltips
  • Typography
  • Navbars
  • Navbar
  • Navs
  • Mega Menu
  • Scrollspy
  • Basic forms
  • Basic Forms
  • Checks & Switches
  • Input Group
  • 高级 Forms
  • 高级 Select
  • File Attachments
  • Drag’ n’ Drop File Uploads
  • WYSIWYG Editor
  • Quantity Counter
  • Input Mask
  • Step Forms (Wizards)
  • Range Slider (noUiSlider)
  • Add Field
  • Toggle Password
  • Count Characters
  • Toggle Switch
  • Toggle State
  • Switch
  • Media
  • Fullscreen Lightbox
  • Video Background
  • Video Player
  • Swiper
  • Others
  • Maps (Leaflet)
  • Chart.js
  • Circles.js (Pie Chart)
  • Sticky Block
  • Countdown
  • Sorting (Shuffle.js)
  • Go To
  • Show Animation
  • Typed.js
  • Utilities
  • Backgrounds
  • Borders
  • Colors
  • Links
  • Position
  • Rotations
  • Shadows
  • Sizing
  • Spacing
  • Z-index

Chart.js

Simple yet flexible JavaScript charting for designers & developers.

Chart.js documentation

How to use

Copy-paste the stylesheet <link> into your <head> to load the CSS.

        
          <link rel="stylesheet" href="./assets/vendor/chart.js/dist/Chart.min.css">
        
      

Copy-paste the following <script> near the end of your pages under JS Implementing Plugins to enable it.

        
          <script src="./assets/vendor/chart.js/dist/Chart.min.js"></script>
        
      

Copy-paste the following <script> near the end of your pages under JS Implementing Plugins to enable it.

        
        
      

Copy-paste the init function under JS Plugins Init., before the closing </body> tag, to enable it.

        
          <script>
            (function() {
              // INITIALIZATION OF CHARTJS
              // =======================================================
              document.querySelectorAll('.js-chart').forEach(item => {
                HSCore.components.HSChartJS.init(item)
              })
            });
          </script>
        
      

Basic example

  • 预览
  • HTML
              
                <!-- Chart -->
                <div class="position-relative">
                  <canvas class="js-chart"
                          data-hs-chartjs-options='{
                            "type": "bar",
                            "data": {
                              "labels": ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
                              "datasets": [{
                                "data": [10, 8, 5, 7, 6, 6, 10, 10, 8, 5, 7, 6, 6, 10, 6, 6, 10, 10, 8, 5, 7, 6, 6, 10, 6, 6, 10, 10, 8],
                                "backgroundColor": "#19a0ff",
                                "borderColor": "#19a0ff"
                              }]
                            },
                            "options": {
                              "scales": {
                                "yAxes": [{
                                  "display": false,
                                  "gridLines": {
                                    "display": false,
                                    "drawBorder": false
                                  },
                                  "ticks": {
                                    "beginAtZero": true
                                  }
                                }],
                                "xAxes": [{
                                  "display": false,
                                  "gridLines": {
                                    "display": false,
                                    "drawBorder": false
                                  }
                                }]
                              },
                              "tooltips": false
                            }
                          }'
                          height="80"></canvas>
                </div>
                <!-- Chart -->
              
            

Methods

Parameters Description Default value
options.scales.yAxes.ticks.prefix Preffix for yAxes. false
options.scales.yAxes.ticks.postfix Postfix for yAxes. false
options.scales.yAxes.ticks.metric Metric output for axes (1k, 1kk, etc..). false
options.responsive 响应式 chart. true
options.maintainAspectRatio 主站tain the original canvas aspect ratio (width / height) when resizing. false
options.legend.display Legend for chart. false
options.tooltips.enabled Enable or disable tooltips. false
options.tooltips.prefix Prefix for tooltip text. false
options.tooltips.postfix Postfix for tooltip text. false
options.tooltips.hasIndicator Add indicator for tooltip. false