├── .codeclimate.yml ├── .editorconfig ├── .gitignore ├── .travis.yml ├── CODE_OF_CONDUCT.md ├── ISSUE_TEMPLATE.md ├── LICENSE.md ├── README.md ├── _config.yml ├── config.xml ├── config └── copy.config.js ├── deploy.sh ├── ionic.config.json ├── package-lock.json ├── package.json ├── resources ├── README.md ├── android │ ├── icon │ │ ├── drawable-hdpi-icon.png │ │ ├── drawable-ldpi-icon.png │ │ ├── drawable-mdpi-icon.png │ │ ├── drawable-xhdpi-icon.png │ │ ├── drawable-xxhdpi-icon.png │ │ └── drawable-xxxhdpi-icon.png │ └── splash │ │ ├── drawable-land-hdpi-screen.png │ │ ├── drawable-land-ldpi-screen.png │ │ ├── drawable-land-mdpi-screen.png │ │ ├── drawable-land-xhdpi-screen.png │ │ ├── drawable-land-xxhdpi-screen.png │ │ ├── drawable-land-xxxhdpi-screen.png │ │ ├── drawable-port-hdpi-screen.png │ │ ├── drawable-port-ldpi-screen.png │ │ ├── drawable-port-mdpi-screen.png │ │ ├── drawable-port-xhdpi-screen.png │ │ ├── drawable-port-xxhdpi-screen.png │ │ └── drawable-port-xxxhdpi-screen.png ├── icon.png ├── icon.png.md5 ├── ios │ ├── icon │ │ ├── icon-1024.png │ │ ├── icon-40.png │ │ ├── icon-40@2x.png │ │ ├── icon-40@3x.png │ │ ├── icon-50.png │ │ ├── icon-50@2x.png │ │ ├── icon-60.png │ │ ├── icon-60@2x.png │ │ ├── icon-60@3x.png │ │ ├── icon-72.png │ │ ├── icon-72@2x.png │ │ ├── icon-76.png │ │ ├── icon-76@2x.png │ │ ├── icon-83.5@2x.png │ │ ├── icon-small.png │ │ ├── icon-small@2x.png │ │ ├── icon-small@3x.png │ │ ├── icon.png │ │ └── icon@2x.png │ └── splash │ │ ├── Default-568h@2x~iphone.png │ │ ├── Default-667h.png │ │ ├── Default-736h.png │ │ ├── Default-Landscape-736h.png │ │ ├── Default-Landscape@2x~ipad.png │ │ ├── Default-Landscape@~ipadpro.png │ │ ├── Default-Landscape~ipad.png │ │ ├── Default-Portrait@2x~ipad.png │ │ ├── Default-Portrait@~ipadpro.png │ │ ├── Default-Portrait~ipad.png │ │ ├── Default@2x~iphone.png │ │ ├── Default@2x~universal~anyany.png │ │ └── Default~iphone.png ├── splash.png └── splash.png.md5 ├── sonar-project.properties ├── sonar.sh ├── src ├── app │ ├── app.component.ts │ ├── app.html │ ├── app.module.ts │ ├── app.scss │ └── main.ts ├── assets │ ├── fonts │ │ ├── _barlow.scss │ │ ├── _hind-madurai.scss │ │ ├── _lato.scss │ │ ├── _open-sans.scss │ │ ├── _source-sans-pro.scss │ │ └── index.scss │ ├── icon │ │ └── favicon.ico │ └── imgs │ │ ├── logo.png │ │ └── screenshot-xaxis.png ├── components │ ├── common-header │ │ ├── common-header.html │ │ ├── common-header.scss │ │ └── common-header.ts │ ├── components.module.ts │ ├── expandable │ │ ├── expandable.html │ │ ├── expandable.scss │ │ └── expandable.ts │ ├── footer-links │ │ ├── footer-links.html │ │ ├── footer-links.scss │ │ └── footer-links.ts │ ├── index.ts │ └── side-menu-content │ │ ├── models │ │ ├── inner-menu-option-model.ts │ │ ├── menu-option-model.ts │ │ ├── side-menu-redirect-events.ts │ │ └── side-menu-settings.ts │ │ ├── readme.md │ │ ├── side-menu-content.component.html │ │ ├── side-menu-content.component.scss │ │ └── side-menu-content.component.ts ├── index.html ├── manifest.json ├── pages │ ├── axes │ │ ├── axes.html │ │ ├── axes.scss │ │ └── axes.ts │ ├── basic-elements │ │ ├── basic-elements.html │ │ ├── basic-elements.scss │ │ └── basic-elements.ts │ ├── basic-shapes │ │ ├── basic-shapes.html │ │ ├── basic-shapes.scss │ │ └── basic-shapes.ts │ ├── dynamic-svg-coord │ │ ├── dynamic-svg-coord.html │ │ ├── dynamic-svg-coord.scss │ │ └── dynamic-svg-coord.ts │ ├── group-element-d3 │ │ ├── group-element-d3.html │ │ ├── group-element-d3.scss │ │ └── group-element-d3.ts │ ├── group-element │ │ ├── group-element.html │ │ ├── group-element.scss │ │ └── group-element.ts │ ├── home │ │ ├── home.html │ │ ├── home.scss │ │ └── home.ts │ ├── index.ts │ ├── installation │ │ ├── installation.html │ │ ├── installation.scss │ │ └── installation.ts │ ├── paths-svg │ │ ├── paths-svg.html │ │ ├── paths-svg.scss │ │ └── paths-svg.ts │ ├── scales │ │ ├── scales.html │ │ ├── scales.scss │ │ └── scales.ts │ └── text-element │ │ ├── text-element.html │ │ ├── text-element.scss │ │ └── text-element.ts ├── service-worker.js └── theme │ └── variables.scss ├── tsconfig.json ├── tslint-codeclimate.json └── tslint.json /.codeclimate.yml: -------------------------------------------------------------------------------- 1 | languages: 2 | JavaScript: true 3 | Ruby: true 4 | Python: false 5 | PHP: false 6 | 7 | exclude_patterns: 8 | - config/**/* 9 | - node_modules/**/* 10 | - webpack.*.js 11 | - karma.conf.js 12 | - platforms/ 13 | - plugins/ 14 | 15 | plugins: 16 | tslint: 17 | enabled: true 18 | config: tslint-codeclimate.json 19 | fixme: 20 | enabled: true 21 | stylelint: 22 | enabled: true 23 | csslint: 24 | enabled: true 25 | checks: 26 | bulletproof-font-face: 27 | enabled: false 28 | universal-selector: 29 | enabled: false 30 | duplication: 31 | enabled: true 32 | 33 | version: "2" 34 | checks: 35 | argument-count: 36 | enabled: true 37 | complex-logic: 38 | enabled: true 39 | file-lines: 40 | enabled: true 41 | method-complexity: 42 | enabled: true 43 | method-count: 44 | enabled: true 45 | method-lines: 46 | enabled: true 47 | nested-control-flow: 48 | enabled: true 49 | return-statements: 50 | enabled: true 51 | similar-code: 52 | enabled: true 53 | identical-code: 54 | enabled: true 55 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs 2 | # editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | indent_style = space 8 | indent_size = 2 9 | 10 | # 4 space indentation 11 | [*.ts] 12 | indent_style = space 13 | indent_size = 4 14 | 15 | # We recommend you to keep these unchanged 16 | end_of_line = lf 17 | charset = utf-8 18 | trim_trailing_whitespace = true 19 | insert_final_newline = true 20 | 21 | [*.md] 22 | trim_trailing_whitespace = false 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.sw[mnpcod] 3 | *.log 4 | *.tmp 5 | *.tmp.* 6 | log.txt 7 | npm-debug.log* 8 | 9 | .idea 10 | .sourcemaps 11 | .sass-cache 12 | .tmp 13 | .versions 14 | coverage 15 | dist 16 | node_modules/ 17 | tmp 18 | temp 19 | hooks 20 | platforms 21 | plugins 22 | www/ 23 | $RECYCLE.BIN/ 24 | 25 | .DS_Store 26 | Thumbs.db 27 | UserInterfaceState.xcuserstate 28 | 29 | .scannerwork 30 | _readme.txt 31 | proustibat-d3jsionic.keystore 32 | psd 33 | documentation 34 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | env: 2 | global: 3 | - GITHUB_REPO: proustibat/d3js-ionic 4 | - secure: "E88hDHzpU7/DcNJeQo2psKxTJxZ4o0DPBcz3DQgjAfrwtzvv85XTQMkl9YgEzVsLkD/lX/KSaoiNV2//pZN8aLfOsbNHrmW5Iihqn4B4IrTxYzmNvNmset01HEUmzuCblSVvqD3RSxkVh2Tq48zfbOaGW0bECPmtaskoxBW4vypBIVH/Nck6YSEe0KAuDvWOmuO6S80RsZ5kIywZizNU1QwXQqyLxUgM4HsC4JDNA6d+F0v/rRfviWUaccBbcyQmjpH5oJ4arJ1WKsCGx0C3yUc0tHfI3jkpxXlD3LpW82EHYrv0YTuEvKnIVPX9xc/dQtlq8V89AUPwIlgG8Y8IpayNHyPGf25FSQnteTSQk8q6nYU0Fm3MiRshryBeiGs3+SoNGqpTpqz0wsBjSgUqjaEY76hLsFsxnOVeFk2eVf6SWBpI+mNUXDA97+ajKN0eqzJeSqioNyQs9PZRPl3rrktMxs/hSyeju50K9s1bR90D3cDy3RVepQ6Qsa5Lzt+KX+I1ypD1w60MDSgwFIISkDHqJ2mhnriqXLspk5yNe/OrxMo1grgLkqbjTX17GxtGzKCjRyO3CYWODdaGjcugr6wVZrj4UCtLxEGJtN6MXblV8zbjf0B7K6fzwfuu+9FsBnmaLcm06Tp4alUCYOs+mA2+VSTJO5mVA5jDsSLe+8I=" 5 | # generate token at https://github.com/settings/tokens/new 6 | # generate secure with travis encrypt -r username/repository GH_TOKEN=[the token you created before] 7 | 8 | 9 | 10 | language: node_js 11 | node_js: '8' 12 | cache: npm 13 | 14 | # create a user token here: https://sonarcloud.io/account/security 15 | # run `travis encrypt your-token-here` 16 | # paste secure token below 17 | addons: 18 | sonarcloud: 19 | organization: proustibat-github 20 | token: 21 | secure: "K8aOT5z1xZ26HTsoh3nQaY5Q6TQIDKP+vZViTaCkpXfOMHQcRh38HMEzcw06/EZZ6wKWlDqiGF0erCr6mafKTcbEatBVkcfhoUUAd7OJVfUoNDrzDDqpnCbywxQEg6qKWIlhIHDjEih5trA/Am5AIXt/s8Md/7GlYAoDcuNHTg/vaFMLXXIjfqAvkULigXk25V76z2PGouRUZOwmh4Gh6OXmuEEcc9t2cMm9VlquMmKKzypHWs++PXMk0+0gMrvL4LZNqRt3uBAQl25yNsxRZvzQjboa1NIOGhnUyMKpTKTXm4xygzK0uqabKpcoveuD5RVwlgkFtov6WpONyYZcsGf3AL/UYjbRbCgT8GHTpa2T92Dw6Ps9kcZlcu585uAOanarfjBweLKeT5mRma2k9BD8i2WesbBOfYXMToyV+CgkBtQKdUKCw4qV7Tm2LXuFsBl21BM+qtzienuiDiq455eqsgCnQJ0dwp3mCwpU+H19Vh5aGZvz7sm8AjtE+gbcFG+hYVkmkOFTQS5n/r8nEr0l+IrQGDuKjMiTvjQsMulM8adZfq7f+q5QHvVm6JzAQFGIi4JkK4e7zSqkXDVKJHPVjW4qdKUHn4SCeY5DG8fpFxS4PVbDz/GH/6j7SGuJPRURTLDoJ2PywOsDexyM1OVSzOoPQPdxqB6AyaG8fxQ=" 22 | 23 | before_install: 24 | - npm install -g ionic@3.19.0 cordova@8.0.0 25 | 26 | install: 27 | - npm install 28 | - ionic cordova platform add android 29 | 30 | script: 31 | - npm run tslint:codeclimate 32 | - npm run lint 33 | - ionic cordova build android 34 | - bash sonar.sh 35 | - npm run typedoc 36 | 37 | # Here we want to check out where we are. 38 | # We only want to update Github Pages if we're building 39 | # the master branch of the original repository, so we 40 | # have to check $TRAVIS_PULL_REQUEST and $TRAVIS_BRANCH. 41 | # If we are here, we run bash deploy.sh 42 | after_success: 43 | - test $TRAVIS_PULL_REQUEST == "false" && test $TRAVIS_BRANCH == "master" && bash deploy.sh 44 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project author at proustibatm@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Expected behavior 2 | Explain expected behavior 3 | 4 | ### Actual behavior 5 | Explain actual behavior 6 | 7 | ### Steps to reproduce the behavior 8 | Explain how you reproduce it 9 | 10 | ### Specifications 11 | Checkmark the right specifications (if needed) 12 | #### Platform 13 | - [x] Android 14 | - [ ] iOS 15 | 16 | #### OS Version 17 | For Android: 18 | - [x] 8.0.0 19 | - [x] 7.1 20 | - [ ] 7.0 21 | - [ ] 6.0 22 | - [ ] 5.1 23 | - [ ] 5.0 24 | - [ ] 4.4 25 | 26 | For Apple: 27 | - [x] 11.0.1 28 | - [ ] 11.0.0 29 | - [ ] 10.0.4 30 | - [ ] 10.0.3 31 | - [x] 10.0.2 32 | - [ ] 10.0.1 33 | - [ ] 10.0.0 34 | - [ ] 9.1 35 | - [ ] 9.0 36 | 37 | #### Device 38 | e.g. One Plus 3T, Huawei Honor 8 39 | or e.g. iPhone X, iPhone 6 Plus, etc 40 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # D3.js with Ionic [![GitHub license](https://img.shields.io/github/license/proustibat/d3js-ionic.svg)](https://github.com/proustibat/d3js-ionic/blob/master/LICENSE.md) 3 | A tutorial app built with [Ionic Framework](https://ionicframework.com/) to learn [D3.js](https://d3js.org/) with Typescript 4 | 5 | ------------------------- 6 | 7 | | [![d3js-ionic-icon](https://user-images.githubusercontent.com/1054387/35104149-46b23f56-fc68-11e7-8a50-357fa36d0d32.png)
![google-play-icon](https://user-images.githubusercontent.com/1054387/35104116-2c9addda-fc68-11e7-85fa-91b13423d5f4.png)](https://play.google.com/store/apps/details?id=prstbt.ionic.d3&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1) | [![Build Status](https://travis-ci.org/proustibat/d3js-ionic.svg?branch=master)](https://travis-ci.org/proustibat/d3js-ionic)
[![Sonar quality gate](https://sonarcloud.io/api/badges/gate?key=prstbt.ionic.d3.app)](https://sonarcloud.io/dashboard?id=prstbt.ionic.d3.app)
[![Code Climate](https://codeclimate.com/github/proustibat/d3js-ionic/badges/gpa.svg)](https://codeclimate.com/github/proustibat/d3js-ionic) | [![Maintenance](https://img.shields.io/maintenance/yes/2018.svg)](https://github.com/proustibat/d3js-ionic/commits/master)
[![GitHub last commit](https://img.shields.io/github/last-commit/proustibat/d3js-ionic.svg)](https://github.com/proustibat/d3js-ionic/commits/master)
[![Open issues](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=open_issues)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=open_issues) | [![Greenkeeper badge](https://badges.greenkeeper.io/proustibat/d3js-ionic.svg)](https://greenkeeper.io/)
[![Dependencies Status](https://david-dm.org/proustibat/d3js-ionic/status.svg)](https://david-dm.org/proustibat/d3js-ionic)
[![DevDependencies Status](https://david-dm.org/proustibat/d3js-ionic/dev-status.svg)](https://david-dm.org/proustibat/d3js-ionic?type=dev) | 8 | | --- | :---- | :---- | :---- 9 | 10 | --------------------------- 11 | 12 | 13 | ![screenshot-1](https://user-images.githubusercontent.com/1054387/35104066-08acd856-fc68-11e7-821f-3ee8fbcf3b44.png) ![screenshot-2](https://user-images.githubusercontent.com/1054387/35104068-09de7626-fc68-11e7-9130-e0c22c07c980.png) 14 | 15 | --------------------------- 16 | 17 | 18 | ## Presentation 19 | 20 | ### Why this app? 21 | 22 | I made this app while learning D3.js. But while I had in mind that my goal was to use it in an Ionic app, I realized there was some differences compared to a classical use. Mainly because of Typescript. 23 | 24 | If you're in this case, you need to install TypeScript type definitions. So syntax may be different than a simple usage of D3.js. 25 | 26 | 27 | ### Who is this for? 28 | 29 | I propose to share my work to make you save time while learning. 30 | 31 | I think these examples could also be appropriated if you already are in and advanced step of your learning but stuck on some points. 32 | 33 | 34 | ### What can you find here? 35 | 36 | Most of these examples are based on [Dashing D3.js tutorials](https://www.dashingd3js.com/table-of-contents) adapted in Typescript 2 for Ionic 3. 37 | 38 | --------------- 39 | 40 | ## Working with this code 41 | 42 | ### Prerequisites 43 | Of course you need node and npm. 44 | 45 | Please also be sure you installed [Ionic](https://ionicframework.com/docs/) and [Cordova](https://cordova.apache.org/): 46 | ```bash 47 | npm install -g ionic cordova 48 | ``` 49 | To verify your system is ok run `ionic info`. 50 | 51 | 52 | ### Installation 53 | 54 | Install the app by running: 55 | ```bash 56 | git clone git@github.com:proustibat/d3js-ionic.git 57 | cd d3js-ionic 58 | ionic cordova prepare 59 | ``` 60 | This should prompt you if you want to install npm packages, answer `yes`. If it's not the case, run `npm install`; 61 | 62 | Run the app: 63 | ```bash 64 | // in the browser with livereload 65 | ionic serve -l 66 | // or on a device 67 | ionic cordova run android --device 68 | ionic cordova run ios --device 69 | ``` 70 | 71 | 72 | ### Documentation 73 | [Code documentation is available here](https://proustibat.github.io/d3js-ionic/) 74 | 75 | ### Feel free to improve the app 76 | 77 | - Please use [commitizen](https://github.com/commitizen/cz-cli) if you wanna contribute to the project and create a pull request ( run `git cz` instead of `git commit`) 78 | - Quality code status is available on [Sonarcloud](https://about.sonarcloud.io/) 79 | - CI with [Travis](https://travis-ci.org/proustibat/d3js-ionic) 80 | 81 | 82 | ## Contribute 83 | 84 | - Issue Tracker: [https://github.com/proustibat/d3js-ionic/issues](https://github.com/proustibat/d3js-ionic/issues) 85 | - Source Code: [https://github.com/proustibat/d3js-ionic](https://github.com/proustibat/d3js-ionic) 86 | 87 | ## Support 88 | 89 | If you are having issues, questions or any suggestions, please let me know: proustibat@gmail.com / [twitter/@proustibat](https://twitter.com/proustibat) 90 | 91 | ## License 92 | 93 | The project is licensed under the [GNU Affero General Public License v3.0 license](LICENSE.md) 94 | 95 | 96 | ----------------- 97 | 98 | ## Dev stats 99 | 100 | ### Complexity 101 | How simple or complicated the control flow of the application is. 102 | 103 | 104 | [![Complexity](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=complexity)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=complexity) 105 | [![Complexity per file](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=file_complexity)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=file_complexity) 106 | [![Cognitive Complexity](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=cognitive_complexity)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=cognitive_complexity) 107 | 108 | 109 | ### Documentation & sizes 110 | [![Lines](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=lines)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=lines) 111 | [![Lines of code](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=ncloc)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=ncloc) 112 | [![Comment lines](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=comment_lines)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=comment_lines) 113 | [![Comments (%)](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=comment_lines_density)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=comment_lines_density) 114 | 115 | [![Directories](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=directories)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=directories) 116 | [![Files](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=files)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=files) 117 | [![Classes](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=classes)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=classes) 118 | [![Functions](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=functions)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=functions) 119 | 120 | 121 | ### Duplications 122 | [![Duplicated blocks](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=duplicated_blocks)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=duplicated_blocks) 123 | [![Duplicated lines](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=duplicated_lines)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=duplicated_lines) 124 | 125 | 126 | ### Issues 127 | [![Open issues](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=open_issues)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=open_issues) 128 | [![Confirmed issues](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=confirmed_issues)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=confirmed_issues) 129 | [![Won't fix issues](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=wont_fix_issues)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=wont_fix_issues) 130 | 131 | 132 | ### Maintainability 133 | Issues in this domain mark code that will be more difficult to update competently than it should 134 | 135 | [![Code smells](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=code_smells)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=code_smells) 136 | [![SQALE Rating](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=sqale_rating)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=sqale_rating) 137 | 138 | 139 | ### Technical debt 140 | Effort to fix all maintainability issues. The measure is stored in minutes. An 8-hour day is assumed when values are shown in days. (The value of the cost to develop a line of code is 0.06 days) 141 | 142 | [![Technical debt](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=sqale_index)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=sqale_index) 143 | [![Technical debt ratio](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=sqale_debt_ratio)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=sqale_debt_ratio) 144 | 145 | 146 | ### Reliability 147 | Issues in this domain mark code where you will get behavior other than what was expected. 148 | 149 | [![Bugs](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=bugs)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=bugs) 150 | [![Reliability remediation effort](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=reliability_remediation_effort)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=reliability_remediation_effort) 151 | [![Reliability Rating](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=reliability_rating)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=reliability_rating) 152 | 153 | 154 | ### Security 155 | 156 | [![Vulnerabilities](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=vulnerabilities)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=vulnerabilities) 157 | [![Security remediation effort ](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=security_remediation_effort)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=security_remediation_effort) 158 | [![Security Rating](https://sonarcloud.io/api/badges/measure?key=prstbt.ionic.d3.app&metric=security_rating)](https://sonarcloud.io/component_measures?id=prstbt.ionic.d3.app&metric=security_rating) 159 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-slate -------------------------------------------------------------------------------- /config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | D3.js Ionic 4 | D3.js in a Ionic mobile application: examples 5 | Ionic Framework Team 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /config/copy.config.js: -------------------------------------------------------------------------------- 1 | // this is a custom dictionary to make it easy to extend/override 2 | // provide a name for an entry, it can be anything such as 'copyAssets' or 'copyFonts' 3 | // then provide an object with a `src` array of globs and a `dest` string 4 | module.exports = { 5 | copyPrism: { 6 | src: ['{{ROOT}}/node_modules/prismjs/themes/**/*'], 7 | dest: '{{WWW}}/assets/prismjs/themes' 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # THANKS https://github.com/steveklabnik/automatically_update_github_pages_with_travis_example 4 | # CREATE orphan branch gh-pages 5 | # git checkout --orphan gh-pages 6 | # rm -rf *.md *.json *xml *.sh *.properties src config resources *.yml *.travis.yml .gitignore .editorconfig 7 | # git add . && git commit -am "Initial Commit" && git push origin -u gh-pages 8 | # git checkout master 9 | 10 | echo -e "#####################################################" 11 | echo -e " START DEPLOYING" 12 | echo -e "#####################################################" 13 | 14 | # stop executing if any errors occur, by default bash will just continue past any errors to run the next command 15 | # stop executing if an unset variable is encountered, by default bash will use an empty string for the value of such variables. 16 | set -o errexit -o nounset 17 | 18 | # Here we ensure that we only deploy when we commit against the master branch, 19 | # if not we just simply abort the deploy, no errors. So this way we can see the 20 | # result of the tests when we make pull request between different branches or 21 | # commit against a different branch than the master. 22 | if [ "$TRAVIS_BRANCH" != "master" ] 23 | then 24 | echo "This commit was made against the $TRAVIS_BRANCH and not the master! No deploy!" 25 | exit 0 26 | fi 27 | 28 | # This sets a variable, rev, with the short hash of HEAD. 29 | # We'll use this later in a commit message. 30 | rev=$(git rev-parse --short HEAD) 31 | 32 | # We need to cd into wherever our website built. 33 | # With Jekyll, it's _site. But do whatever. 34 | cd documentation 35 | 36 | 37 | # First, we initialize a new git repository. Yes, a new one. You'll see. 38 | git init 39 | 40 | # We then set our user name and user email. This person will have done the commits that go to gh-pages. 41 | # It's not a default branch, so don't worry, GitHub doesn't count these commits as contributions for your graph. 42 | git config user.name "proustibat" 43 | git config user.email "jennifer.proust@gmail.com" 44 | 45 | # Next, we add a remote, named upstream, and we set it to our project. 46 | # But we also interpolate that $GH_TOKEN variable, 47 | # which will allow us to push to this repository later. 48 | git remote add upstream "https://$GH_TOKEN@github.com/proustibat/d3js-ionic.git" 49 | git remote -v 50 | 51 | # We then fetch it and reset to the gh-pages branch. 52 | # Now, git sees this new repository as just some files 53 | # that change your upstream gh-pages branch. 54 | git fetch upstream 55 | git reset upstream/gh-pages 56 | 57 | 58 | # Sometimes, you'll need some extra files. 59 | # A CNAME is common, which sets a custom domain up. 60 | # You'll need to run whatever commands generate those files for you. 61 | #echo "rustbyexample.com" > CNAME 62 | 63 | 64 | # We then touch everything, so that git considers all of our local copies fresh. 65 | touch . 66 | 67 | # Turn off Jekyll (useful for files that start with an underscore) 68 | # https://help.github.com/articles/files-that-start-with-an-underscore-are-missing/ 69 | touch .nojekyll 70 | 71 | git status 72 | # We then add all changes, commit them, using our rev from earlier, and then push to upstream. 73 | git add -A . 74 | git commit -m "rebuild pages at ${rev}" 75 | # The -q keeps this a bit more quiet, and you can control the noisiness 76 | # of all these different git commands with a judicious sprinkling of -q. 77 | git push upstream HEAD:gh-pages 78 | -------------------------------------------------------------------------------- /ionic.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "d3-ionic-examples", 3 | "app_id": "", 4 | "type": "ionic-angular", 5 | "integrations": { 6 | "cordova": {} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "d3-ionic-examples", 3 | "version": "1.0.4", 4 | "author": "Proustibat", 5 | "homepage": "https://medium.com/@proustibat", 6 | "private": true, 7 | "scripts": { 8 | "tslint": "./node_modules/.bin/tslint -c tslint.json ./src/**/**/*.ts", 9 | "tslint:codeclimate": "./node_modules/.bin/tslint -c tslint-codeclimate.json ./src/**/**/*.ts --fix", 10 | "clean": "ionic-app-scripts clean", 11 | "build": "ionic-app-scripts build", 12 | "lint": "ionic-app-scripts lint", 13 | "ionic:build": "ionic-app-scripts build", 14 | "ionic:serve": "ionic-app-scripts serve", 15 | "typedoc": "./node_modules/.bin/typedoc src --exclude '**/*+(e2e|spec|index).ts'" 16 | }, 17 | "dependencies": { 18 | "@angular/common": "^5.2.0", 19 | "@angular/compiler": "^5.2.0", 20 | "@angular/compiler-cli": "^5.2.0", 21 | "@angular/core": "^5.2.0", 22 | "@angular/forms": "^5.2.0", 23 | "@angular/http": "^5.2.0", 24 | "@angular/platform-browser": "^5.2.0", 25 | "@angular/platform-browser-dynamic": "^5.2.0", 26 | "@ionic-native/core": "^4.5.2", 27 | "@ionic-native/splash-screen": "^4.5.2", 28 | "@ionic-native/status-bar": "^4.5.2", 29 | "@ionic/storage": "^2.1.3", 30 | "build": "0.1.4", 31 | "cordova-android": "^7.0.0", 32 | "cordova-ios": "^4.5.4", 33 | "cordova-plugin-device": "^2.0.1", 34 | "cordova-plugin-ionic-webview": "^1.1.16", 35 | "cordova-plugin-splashscreen": "^5.0.1", 36 | "cordova-plugin-whitelist": "^1.3.3", 37 | "d3": "^4.12.2", 38 | "d3-array": "^1.2.1", 39 | "d3-axis": "^1.0.8", 40 | "d3-scale": "^2.0.0", 41 | "d3-selection": "^1.2.0", 42 | "d3-shape": "^1.2.0", 43 | "ion-prism": "^2.0.5", 44 | "ionic-angular": "3.9.2", 45 | "ionic-plugin-keyboard": "^2.2.1", 46 | "ionicons": "^3.0.0", 47 | "rxjs": "^5.5.6", 48 | "sw-toolbox": "^3.6.0", 49 | "zone.js": "^0.8.20" 50 | }, 51 | "devDependencies": { 52 | "@ionic/app-scripts": "^3.1.7", 53 | "@types/d3": "^4.12.0", 54 | "tslint-ionic-rules": "0.0.13", 55 | "typedoc": "^0.10.0", 56 | "typescript": "^2.6.2" 57 | }, 58 | "description": "D3.js in a Ionic mobile application: examples", 59 | "cordova": { 60 | "plugins": { 61 | "cordova-plugin-device": {}, 62 | "cordova-plugin-ionic-webview": {}, 63 | "cordova-plugin-splashscreen": {}, 64 | "cordova-plugin-whitelist": {}, 65 | "ionic-plugin-keyboard": {} 66 | }, 67 | "platforms": [ 68 | "android", 69 | "ios" 70 | ] 71 | }, 72 | "config": { 73 | "ionic_copy": "./config/copy.config.js" 74 | } 75 | } -------------------------------------------------------------------------------- /resources/README.md: -------------------------------------------------------------------------------- 1 | These are Cordova resources. You can replace icon.png and splash.png and run 2 | `ionic cordova resources` to generate custom icons and splash screens for your 3 | app. See `ionic cordova resources --help` for details. 4 | 5 | Cordova reference documentation: 6 | 7 | - Icons: https://cordova.apache.org/docs/en/latest/config_ref/images.html 8 | - Splash Screens: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-splashscreen/ 9 | -------------------------------------------------------------------------------- /resources/android/icon/drawable-hdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/android/icon/drawable-hdpi-icon.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-ldpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/android/icon/drawable-ldpi-icon.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-mdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/android/icon/drawable-mdpi-icon.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-xhdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/android/icon/drawable-xhdpi-icon.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-xxhdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/android/icon/drawable-xxhdpi-icon.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-xxxhdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/android/icon/drawable-xxxhdpi-icon.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-hdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/android/splash/drawable-land-hdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-ldpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/android/splash/drawable-land-ldpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-mdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/android/splash/drawable-land-mdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-xhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/android/splash/drawable-land-xhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-xxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/android/splash/drawable-land-xxhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-xxxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/android/splash/drawable-land-xxxhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-hdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/android/splash/drawable-port-hdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-ldpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/android/splash/drawable-port-ldpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-mdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/android/splash/drawable-port-mdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-xhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/android/splash/drawable-port-xhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-xxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/android/splash/drawable-port-xxhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-xxxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/android/splash/drawable-port-xxxhdpi-screen.png -------------------------------------------------------------------------------- /resources/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/icon.png -------------------------------------------------------------------------------- /resources/icon.png.md5: -------------------------------------------------------------------------------- 1 | ed5edc3a9572141affa8dc787ff5c8d1 -------------------------------------------------------------------------------- /resources/ios/icon/icon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/icon/icon-1024.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/icon/icon-40.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/icon/icon-40@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/icon/icon-40@3x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/icon/icon-50.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/icon/icon-50@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/icon/icon-60.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/icon/icon-60@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/icon/icon-60@3x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/icon/icon-72.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/icon/icon-72@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/icon/icon-76.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/icon/icon-76@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/icon/icon-83.5@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/icon/icon-small.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/icon/icon-small@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-small@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/icon/icon-small@3x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/icon/icon.png -------------------------------------------------------------------------------- /resources/ios/icon/icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/icon/icon@2x.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-568h@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/splash/Default-568h@2x~iphone.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-667h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/splash/Default-667h.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-736h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/splash/Default-736h.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape-736h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/splash/Default-Landscape-736h.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/splash/Default-Landscape@2x~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape@~ipadpro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/splash/Default-Landscape@~ipadpro.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/splash/Default-Landscape~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Portrait@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/splash/Default-Portrait@2x~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Portrait@~ipadpro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/splash/Default-Portrait@~ipadpro.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Portrait~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/splash/Default-Portrait~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/splash/Default@2x~iphone.png -------------------------------------------------------------------------------- /resources/ios/splash/Default@2x~universal~anyany.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/splash/Default@2x~universal~anyany.png -------------------------------------------------------------------------------- /resources/ios/splash/Default~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/ios/splash/Default~iphone.png -------------------------------------------------------------------------------- /resources/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/resources/splash.png -------------------------------------------------------------------------------- /resources/splash.png.md5: -------------------------------------------------------------------------------- 1 | b48c2a081913a8a1dd6d28e4243843de -------------------------------------------------------------------------------- /sonar-project.properties: -------------------------------------------------------------------------------- 1 | sonar.projectName=D3.js Ionic 2 | sonar.projectKey=prstbt.ionic.d3.app 3 | sonar.host.url=https://sonarcloud.io 4 | sonar.organization=proustibat-github 5 | sonar.sources=src 6 | sonar.test.exclusions=src/**/* 7 | sonar.coverage.exclusions=src/**/* 8 | sonar.java.source=1.8 9 | sonar.java.binaries=. 10 | sonar.javascript.lcov.reportPath=coverage/lcov.info 11 | -------------------------------------------------------------------------------- /sonar.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function readJson { 4 | UNAMESTR=`uname` 5 | if [[ "$UNAMESTR" == 'Linux' ]]; then 6 | SED_EXTENDED='-r' 7 | elif [[ "$UNAMESTR" == 'Darwin' ]]; then 8 | SED_EXTENDED='-E' 9 | fi; 10 | 11 | VALUE=`grep -m 1 "\"${2}\"" ${1} | sed ${SED_EXTENDED} 's/^ *//;s/.*: *"//;s/",?//'` 12 | 13 | if [ ! "$VALUE" ]; then 14 | echo "Error: Cannot find \"${2}\" in ${1}" >&2; 15 | exit 1; 16 | else 17 | echo $VALUE ; 18 | fi; 19 | } 20 | 21 | VERSION=`readJson package.json version` || exit 1; 22 | 23 | sonar-scanner -X -Dsonar.projectVersion=$VERSION 24 | 25 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, ViewChild } from '@angular/core'; 2 | import { AlertController, MenuController, Nav, Platform } from 'ionic-angular'; 3 | import { StatusBar } from '@ionic-native/status-bar'; 4 | import { SplashScreen } from '@ionic-native/splash-screen'; 5 | 6 | import { Menu, PagesList, RootPage } from '../pages/index'; 7 | import { MenuOptionModel } from '../components/side-menu-content/models/menu-option-model'; 8 | import { SideMenuSettings } from '../components/side-menu-content/models/side-menu-settings'; 9 | import { HomePage } from '../pages/home/home'; 10 | import { SideMenuContentComponent } from '../components/side-menu-content/side-menu-content.component'; 11 | 12 | @Component({ 13 | templateUrl: 'app.html' 14 | }) 15 | 16 | export class MyApp { 17 | 18 | rootPage: any = RootPage; 19 | 20 | @ViewChild(Nav) nav: Nav; 21 | 22 | // Get the instance to call the public methods 23 | @ViewChild(SideMenuContentComponent) sideMenu: SideMenuContentComponent; 24 | 25 | pages = PagesList; 26 | 27 | menuData = Menu; 28 | 29 | // Options to show in the SideMenuComponent 30 | public options: MenuOptionModel[] = Menu; 31 | 32 | // Settings for the SideMenuComponent 33 | public sideMenuSettings: SideMenuSettings = { 34 | // Collapses any opened option when a new option is expanded. 35 | accordionMode: true, 36 | // The Ionic icon name to be used as the arrow in the header options 37 | arrowIcon: 'arrow-down', 38 | // If the selected option should be highlighted (if it is a sub item, its 39 | // parent will also be highlighted). If the selected option is a sub item, 40 | // its parent will be always shown expanded when opening the side menu 41 | showSelectedOption: true, 42 | // Name of the class to be added to the selected option. Only used when showSelectedOption is true 43 | selectedOptionClass: 'active-side-menu-option', 44 | // Vertically aligns the sub options without icons to the parent option 45 | indentSubOptionsWithoutIcons: false, 46 | }; 47 | 48 | constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, 49 | private alertCtrl: AlertController, 50 | private menuCtrl: MenuController) { 51 | platform.ready().then(() => { 52 | statusBar.styleDefault(); 53 | splashScreen.hide(); 54 | }); 55 | } 56 | 57 | public selectOption(option: MenuOptionModel): void { 58 | this.menuCtrl.close().then(() => { 59 | 60 | if (option.custom) { 61 | this.alertCtrl.create({ 62 | title: 'Information', 63 | message: 'You\'ve clicked a custom option!', 64 | buttons: ['Ok'] 65 | }).present(); 66 | } else { 67 | // Redirect to the selected page 68 | this.nav.setRoot(option.component || HomePage, { title: option.displayName }); 69 | } 70 | }); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/app/app.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Menu 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { ErrorHandler, NgModule } from '@angular/core'; 3 | import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular'; 4 | import { SplashScreen } from '@ionic-native/splash-screen'; 5 | import { StatusBar } from '@ionic-native/status-bar'; 6 | 7 | import { MyApp } from './app.component'; 8 | import { Pages } from '../pages/index'; 9 | import { Components } from '../components/index'; 10 | 11 | import { IonPrismDirective } from 'ion-prism'; 12 | 13 | @NgModule({ 14 | declarations: [ 15 | MyApp, 16 | Pages, 17 | Components, 18 | IonPrismDirective, 19 | ], 20 | imports: [ 21 | BrowserModule, 22 | IonicModule.forRoot(MyApp, { 23 | menuType: 'push' 24 | }) 25 | ], 26 | bootstrap: [IonicApp], 27 | entryComponents: [ 28 | MyApp, 29 | Pages, 30 | ], 31 | providers: [ 32 | StatusBar, 33 | SplashScreen, 34 | {provide: ErrorHandler, useClass: IonicErrorHandler} 35 | ] 36 | }) 37 | export class AppModule {} 38 | -------------------------------------------------------------------------------- /src/app/app.scss: -------------------------------------------------------------------------------- 1 | // http://ionicframework.com/docs/theming/ 2 | 3 | 4 | // App Global Sass 5 | // -------------------------------------------------- 6 | // Put style rules here that you want to apply globally. These 7 | // styles are for the entire app and not just one component. 8 | // Additionally, this file can be also used as an entry point 9 | // to import other Sass files to be included in the output CSS. 10 | // 11 | // Shared Sass variables, which can be used to adjust Ionic's 12 | // default Sass variables, belong in "theme/variables.scss". 13 | // 14 | // To declare rules for a specific mode, create a child rule 15 | // for the .md, .ios, or .wp mode classes. The mode class is 16 | // automatically applied to the element in the app. 17 | 18 | .prism { 19 | user-select: text; 20 | } 21 | 22 | svg { 23 | border: 1px solid color($colors, 'primary'); 24 | } 25 | 26 | h1, h2, h3, h4, h5, h6 { 27 | text-transform: uppercase; 28 | color: color($colors, primary); 29 | font-family: 'Hind Madurai', sans-serif; 30 | } 31 | 32 | h1 { 33 | background: color($colors, primary); 34 | color: color($colors, light); 35 | text-align: center; 36 | padding: $content-padding $heading-padding; 37 | } 38 | h2 { 39 | border-top: 2px solid color($colors, primary); 40 | border-bottom: 2px solid color($colors, primary); 41 | padding: $heading-padding $content-padding; 42 | } 43 | 44 | h3, h5, h6 { 45 | font-family: $font-family-base; 46 | font-weight: bold; 47 | padding: $heading-padding $content-padding; 48 | } 49 | 50 | -------------------------------------------------------------------------------- /src/app/main.ts: -------------------------------------------------------------------------------- 1 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 2 | 3 | import { AppModule } from './app.module'; 4 | 5 | platformBrowserDynamic().bootstrapModule(AppModule); 6 | -------------------------------------------------------------------------------- /src/assets/fonts/_barlow.scss: -------------------------------------------------------------------------------- 1 | /* latin-ext */ 2 | @font-face { 3 | font-family: 'Barlow'; 4 | font-style: normal; 5 | font-weight: 400; 6 | src: local('Barlow Regular'), local('Barlow-Regular'), url(https://fonts.gstatic.com/s/barlow/v1/YzSyOHtZUWdWTGx210qb7X-_kf6ByYO6CLYdB4HQE-Y.woff2) format('woff2'); 7 | unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; 8 | } 9 | /* latin */ 10 | @font-face { 11 | font-family: 'Barlow'; 12 | font-style: normal; 13 | font-weight: 400; 14 | src: local('Barlow Regular'), local('Barlow-Regular'), url(https://fonts.gstatic.com/s/barlow/v1/85USsdxXrj0ktofu610mIuvvDin1pK8aKteLpeZ5c0A.woff2) format('woff2'); 15 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215; 16 | } 17 | -------------------------------------------------------------------------------- /src/assets/fonts/_hind-madurai.scss: -------------------------------------------------------------------------------- 1 | /* tamil */ 2 | @font-face { 3 | font-family: 'Hind Madurai'; 4 | font-style: normal; 5 | font-weight: 400; 6 | src: local('Hind Madurai Regular'), local('HindMadurai-Regular'), url(https://fonts.gstatic.com/s/hindmadurai/v3/pJpl47LatORZNWf8rgdiyXu3h1vYaggiznMiqdceN_k.woff2) format('woff2'); 7 | unicode-range: U+0964-0965, U+0B82-0BFA, U+200B-200D, U+20B9, U+25CC; 8 | } 9 | /* latin-ext */ 10 | @font-face { 11 | font-family: 'Hind Madurai'; 12 | font-style: normal; 13 | font-weight: 400; 14 | src: local('Hind Madurai Regular'), local('HindMadurai-Regular'), url(https://fonts.gstatic.com/s/hindmadurai/v3/pJpl47LatORZNWf8rgdiyYjoYw3YTyktCCer_ilOlhE.woff2) format('woff2'); 15 | unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; 16 | } 17 | /* latin */ 18 | @font-face { 19 | font-family: 'Hind Madurai'; 20 | font-style: normal; 21 | font-weight: 400; 22 | src: local('Hind Madurai Regular'), local('HindMadurai-Regular'), url(https://fonts.gstatic.com/s/hindmadurai/v3/pJpl47LatORZNWf8rgdiyRampu5_7CjHW5spxoeN3Vs.woff2) format('woff2'); 23 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215; 24 | } -------------------------------------------------------------------------------- /src/assets/fonts/_lato.scss: -------------------------------------------------------------------------------- 1 | /* latin-ext */ 2 | @font-face { 3 | font-family: 'Lato'; 4 | font-style: normal; 5 | font-weight: 400; 6 | src: local('Lato Regular'), local('Lato-Regular'), url(https://fonts.gstatic.com/s/lato/v14/8qcEw_nrk_5HEcCpYdJu8BTbgVql8nDJpwnrE27mub0.woff2) format('woff2'); 7 | unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; 8 | } 9 | /* latin */ 10 | @font-face { 11 | font-family: 'Lato'; 12 | font-style: normal; 13 | font-weight: 400; 14 | src: local('Lato Regular'), local('Lato-Regular'), url(https://fonts.gstatic.com/s/lato/v14/MDadn8DQ_3oT6kvnUq_2r_esZW2xOQ-xsNqO47m55DA.woff2) format('woff2'); 15 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215; 16 | } -------------------------------------------------------------------------------- /src/assets/fonts/_open-sans.scss: -------------------------------------------------------------------------------- 1 | /* cyrillic-ext */ 2 | @font-face { 3 | font-family: 'Open Sans'; 4 | font-style: normal; 5 | font-weight: 400; 6 | src: local('Open Sans Regular'), local('OpenSans-Regular'), url(https://fonts.gstatic.com/s/opensans/v15/K88pR3goAWT7BTt32Z01m4X0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2'); 7 | unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; 8 | } 9 | /* cyrillic */ 10 | @font-face { 11 | font-family: 'Open Sans'; 12 | font-style: normal; 13 | font-weight: 400; 14 | src: local('Open Sans Regular'), local('OpenSans-Regular'), url(https://fonts.gstatic.com/s/opensans/v15/RjgO7rYTmqiVp7vzi-Q5UYX0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2'); 15 | unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; 16 | } 17 | /* greek-ext */ 18 | @font-face { 19 | font-family: 'Open Sans'; 20 | font-style: normal; 21 | font-weight: 400; 22 | src: local('Open Sans Regular'), local('OpenSans-Regular'), url(https://fonts.gstatic.com/s/opensans/v15/LWCjsQkB6EMdfHrEVqA1KYX0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2'); 23 | unicode-range: U+1F00-1FFF; 24 | } 25 | /* greek */ 26 | @font-face { 27 | font-family: 'Open Sans'; 28 | font-style: normal; 29 | font-weight: 400; 30 | src: local('Open Sans Regular'), local('OpenSans-Regular'), url(https://fonts.gstatic.com/s/opensans/v15/xozscpT2726on7jbcb_pAoX0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2'); 31 | unicode-range: U+0370-03FF; 32 | } 33 | /* vietnamese */ 34 | @font-face { 35 | font-family: 'Open Sans'; 36 | font-style: normal; 37 | font-weight: 400; 38 | src: local('Open Sans Regular'), local('OpenSans-Regular'), url(https://fonts.gstatic.com/s/opensans/v15/59ZRklaO5bWGqF5A9baEEYX0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2'); 39 | unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB; 40 | } 41 | /* latin-ext */ 42 | @font-face { 43 | font-family: 'Open Sans'; 44 | font-style: normal; 45 | font-weight: 400; 46 | src: local('Open Sans Regular'), local('OpenSans-Regular'), url(https://fonts.gstatic.com/s/opensans/v15/u-WUoqrET9fUeobQW7jkRYX0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2'); 47 | unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; 48 | } 49 | /* latin */ 50 | @font-face { 51 | font-family: 'Open Sans'; 52 | font-style: normal; 53 | font-weight: 400; 54 | src: local('Open Sans Regular'), local('OpenSans-Regular'), url(https://fonts.gstatic.com/s/opensans/v15/cJZKeOuBrn4kERxqtaUH3ZBw1xU1rKptJj_0jans920.woff2) format('woff2'); 55 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215; 56 | } -------------------------------------------------------------------------------- /src/assets/fonts/_source-sans-pro.scss: -------------------------------------------------------------------------------- 1 | /* cyrillic-ext */ 2 | @font-face { 3 | font-family: 'Source Sans Pro'; 4 | font-style: normal; 5 | font-weight: 400; 6 | src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url(https://fonts.gstatic.com/s/sourcesanspro/v11/ODelI1aHBYDBqgeIAH2zlIXYUqYVJeq1_JtQruA3_e8.woff2) format('woff2'); 7 | unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; 8 | } 9 | /* cyrillic */ 10 | @font-face { 11 | font-family: 'Source Sans Pro'; 12 | font-style: normal; 13 | font-weight: 400; 14 | src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url(https://fonts.gstatic.com/s/sourcesanspro/v11/ODelI1aHBYDBqgeIAH2zlExulUiGX8tUMVYeuJmbj48.woff2) format('woff2'); 15 | unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; 16 | } 17 | /* greek-ext */ 18 | @font-face { 19 | font-family: 'Source Sans Pro'; 20 | font-style: normal; 21 | font-weight: 400; 22 | src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url(https://fonts.gstatic.com/s/sourcesanspro/v11/ODelI1aHBYDBqgeIAH2zlBA0E65p__AYvizJB6RduYY.woff2) format('woff2'); 23 | unicode-range: U+1F00-1FFF; 24 | } 25 | /* greek */ 26 | @font-face { 27 | font-family: 'Source Sans Pro'; 28 | font-style: normal; 29 | font-weight: 400; 30 | src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url(https://fonts.gstatic.com/s/sourcesanspro/v11/ODelI1aHBYDBqgeIAH2zlC7-kXQoo3swP0nQ6K7J6xc.woff2) format('woff2'); 31 | unicode-range: U+0370-03FF; 32 | } 33 | /* vietnamese */ 34 | @font-face { 35 | font-family: 'Source Sans Pro'; 36 | font-style: normal; 37 | font-weight: 400; 38 | src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url(https://fonts.gstatic.com/s/sourcesanspro/v11/ODelI1aHBYDBqgeIAH2zlCxe5Tewm2_XWfbGchcXw4g.woff2) format('woff2'); 39 | unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB; 40 | } 41 | /* latin-ext */ 42 | @font-face { 43 | font-family: 'Source Sans Pro'; 44 | font-style: normal; 45 | font-weight: 400; 46 | src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url(https://fonts.gstatic.com/s/sourcesanspro/v11/ODelI1aHBYDBqgeIAH2zlIa1YDtoarzwSXxTHggEXMw.woff2) format('woff2'); 47 | unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; 48 | } 49 | /* latin */ 50 | @font-face { 51 | font-family: 'Source Sans Pro'; 52 | font-style: normal; 53 | font-weight: 400; 54 | src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url(https://fonts.gstatic.com/s/sourcesanspro/v11/ODelI1aHBYDBqgeIAH2zlJbPFduIYtoLzwST68uhz_Y.woff2) format('woff2'); 55 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215; 56 | } -------------------------------------------------------------------------------- /src/assets/fonts/index.scss: -------------------------------------------------------------------------------- 1 | @import "barlow"; 2 | @import "hind-madurai"; 3 | //@import "lato"; 4 | //@import "open-sans"; 5 | //@import "source-sans-pro"; -------------------------------------------------------------------------------- /src/assets/icon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/src/assets/icon/favicon.ico -------------------------------------------------------------------------------- /src/assets/imgs/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/src/assets/imgs/logo.png -------------------------------------------------------------------------------- /src/assets/imgs/screenshot-xaxis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/proustibat/d3js-ionic/da18be0cbef8c68e5a1a93a7cdb834ac06228598/src/assets/imgs/screenshot-xaxis.png -------------------------------------------------------------------------------- /src/components/common-header/common-header.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/components/common-header/common-header.scss: -------------------------------------------------------------------------------- 1 | common-header { 2 | .logo { 3 | width: 3rem; 4 | vertical-align: middle; 5 | margin-right: 1rem; 6 | padding-bottom: 0.5rem; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/components/common-header/common-header.ts: -------------------------------------------------------------------------------- 1 | import {Component, Renderer2, ViewChild} from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'common-header', 5 | templateUrl: 'common-header.html' 6 | }) 7 | export class CommonHeaderComponent { 8 | 9 | @ViewChild('ref') refIonTitle; 10 | 11 | defaultTitle = 'D3.js with Ionic'; 12 | 13 | constructor(private renderer: Renderer2) { 14 | 15 | } 16 | 17 | ngAfterViewInit() { 18 | const titleEl = this.refIonTitle.getElementRef().nativeElement.querySelector('.toolbar-title'); 19 | if (titleEl.childNodes.length === 0) { 20 | this.renderer.appendChild(titleEl, this.renderer.createText(this.defaultTitle)); 21 | } 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/components/components.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonHeaderComponent } from './common-header/common-header'; 3 | import { FooterLinksComponent } from './footer-links/footer-links'; 4 | import { ExpandableComponent } from './expandable/expandable'; 5 | @NgModule({ 6 | declarations: [CommonHeaderComponent, 7 | FooterLinksComponent, 8 | ExpandableComponent], 9 | imports: [], 10 | exports: [CommonHeaderComponent, 11 | FooterLinksComponent, 12 | ExpandableComponent] 13 | }) 14 | export class ComponentsModule {} 15 | -------------------------------------------------------------------------------- /src/components/expandable/expandable.html: -------------------------------------------------------------------------------- 1 |
6 | 7 |
8 | 15 | -------------------------------------------------------------------------------- /src/components/expandable/expandable.scss: -------------------------------------------------------------------------------- 1 | expandable { 2 | .expand-wrapper { 3 | max-height: 0!important; 4 | overflow: hidden; 5 | 6 | 7 | // opening 8 | &.expanded { 9 | max-height: 999px!important; 10 | transition: max-height 0.25s ease-in-out; 11 | } 12 | 13 | // closing 14 | &.collapsed { 15 | transition: max-height 0.25s ease; 16 | } 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/components/expandable/expandable.ts: -------------------------------------------------------------------------------- 1 | import {Component, ElementRef, Input, Renderer2, ViewChild} from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'expandable', 5 | templateUrl: 'expandable.html' 6 | }) 7 | 8 | export class ExpandableComponent { 9 | 10 | @ViewChild('expandWrapper', { read: ElementRef }) expandWrapper; 11 | 12 | @Input('expanded') expanded = false; 13 | @Input('button') hasButton = true; 14 | @Input('showText') showBtnTxt = 'Show more'; 15 | @Input('hideText') hideBtnTxt = 'Show less'; 16 | @Input('btnColor') btnColor = 'dark'; 17 | 18 | constructor(public renderer: Renderer2) { 19 | console.log('Hello ExpandableComponent Component'); 20 | } 21 | 22 | expand() { 23 | this.expanded = !this.expanded; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/components/footer-links/footer-links.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | 14 | 15 | 16 | 17 | 18 | 29 | 30 | 31 | 32 | 39 | Read this tutorial
online on Dashing D3 40 |
41 |
42 | 43 | 44 | 55 | 56 | 57 |
58 | -------------------------------------------------------------------------------- /src/components/footer-links/footer-links.scss: -------------------------------------------------------------------------------- 1 | footer-links { 2 | display: block; 3 | width: 100%; 4 | left: 0; 5 | padding: $content-padding; 6 | margin-top: $content-margin; 7 | background: color($colors, light); 8 | 9 | button.button:not('.home-button') { 10 | width: 10vw; 11 | height: 10vw; 12 | } 13 | 14 | ion-col:first-child, 15 | ion-col:last-child { 16 | min-width: 10vw; 17 | min-height: 10vw; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/components/footer-links/footer-links.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input } from '@angular/core'; 2 | import { Events, NavController } from 'ionic-angular'; 3 | import { Subscription as RxjsSubscription } from 'rxjs'; 4 | import { PagesList } from '../../pages/index'; 5 | import { SideMenuRedirectEvent, 6 | SideMenuRedirectEventData } from '../side-menu-content/models/side-menu-redirect-events'; 7 | 8 | @Component({ 9 | selector: 'footer-links', 10 | templateUrl: 'footer-links.html' 11 | }) 12 | export class FooterLinksComponent { 13 | 14 | @Input() tutorialUrl: string; 15 | 16 | subscriptionEnter: RxjsSubscription; 17 | subscriptionLeave: RxjsSubscription; 18 | 19 | previousPage: any; 20 | nextPage: any; 21 | 22 | constructor(public navCtrl: NavController, private eventCtrl: Events) { 23 | 24 | } 25 | 26 | ngAfterViewInit() { 27 | 28 | this.subscriptionEnter = this.navCtrl.viewDidEnter.subscribe((viewCtrl) => { 29 | 30 | this.subscriptionLeave = this.navCtrl.viewWillLeave.subscribe(() => { 31 | 32 | this.subscriptionLeave.unsubscribe(); 33 | this.subscriptionEnter.unsubscribe(); 34 | 35 | }); 36 | 37 | // TODO : ne pas chercher dans PagesList qui va etre supprime, 38 | // parcourir Menu, et voir si la page appartient a un sous menu 39 | const currentViewInList = PagesList.find((item) => item.component === viewCtrl.component); 40 | const currentIndexView = PagesList.indexOf(currentViewInList); 41 | 42 | this.previousPage = PagesList[ currentIndexView - 1 ] || null; 43 | this.nextPage = PagesList[ currentIndexView + 1 ] || null; 44 | 45 | }); 46 | 47 | } 48 | 49 | openPage(page: any) { 50 | 51 | // Since we're redirecting to a page without clicking the option from the 52 | // side menu, we need to use events to tell the side menu component 53 | // which option should be marked as selected. 54 | const redirectData: SideMenuRedirectEventData = { 55 | displayName: page.title 56 | }; 57 | 58 | // Send the event to the side menu component 59 | this.eventCtrl.publish(SideMenuRedirectEvent, redirectData); 60 | 61 | this.navCtrl.setRoot(page.component); 62 | 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/components/index.ts: -------------------------------------------------------------------------------- 1 | import { CommonHeaderComponent } from './common-header/common-header'; 2 | import { FooterLinksComponent } from './footer-links/footer-links'; 3 | import { ExpandableComponent } from './expandable/expandable'; 4 | import { SideMenuContentComponent } from './side-menu-content/side-menu-content.component'; 5 | 6 | export const Components = [ 7 | CommonHeaderComponent, 8 | FooterLinksComponent, 9 | ExpandableComponent, 10 | SideMenuContentComponent 11 | ]; 12 | -------------------------------------------------------------------------------- /src/components/side-menu-content/models/inner-menu-option-model.ts: -------------------------------------------------------------------------------- 1 | import { MenuOptionModel } from './menu-option-model'; 2 | 3 | export class InnerMenuOptionModel { 4 | public static fromMenuOptionModel(option: MenuOptionModel, parent?: InnerMenuOptionModel): InnerMenuOptionModel { 5 | 6 | const innerMenuOptionModel = new InnerMenuOptionModel(); 7 | 8 | innerMenuOptionModel.id = this.counter++; 9 | innerMenuOptionModel.iconName = option.iconName; 10 | innerMenuOptionModel.displayName = option.displayName; 11 | innerMenuOptionModel.targetOption = option; 12 | innerMenuOptionModel.parent = parent || null; 13 | 14 | innerMenuOptionModel.selected = option.selected; 15 | 16 | if (option.subItems) { 17 | innerMenuOptionModel.expanded = false; 18 | innerMenuOptionModel.subItemsCount = option.subItems.length; 19 | innerMenuOptionModel.subOptions = []; 20 | 21 | option.subItems.forEach((subItem) => { 22 | 23 | const innerSubItem = InnerMenuOptionModel.fromMenuOptionModel(subItem, innerMenuOptionModel); 24 | innerMenuOptionModel.subOptions.push(innerSubItem); 25 | 26 | // Select the parent if any 27 | // child option is selected 28 | if (subItem.selected) { 29 | innerSubItem.parent.selected = true; 30 | innerSubItem.parent.expanded = true; 31 | } 32 | 33 | }); 34 | } 35 | 36 | return innerMenuOptionModel; 37 | } 38 | 39 | private static counter = 1; 40 | 41 | id: number; 42 | iconName: string; 43 | displayName: string; 44 | 45 | targetOption: MenuOptionModel; 46 | 47 | parent: InnerMenuOptionModel; 48 | 49 | selected: boolean; 50 | 51 | expanded: boolean; 52 | subItemsCount: number; 53 | subOptions: InnerMenuOptionModel[]; 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/components/side-menu-content/models/menu-option-model.ts: -------------------------------------------------------------------------------- 1 | // MenuOptionModel interface 2 | export interface MenuOptionModel { 3 | 4 | // If the option has sub items and the iconName is null, 5 | // the default icon will be 'ios-arrow-down'. 6 | iconName?: string; 7 | 8 | // The name to display in the menu 9 | displayName: string; 10 | 11 | // Target component (or null if it's a "special option" like login/logout) 12 | component?: any; 13 | 14 | // Here you can pass whatever you need, and will be returned if this 15 | // option is selected. That way you can handle login/logout options, 16 | // changing the language, and son on... 17 | custom?: any; 18 | 19 | // Set if this option is selected by default 20 | selected?: boolean; 21 | 22 | // List of sub items if any 23 | subItems?: Array; 24 | } 25 | -------------------------------------------------------------------------------- /src/components/side-menu-content/models/side-menu-redirect-events.ts: -------------------------------------------------------------------------------- 1 | // SideMenuRedirectEvent constant 2 | export const SideMenuRedirectEvent = 'sidemenu:redirect'; 3 | 4 | // SideMenuRedirectEventData interface 5 | export interface SideMenuRedirectEventData { 6 | displayName?: string; 7 | } 8 | -------------------------------------------------------------------------------- /src/components/side-menu-content/models/side-menu-settings.ts: -------------------------------------------------------------------------------- 1 | // SideMenuSettings interface 2 | export interface SideMenuSettings { 3 | accordionMode?: boolean; 4 | arrowIcon?: string; 5 | 6 | itemHeight?: { 7 | ios?: number, 8 | md?: number, 9 | wp?: number 10 | }; 11 | 12 | showSelectedOption?: boolean; 13 | selectedOptionClass?: string; 14 | 15 | indentSubOptionsWithoutIcons?: boolean; 16 | 17 | subOptionIndentation?: { 18 | ios?: string, 19 | md?: string, 20 | wp?: string 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /src/components/side-menu-content/readme.md: -------------------------------------------------------------------------------- 1 | https://github.com/sebaferreras/Ionic3-MultiLevelSideMenu -------------------------------------------------------------------------------- /src/components/side-menu-content/side-menu-content.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | {{ option.displayName }} 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 23 | 26 | {{ option.displayName }} 27 | 28 | 29 | 30 |
32 | 33 | 34 | 35 | {{ item.displayName }} 36 | 37 | 38 |
39 |
40 | 41 |
42 | 43 |
44 |
-------------------------------------------------------------------------------- /src/components/side-menu-content/side-menu-content.component.scss: -------------------------------------------------------------------------------- 1 | // ------------------------------------ // 2 | // Global variables // 3 | // ------------------------------------ // 4 | $item-color-bg: color($colors, primary); 5 | $header-color-bg: color($colors, light); 6 | $animation-duration: 0.3s; 7 | 8 | // ------------------------------------ // 9 | // Hide scroll bar in the side menu // 10 | // ------------------------------------ // 11 | ion-menu ion-content .scroll-content::-webkit-scrollbar { 12 | display: none; 13 | } 14 | 15 | // ------------------------------------ // 16 | // Simple items // 17 | // ------------------------------------ // 18 | ion-item.item-ios, 19 | ion-item.item-md, 20 | ion-item.item-wp { 21 | 22 | padding-left: 16px; 23 | padding-right: 16px; 24 | min-height: 50px; 25 | 26 | &.active-side-menu-option { 27 | 28 | 29 | //background-color: invert(color($colors, dark)); 30 | background-color: color($colors, dark); 31 | color: color($colors, light); 32 | 33 | &.sub-option { 34 | 35 | 36 | } 37 | } 38 | 39 | &.item.item-block { 40 | border-bottom: 1px solid $item-color-bg; 41 | //color: color($colors, dark); 42 | } 43 | 44 | & [item-left], 45 | & [item-right] { 46 | margin-left: 0; 47 | } 48 | 49 | & ion-icon[item-left] + .item-inner, 50 | & ion-icon[item-left] + .item-input { 51 | margin-left: 8px; 52 | } 53 | } 54 | 55 | // ------------------------------------ // 56 | // Multi level items // 57 | // ------------------------------------ // 58 | ion-list.accordion-menu { 59 | 60 | ion-item.header { 61 | 62 | background-color: $header-color-bg; 63 | //color: color($colors, dark); 64 | 65 | &.active-side-menu-option { 66 | color: color($colors, dark); 67 | font-weight: bold; 68 | } 69 | 70 | ion-icon.header-icon { 71 | will-change: transform; 72 | transition: transform $animation-duration ease; 73 | 74 | &.rotate { 75 | -webkit-transform: rotate(-180deg); 76 | -moz-transform: rotate(-180deg); 77 | -ms-transform: rotate(-180deg); 78 | -o-transform: rotate(-180deg); 79 | transform: rotate(-180deg); 80 | } 81 | } 82 | } 83 | 84 | div.options { 85 | will-change: height; 86 | transition: height $animation-duration ease; 87 | overflow-y: hidden; 88 | height: 0; 89 | } 90 | 91 | // Sub options without icons 92 | ion-item.item.item-block.item-ios.no-icon .item-inner { 93 | margin-left: 48px; 94 | } 95 | 96 | ion-item.item.item-block.item-md.no-icon .item-inner, 97 | ion-item.item.item-block.item-wp.no-icon .item-inner { 98 | margin-left: 40px; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/components/side-menu-content/side-menu-content.component.ts: -------------------------------------------------------------------------------- 1 | // Angular 2 | import { Component, Input, Output, EventEmitter, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core'; // tslint:disable-line 3 | 4 | // Ionic 5 | import { Events, Platform } from 'ionic-angular'; 6 | 7 | // Models 8 | import { SideMenuSettings } from './models/side-menu-settings'; 9 | import { MenuOptionModel } from './models/menu-option-model'; 10 | import { SideMenuRedirectEvent, SideMenuRedirectEventData } from './models/side-menu-redirect-events'; 11 | import { InnerMenuOptionModel } from './models/inner-menu-option-model'; 12 | 13 | @Component({ 14 | selector: 'side-menu-content', 15 | templateUrl: 'side-menu-content.component.html', 16 | changeDetection: ChangeDetectionStrategy.OnPush 17 | }) 18 | 19 | export class SideMenuContentComponent { 20 | 21 | // Main inputs 22 | public menuSettings: SideMenuSettings; 23 | public menuOptions: MenuOptionModel[]; 24 | public collapsableItems: InnerMenuOptionModel[] = []; 25 | 26 | // Outputs: return the selected option to the caller 27 | @Output() selectOption = new EventEmitter(); 28 | 29 | // Private properties 30 | private selectedOption: InnerMenuOptionModel; 31 | 32 | @Input('options') 33 | set options(value: MenuOptionModel[]) { 34 | if (value) { 35 | // Keep a reference to the options 36 | // sent to this component 37 | this.menuOptions = value; 38 | this.collapsableItems = new Array(); 39 | 40 | // Map the options to our internal models 41 | this.menuOptions.forEach((option) => { 42 | 43 | const innerMenuOption = InnerMenuOptionModel.fromMenuOptionModel(option); 44 | this.collapsableItems.push(innerMenuOption); 45 | 46 | // Check if there's any option marked as selected 47 | if (option.selected) { 48 | this.selectedOption = innerMenuOption; 49 | } else if (innerMenuOption.subItemsCount) { 50 | innerMenuOption.subOptions.forEach((subItem) => { 51 | if (subItem.selected) { 52 | this.selectedOption = subItem; 53 | } 54 | }); 55 | } 56 | }); 57 | } 58 | } 59 | 60 | @Input('settings') 61 | set settings(value: SideMenuSettings) { 62 | if (value) { 63 | this.menuSettings = value; 64 | this.mergeSettings(); 65 | } 66 | } 67 | 68 | constructor(private platform: Platform, 69 | private eventsCtrl: Events, 70 | private cdRef: ChangeDetectorRef) { 71 | 72 | // Handle the redirect event 73 | this.eventsCtrl.subscribe(SideMenuRedirectEvent, (data: SideMenuRedirectEventData) => { 74 | this.updateSelectedOption(data); 75 | }); 76 | } 77 | 78 | ngOnDestroy() { 79 | this.eventsCtrl.unsubscribe(SideMenuRedirectEvent); 80 | } 81 | 82 | // --------------------------------------------------- 83 | // PUBLIC methods 84 | // --------------------------------------------------- 85 | 86 | // Send the selected option to the caller component 87 | public select(option: InnerMenuOptionModel): void { 88 | if (this.menuSettings.showSelectedOption) { 89 | this.setSelectedOption(option); 90 | } 91 | 92 | // Return the selected option (not our inner option) 93 | this.selectOption.emit(option.targetOption); 94 | } 95 | 96 | // Toggle the sub options of the selected item 97 | public toggleItemOptions(targetOption: InnerMenuOptionModel): void { 98 | 99 | if (!targetOption) return; 100 | 101 | // If the accordion mode is set to true, we need 102 | // to collapse all the other menu options 103 | if (this.menuSettings.accordionMode) { 104 | this.collapsableItems.forEach((option) => { 105 | if (option.id !== targetOption.id) { 106 | option.expanded = false; 107 | } 108 | }); 109 | } 110 | 111 | // Toggle the selected option 112 | targetOption.expanded = !targetOption.expanded; 113 | } 114 | 115 | // Reset the entire menu 116 | public collapseAllOptions(): void { 117 | this.collapsableItems.forEach((option) => { 118 | if (!option.selected) { 119 | option.expanded = false; 120 | } 121 | 122 | if (option.subItemsCount) { 123 | option.subOptions.forEach((subItem) => { 124 | if (subItem.selected) { 125 | // Expand the parent if any of 126 | // its childs is selected 127 | subItem.parent.expanded = true; 128 | } 129 | }); 130 | } 131 | }); 132 | 133 | // Update the view since there wasn't 134 | // any user interaction with it 135 | this.cdRef.detectChanges(); 136 | } 137 | 138 | // Get the proper indentation of each option 139 | public get subOptionIndentation(): string { 140 | if (this.platform.is('ios')) return this.menuSettings.subOptionIndentation.ios; 141 | if (this.platform.is('windows')) return this.menuSettings.subOptionIndentation.wp; 142 | return this.menuSettings.subOptionIndentation.md; 143 | } 144 | 145 | // Get the proper height of each option 146 | public get itemHeight(): number { 147 | if (this.platform.is('ios')) return this.menuSettings.itemHeight.ios; 148 | if (this.platform.is('windows')) return this.menuSettings.itemHeight.wp; 149 | return this.menuSettings.itemHeight.md; 150 | } 151 | 152 | // --------------------------------------------------- 153 | // PRIVATE methods 154 | // --------------------------------------------------- 155 | 156 | // Method that set the selected option and its parent 157 | private setSelectedOption(option: InnerMenuOptionModel) { 158 | if (!option.targetOption.component) return; 159 | 160 | // Clean the current selected option if any 161 | if (this.selectedOption) { 162 | this.selectedOption.selected = false; 163 | this.selectedOption.targetOption.selected = false; 164 | 165 | if (this.selectedOption.parent) { 166 | this.selectedOption.parent.selected = false; 167 | this.selectedOption.parent.expanded = false; 168 | } 169 | 170 | this.selectedOption = null; 171 | } 172 | 173 | // Set this option to be the selected 174 | option.selected = true; 175 | option.targetOption.selected = true; 176 | 177 | if (option.parent) { 178 | option.parent.selected = true; 179 | option.parent.expanded = true; 180 | } 181 | 182 | // Keep a reference to the selected option 183 | this.selectedOption = option; 184 | 185 | // Update the view if needed since we may have 186 | // expanded or collapsed some options 187 | this.cdRef.detectChanges(); 188 | } 189 | 190 | // Update the selected option 191 | private updateSelectedOption(data: SideMenuRedirectEventData): void { 192 | 193 | if (!data.displayName) { 194 | return; 195 | } 196 | 197 | let targetOption; 198 | 199 | this.collapsableItems.forEach((option) => { 200 | if (option.displayName.toLowerCase() === data.displayName.toLowerCase()) { 201 | targetOption = option; 202 | } else if (option.subItemsCount) { 203 | option.subOptions.forEach((subOption) => { 204 | if (subOption.displayName.toLowerCase() === data.displayName.toLowerCase()) { 205 | targetOption = subOption; 206 | } 207 | }); 208 | } 209 | }); 210 | 211 | if (targetOption) { 212 | this.setSelectedOption(targetOption); 213 | } 214 | } 215 | 216 | // Merge the settings received with the default settings 217 | private mergeSettings(): void { 218 | const defaultSettings: SideMenuSettings = { 219 | accordionMode: false, 220 | itemHeight: { 221 | ios: 50, 222 | md: 50, 223 | wp: 50 224 | }, 225 | arrowIcon: 'ios-arrow-down', 226 | showSelectedOption: false, 227 | selectedOptionClass: 'selected-option', 228 | indentSubOptionsWithoutIcons: false, 229 | subOptionIndentation: { 230 | ios: '16px', 231 | md: '16px', 232 | wp: '16px' 233 | } 234 | }; 235 | 236 | if (!this.menuSettings) { 237 | // Use the default values 238 | this.menuSettings = defaultSettings; 239 | return; 240 | } 241 | 242 | const ms = this.menuSettings; 243 | if (!ms.itemHeight) { 244 | ms.itemHeight = defaultSettings.itemHeight; 245 | } else { 246 | const defIos = this.isDefinedAndPositive(ms.itemHeight.ios); 247 | const defMd = this.isDefinedAndPositive(ms.itemHeight.md); 248 | const defWp = this.isDefinedAndPositive(ms.itemHeight.wp); 249 | const heightIos = defIos ? ms.itemHeight.ios : defaultSettings.itemHeight.ios; 250 | const heightMd = defMd ? ms.itemHeight.md : defaultSettings.itemHeight.md; 251 | const heightWp = defWp ? ms.itemHeight.wp : defaultSettings.itemHeight.wp; 252 | ms.itemHeight.ios = heightIos; 253 | ms.itemHeight.md = heightMd; 254 | ms.itemHeight.wp = heightWp; 255 | } 256 | const shSeOpt = 'showSelectedOption'; 257 | ms[shSeOpt] = this.isDefined(ms[shSeOpt]) ? ms[shSeOpt] : defaultSettings[shSeOpt]; 258 | 259 | const accModOpt = 'accordionMode'; 260 | ms[accModOpt] = this.isDefined(ms[accModOpt]) ? ms[accModOpt] : defaultSettings[accModOpt]; 261 | 262 | const arrIco = 'arrowIcon'; 263 | ms[arrIco] = this.isDefined(ms[arrIco]) ? ms[arrIco] : defaultSettings[arrIco]; 264 | 265 | const selOptClass = 'selectedOptionClass'; 266 | ms[selOptClass] = this.isDefined(ms[selOptClass]) ? ms[selOptClass] : defaultSettings[selOptClass]; 267 | 268 | const suOptInd = 'subOptionIndentation'; 269 | ms[suOptInd] = this.isDefined(ms[suOptInd]) ? ms[suOptInd] : defaultSettings[suOptInd]; 270 | 271 | const indSuOptWIco = 'indentSubOptionsWithoutIcons'; 272 | ms[indSuOptWIco] = this.isDefined(ms[indSuOptWIco]) ? ms[indSuOptWIco] : defaultSettings[indSuOptWIco]; 273 | 274 | if (!ms[suOptInd]) { 275 | ms[suOptInd] = defaultSettings[suOptInd]; 276 | } else { 277 | const suOpInd = 'subOptionIndentation'; 278 | ms[suOpInd].ios = this.isDefined(ms[suOpInd].ios) ? ms[suOpInd].ios : defaultSettings[suOpInd].ios; 279 | ms[suOpInd].md = this.isDefined(ms[suOpInd].md) ? ms[suOpInd].md : defaultSettings[suOpInd].md; 280 | ms[suOpInd].wp = this.isDefined(ms[suOpInd].wp) ? ms[suOpInd].wp : defaultSettings[suOpInd].wp; 281 | } 282 | } 283 | 284 | private isDefined(property: any): boolean { 285 | return property !== null && property !== undefined; 286 | } 287 | 288 | private isDefinedAndPositive(property: any): boolean { 289 | return this.isDefined(property) && !isNaN(property) && property > 0; 290 | } 291 | } 292 | -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ionic App 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ionic", 3 | "short_name": "Ionic", 4 | "start_url": "index.html", 5 | "display": "standalone", 6 | "icons": [{ 7 | "src": "assets/imgs/logo.png", 8 | "sizes": "512x512", 9 | "type": "image/png" 10 | }], 11 | "background_color": "#4e8ef7", 12 | "theme_color": "#4e8ef7" 13 | } -------------------------------------------------------------------------------- /src/pages/axes/axes.html: -------------------------------------------------------------------------------- 1 | 2 | D3.js with Ionic 3 | 4 | 5 | 6 | 7 | 8 |

D3.js Axes

9 | 10 |
11 |

First, you need to import the d3-axis and d3-scale libraries:

12 | 16 |

For what follows, remember what you learned about scales in the scales tutorial page.

17 |

You can read the online documentation about d3-axis with typescript on this human-readable reference.

18 |
19 | 20 |

Generating a D3.js Axis

21 |
22 | 35 |

Note that xAxis is a function.

36 |
37 | 38 | 39 |

Calling the D3.js Axis Function

40 |
41 |

Here is the SVG viewport we will use: it has a width of 300. 42 | We want to map the numbers of 0 to 100 (this is the domain) onto the width our svg (300). 43 | So we define the range of the scale from 0 to 300.

44 | 45 | 52 | 53 |

To call the axis function, we use the .call() method of the svg container:

54 | 60 |
61 | 62 |

The result in the developer tool:

63 | Axis svg in developer tool 64 | 65 | 66 |

What about other d3-axis methods to create an axis?

67 |

d3Axis.axisTop

68 |
76 |
77 | 78 |

d3Axis.axisLeft

79 |
87 |
88 | 89 |

d3Axis.axisRight

90 |
98 |
99 | 100 |

Regardless of orientation, axes are always rendered at the origin. To change the position of the axis with respect to the chart, specify a transform attribute on the containing element. For example:

101 | 104 | 105 |
106 | 107 | 108 | 109 | 110 |
111 | -------------------------------------------------------------------------------- /src/pages/axes/axes.scss: -------------------------------------------------------------------------------- 1 | page-axes { 2 | .link { 3 | text-decoration: underline; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /src/pages/axes/axes.ts: -------------------------------------------------------------------------------- 1 | import { Component, ElementRef } from '@angular/core'; 2 | import { NavController } from 'ionic-angular'; 3 | import { ScalesPage } from '../scales/scales'; 4 | 5 | import * as d3 from 'd3-selection'; 6 | import { Axis, default as d3Axis } from 'd3-axis'; 7 | import * as d3Scale from 'd3-scale'; 8 | 9 | @Component({ 10 | selector: 'page-axes', 11 | templateUrl: 'axes.html', 12 | }) 13 | 14 | export class AxesPage { 15 | 16 | scalePage = ScalesPage; 17 | 18 | xAxis: Axis; 19 | 20 | constructor(public navCtrl: NavController, private elementRef: ElementRef) { } 21 | 22 | ionViewDidLoad() { 23 | 24 | this.createAxis(); 25 | 26 | this.createSVG(); 27 | 28 | this.createOtherAxis(); 29 | 30 | } 31 | 32 | createAxis(): void { 33 | 34 | // Create the Scale we will use for the Axis 35 | const axisScale = d3Scale 36 | .scaleLinear() 37 | .domain([ 0, 100 ]) 38 | .range([ 0, 300 ]); 39 | 40 | // Generate the D3.js Axis 41 | this.xAxis = d3Axis.axisBottom(axisScale); 42 | 43 | } 44 | 45 | createSVG(): void { 46 | // Create the SVG Viewport selection 47 | const svgContainer = d3.select('#axis-svg').append('svg') 48 | .attr('width', 300) 49 | .attr('height', 100); 50 | 51 | // Create a group Element for the Axis elements and call the xAxis function 52 | svgContainer.append('g') 53 | .call(this.xAxis); 54 | } 55 | 56 | createOtherAxis(): void { 57 | 58 | this.elementRef.nativeElement.querySelectorAll('.svg-axis').forEach((container) => { 59 | 60 | const config = JSON.parse(container.getAttribute('data-config')); 61 | 62 | // Create the SVG Viewport selection 63 | const svgContainer = d3.select('#' + container.id).append('svg') 64 | .attr('width', config.width) 65 | .attr('height', config.height); 66 | 67 | // Create the Scale we will use for the Axis 68 | const axisScale = d3Scale 69 | .scaleLinear() 70 | .domain(config.domain) 71 | .range(config.range); 72 | 73 | // Create a group Element for the Axis elements and 74 | const axisGroup = svgContainer.append('g'); 75 | 76 | // Generate the D3.js Axis 77 | let axis: Axis; 78 | let translateValue = [ 0, 0 ]; 79 | switch (config.axisPosition) { 80 | case 'top': 81 | axis = d3Axis.axisTop(axisScale); 82 | translateValue = [ 0, 20 ]; 83 | break; 84 | case 'left': 85 | axis = d3Axis.axisLeft(axisScale); 86 | translateValue = [ 20, 0 ]; 87 | break; 88 | case 'right': 89 | axis = d3Axis.axisRight(axisScale); 90 | break; 91 | default: 92 | axis = d3Axis.axisBottom(axisScale); 93 | break; 94 | } 95 | 96 | // Call the xAxis function on the axis group 97 | axisGroup.call(axis); 98 | 99 | // Call the translate to display the axis in the viewport 100 | axisGroup.attr('transform', 'translate(' + translateValue.join() + ')'); 101 | 102 | }); 103 | 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /src/pages/basic-elements/basic-elements.html: -------------------------------------------------------------------------------- 1 | 2 | D3.js with Ionic 3 | 4 | 5 | 6 | 7 |

Basic SVG Elements

8 | 9 |

Creating SVG Elements Based on Data

10 | 11 |
12 | 13 |
14 | 15 | 16 | 55 | 56 |
57 | 58 | 59 | 60 |

Using the SVG Coordinate Space

61 |
62 | 63 |
64 | 65 | 66 | 89 | 90 | 91 |
92 | 93 | 94 | 95 | 96 |
97 | -------------------------------------------------------------------------------- /src/pages/basic-elements/basic-elements.scss: -------------------------------------------------------------------------------- 1 | page-basic-elements { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/pages/basic-elements/basic-elements.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | import * as d3 from 'd3-selection'; 4 | 5 | @Component({ 6 | selector: 'page-basic-elements', 7 | templateUrl: 'basic-elements.html', 8 | }) 9 | export class BasicElementsPage { 10 | ionViewDidLoad(): void { 11 | this.createCircles(); 12 | this.createCoordinateCircles(); 13 | 14 | } 15 | 16 | createCircles(): void { 17 | // the data set 18 | const circleRadii = [ 40, 20, 10 ]; 19 | 20 | // an SVG element to hold the SVG Circles 21 | const svgContainer = d3.select('#circles-basic').append('svg') 22 | .attr('width', 300) 23 | .attr('height', 100) 24 | .style('border', '1px solid black'); 25 | 26 | const circles = svgContainer 27 | // selectAll circle 28 | .selectAll('circle') 29 | // bind the data 30 | .data(circleRadii) 31 | // select the virtual .enter() selection 32 | .enter() 33 | // append the SVG circle elements 34 | .append('circle'); 35 | 36 | // Specify the attributes for each circle. 37 | circles 38 | // cx - The x-axis coordinate of the center of the circle 39 | .attr('cx', 50) 40 | // cy - The y-axis coordinate of the center of the circle 41 | .attr('cy', 50) 42 | // r - The radius of the circle. 43 | .attr('r', (d) => d) 44 | // use D3.js' .style() operator to modify the CSS style property 45 | .style('fill', (d) => { 46 | let returnColor; 47 | if (d === 40) { 48 | returnColor = 'green'; 49 | } else if (d === 20) { returnColor = 'purple'; } else if (d === 10) { returnColor = 'red'; } 50 | return returnColor; 51 | }); 52 | 53 | } 54 | 55 | createCoordinateCircles(): void { 56 | const spaceCircles = [ 30, 70, 110 ]; 57 | 58 | const svgContainer = d3.select('#coordinateCircles').append('svg') 59 | .attr('width', 300) 60 | .attr('height', 200) 61 | .style('border', '1px solid black'); 62 | 63 | const circles = svgContainer.selectAll('circle') 64 | .data(spaceCircles) 65 | .enter() 66 | .append('circle'); 67 | 68 | circles 69 | // add the attributes to the circle selection. 70 | // The data set specifies the circle center's x-coordinate and y-coordinate, 71 | // use D3.js to update the "cx" and "cy" of the specified data above 72 | .attr('cx', (d) => d) 73 | .attr('cy', (d) => d) 74 | .attr('r', 20) 75 | .style('fill', (d) => { 76 | let returnColor; 77 | if (d === 30) { 78 | returnColor = 'green'; 79 | } else if (d === 70) { returnColor = 'purple'; } else if (d === 110) { returnColor = 'red'; } 80 | return returnColor; 81 | }); 82 | 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/pages/basic-shapes/basic-shapes.html: -------------------------------------------------------------------------------- 1 | 2 | D3.js with Ionic 3 | 4 | 5 | 6 | 7 |

Drawing Basic Shapes using JSON data

8 | 9 |

Circles

10 |
11 |
12 | 13 | 35 | 36 |
37 | 38 | 39 |

Rectangles

40 |
41 |
42 | 43 | 66 | 67 |
68 | 69 | 70 |

Ellipses

71 |
72 |
73 | 74 | 97 | 98 |
99 | 100 | 101 |

Lines

102 |
103 |
104 | 105 | 129 | 130 |
131 | 132 | 133 | 134 |
135 | -------------------------------------------------------------------------------- /src/pages/basic-shapes/basic-shapes.scss: -------------------------------------------------------------------------------- 1 | page-basic-shapes { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/pages/basic-shapes/basic-shapes.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | import * as d3 from 'd3-selection'; 4 | 5 | @Component({ 6 | selector: 'page-basic-shapes', 7 | templateUrl: 'basic-shapes.html', 8 | }) 9 | export class BasicShapesPage { 10 | 11 | ionViewDidLoad() { 12 | this.createCircles(); 13 | this.createRectangles(); 14 | this.createEllipses(); 15 | this.createLines(); 16 | } 17 | 18 | createCircles(): void { 19 | 20 | const jsonCircles = [ 21 | { x_axis: 30, y_axis: 30, radius: 20, color : 'green' }, 22 | { x_axis: 70, y_axis: 70, radius: 20, color : 'purple'}, 23 | { x_axis: 110, y_axis: 100, radius: 20, color : 'red'}]; 24 | 25 | const svgContainer = d3.select('#circles').append('svg') 26 | .attr('width', 300) 27 | .attr('height', 200) 28 | .style('border', '1px solid black'); 29 | 30 | const circles = svgContainer.selectAll('circle') 31 | .data(jsonCircles) 32 | .enter() 33 | .append('circle'); 34 | 35 | circles 36 | .attr('cx', (d) => d.x_axis) 37 | .attr('cy', (d) => d.y_axis) 38 | .attr('r', (d) => d.radius) 39 | .style('fill', (d) => d.color); 40 | 41 | } 42 | 43 | createRectangles(): void { 44 | 45 | const jsonRectangles = [ 46 | { x: 0, y: 0, width: 100, height: 80, color : 'green' }, 47 | { x: 110, y: 70, width: 70, height: 50, color : 'purple'}, 48 | { x: 200, y: 100, width: 50, height: 25, color : 'red'}]; 49 | 50 | const svgContainer = d3.select('#rectangles').append('svg') 51 | .attr('width', 300) 52 | .attr('height', 200) 53 | .style('border', '1px solid black'); 54 | 55 | const rectangles = svgContainer.selectAll('rect') 56 | .data(jsonRectangles) 57 | .enter() 58 | .append('rect'); 59 | 60 | rectangles 61 | .attr('x', (d) => d.x) 62 | .attr('y', (d) => d.y) 63 | .attr('width', (d) => d.width) 64 | .attr('height', (d) => d.height) 65 | .style('fill', (d) => d.color); 66 | 67 | } 68 | 69 | createEllipses(): void { 70 | 71 | const jsonEllipses = [ 72 | { cx: 50, cy: 20, rx: 50, ry: 20, color : 'green' }, 73 | { cx: 120, cy: 70, rx: 20, ry: 50, color : 'purple' }, 74 | { cx: 200, cy: 90, rx: 40, ry: 70, color : 'red' }]; 75 | 76 | const svgContainer = d3.select('#ellipses').append('svg') 77 | .attr('width', 300) 78 | .attr('height', 200) 79 | .style('border', '1px solid black'); 80 | 81 | const ellipses = svgContainer.selectAll('ellipse') 82 | .data(jsonEllipses) 83 | .enter() 84 | .append('ellipse'); 85 | 86 | ellipses 87 | .attr('cx', (d) => d.cx) 88 | .attr('cy', (d) => d.cy) 89 | .attr('rx', (d) => d.rx) 90 | .attr('ry', (d) => d.ry) 91 | .style('fill', (d) => d.color); 92 | 93 | } 94 | 95 | createLines(): void { 96 | 97 | const jsonLines = [ 98 | { x1: 0, y1: 0, x2: 100, y2: 90, width: 2, color : 'green' }, 99 | { x1: 150, y1: 10, x2: 150, y2: 90, width: 4, color : 'purple' }, 100 | { x1: 300, y1: 0, x2: 200, y2: 90, width: 6, color : 'red' }]; 101 | 102 | const svgContainer = d3.select('#lines').append('svg') 103 | .attr('width', 300) 104 | .attr('height', 200) 105 | .style('border', '1px solid black'); 106 | 107 | const lines = svgContainer.selectAll('line') 108 | .data(jsonLines) 109 | .enter() 110 | .append('line'); 111 | 112 | lines 113 | .attr('x1', (d) => d.x1) 114 | .attr('y1', (d) => d.y1) 115 | .attr('x2', (d) => d.x2) 116 | .attr('y2', (d) => d.y2) 117 | .attr('stroke-width', (d) => d.width) 118 | .attr('stroke', (d) => d.color); 119 | 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /src/pages/dynamic-svg-coord/dynamic-svg-coord.html: -------------------------------------------------------------------------------- 1 | 2 | D3.js with Ionic 3 | 4 | 5 | 6 | 7 |

Dynamic SVG Coordinate Space

8 | 9 |
10 |

How to make the SVG Coordinate Space scale up and/or down to fit the data?

11 |

Basically we have to change the width and height value of the SVG container to fit the max X and the max Y where the shapes will be drawn.:

12 | 20 | 21 |

What are max.x and max.y ?

22 |

It comes from the getMaxSVG method that does what follows:

23 | 42 | 43 |

Result:

44 |
45 |
46 | 47 | 48 | 49 | 50 |
51 | -------------------------------------------------------------------------------- /src/pages/dynamic-svg-coord/dynamic-svg-coord.scss: -------------------------------------------------------------------------------- 1 | page-dynamic-svg-coord { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/pages/dynamic-svg-coord/dynamic-svg-coord.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | import * as d3 from 'd3-selection'; 4 | 5 | @Component({ 6 | selector: 'page-dynamic-svg-coord', 7 | templateUrl: 'dynamic-svg-coord.html', 8 | }) 9 | export class DynamicSvgCoordPage { 10 | 11 | ionViewDidLoad() { 12 | this.createDynamicSvg(); 13 | } 14 | 15 | createDynamicSvg(): void { 16 | const jsonRectangles = [ 17 | { x: 10, y: 10, height: 20, width: 20, color : 'green' }, 18 | { x: 160, y: 40, height: 20, width: 20, color : 'purple' }, 19 | { x: 70, y: 70, height: 20, width: 20, color : 'red' }]; 20 | 21 | // Loop through the array of JSON objects to get the max x-coordinate and the max y-coordinate 22 | const max = this.getMaxSVG(jsonRectangles, 23 | 'x', 24 | 'y', 25 | 'width', 26 | 'height'); 27 | 28 | const svgContainer = d3.select('#dynamicSvg').append('svg') 29 | // dynamically change the width and height attributes of the SVG Container/Viewport according to the data 30 | .attr('width', max.x) 31 | .attr('height', max.y) 32 | .style('border', '1px solid black'); 33 | 34 | const rectangles = svgContainer.selectAll('rect') 35 | .data(jsonRectangles) 36 | .enter() 37 | .append('rect'); 38 | 39 | rectangles 40 | .attr('x', (d) => d.x) 41 | .attr('y', (d) => d.y) 42 | .attr('width', (d) => d.width) 43 | .attr('height', (d) => d.height) 44 | .style('fill', (d) => d.color); 45 | 46 | } 47 | 48 | /** 49 | * The max x-coordinate and max y-coordinate will be the bottom right hand point of the rectangle 50 | * @param data 51 | * @param {string} xKey the x key property to loop through the data 52 | * @param {string} yKey the y key property to loop through the data 53 | * @param {string} wKey the width key property to loop through the data 54 | * @param {string} hKey the height key property to loop through the data 55 | * @returns {{x: number, y: number}} 56 | */ 57 | getMaxSVG(data: any, xKey: string, yKey: string, wKey: string, hKey: string): { x: number, y: number } { 58 | const max = { 59 | x: 0, 60 | y: 0 61 | }; 62 | data.forEach((item) => { 63 | max.x = Math.max(item[ xKey ] + item[ wKey ], max.x); 64 | max.y = Math.max(item[ yKey ] + item[ hKey ], max.y); 65 | }); 66 | return max; 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/pages/group-element-d3/group-element-d3.html: -------------------------------------------------------------------------------- 1 | 2 | D3.js with Ionic 3 | 4 | 5 | 6 | 7 |

Group Element (D3)

8 | 9 | 10 |

4 SVG basic shape elements with D3.js

11 |
12 |

Add an SVG Group Element to the defined SVG Container then add the shapes into this container.

13 | 44 |
45 |
46 | 47 | 48 | 49 |

Transforming SVG Elements Together with D3.js

50 | 51 | 52 |
53 |

Translate

54 | 57 |
64 |
65 | 66 |

Scale

67 | 71 |
83 |
84 | 85 |

Skew

86 | 90 |
102 |
103 | 104 |

Matrix

105 | 108 |
116 |
117 | 118 |

Rotate

119 | 123 |
135 |
136 |
137 | 138 | 139 | 140 |
141 | -------------------------------------------------------------------------------- /src/pages/group-element-d3/group-element-d3.scss: -------------------------------------------------------------------------------- 1 | page-group-element-d3 { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/pages/group-element-d3/group-element-d3.ts: -------------------------------------------------------------------------------- 1 | import {Component, ElementRef} from '@angular/core'; 2 | import * as d3 from 'd3-selection'; 3 | 4 | @Component({ 5 | selector: 'page-group-element-d3', 6 | templateUrl: 'group-element-d3.html', 7 | }) 8 | export class GroupElementD3Page { 9 | 10 | constructor(private elementRef: ElementRef) {} 11 | 12 | ionViewDidLoad() { 13 | this.elementRef.nativeElement.querySelectorAll('.svg-element').forEach((container) => { 14 | this.createSVG('#' + container.id, JSON.parse(container.getAttribute('data-transformations'))); 15 | }); 16 | } 17 | 18 | createSVG(wrapperId: string, transformations?: [{group: string, properties: string[]}]): void { 19 | const circleData = [ 20 | { cx: 20, cy: 20, radius: 20, color : 'green' }, 21 | { cx: 70, cy: 70, radius: 20, color : 'purple' }]; 22 | 23 | const rectangleData = [ 24 | { rx: 110, ry: 110, height: 30, width: 30, color : 'blue' }, 25 | { rx: 160, ry: 160, height: 30, width: 30, color : 'red' }]; 26 | 27 | const svgContainer = d3.select(wrapperId).append('svg') 28 | .attr('width', 200) 29 | .attr('height', 200); 30 | 31 | // Appending an SVG Group Element to the already defined SVG Container 32 | const circleGroup = svgContainer.append('g'); 33 | const rectangleGroup = svgContainer.append('g'); 34 | 35 | // Add circles to the group container 36 | const circles = circleGroup.selectAll('circle') 37 | .data(circleData) 38 | .enter() 39 | .append('circle'); 40 | 41 | circles 42 | .attr('cx', (d) => d.cx) 43 | .attr('cy', (d) => d.cy) 44 | .attr('r', (d) => d.radius) 45 | .style('fill', (d) => d.color); 46 | 47 | // Add rectangles to the group container 48 | const rectangles = rectangleGroup.selectAll('rect') 49 | .data(rectangleData) 50 | .enter() 51 | .append('rect'); 52 | 53 | rectangles 54 | .attr('x', (d) => d.rx) 55 | .attr('y', (d) => d.ry) 56 | .attr('height', (d) => d.height) 57 | .attr('width', (d) => d.width) 58 | .style('fill', (d) => d.color); 59 | 60 | // Transform the groups 61 | if (transformations) { 62 | transformations.forEach((transformation) => { 63 | let group = null; 64 | switch (transformation.group) { 65 | case 'circles': 66 | group = circleGroup; 67 | break; 68 | case 'rectangles': 69 | group = rectangleGroup; 70 | break; 71 | } 72 | if (group) { 73 | transformation.properties.forEach((property) => { 74 | group.attr('transform', property); 75 | }); 76 | } 77 | }); 78 | } 79 | 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /src/pages/group-element/group-element.html: -------------------------------------------------------------------------------- 1 | 2 | D3.js with Ionic 3 | 4 | 5 | 6 | 7 |

Group Element (SVG)

8 | 9 |

Grouping SVG Elements Together

10 |
11 |

4 SVG basic shape elements

12 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |

The same basic shape elements with groups

29 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 |
52 | 53 | 54 | 55 | 56 |

Transforming SVG Elements Together

57 | 58 |
59 |

Change attributes, here: adding 80 units to the cx attribute of each circles:

60 | 61 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 |
85 | 86 | 87 | 88 |

SVG Transform Attribute

89 | 90 | 91 |
92 |

Translate

93 |

This transform definition specifies a translation by x and y. This is equivalent to matrix(1 0 0 1 x y). If y is not provided, it is assumed to be zero.

94 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 |

Scale

118 |

This transform definition specifies a scale operation by x and y. This is equivalent to matrix(x 0 0 y 0 0). If y is not provided, it is assumed to be equal to x.

119 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 |

Skew : skewX(a), skewY(a)

144 |

This transform definition specifies a skew transformation along the x or y axis by a degrees.

145 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 |

Matrix

169 |

This transform definition specifies a transformation in the form of a transformation matrix of six values.

170 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 |

Rotate

195 |

This transform definition specifies a rotation by a degrees about a given point. If optional parameters x and y are not supplied, the rotate is about the origin of the current user coordinate system

196 |

If optional parameters x and y are supplied, the rotate is about the point (x, y)

197 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 |

Learn more about transform on the MDN Web doc

221 |
222 | 223 | 224 | 225 | 226 |
227 | -------------------------------------------------------------------------------- /src/pages/group-element/group-element.scss: -------------------------------------------------------------------------------- 1 | page-group-element { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/pages/group-element/group-element.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'page-group-element', 5 | templateUrl: 'group-element.html', 6 | }) 7 | export class GroupElementPage {} 8 | -------------------------------------------------------------------------------- /src/pages/home/home.html: -------------------------------------------------------------------------------- 1 | 2 | D3.js with Ionic 3 | 4 | 5 | 6 | 7 |

Welcome Ninja!

8 | 9 |

Presentation

10 | 11 | 12 |
13 | 14 |

Why this app?

15 |

I made this app while learning D3.js. But while I had in mind that my goal was to use it in an Ionic app, I realized there was some differences compared to a classical use. Mainly because of Typescript.

16 |

If you're in this case, you need to install TypeScript type definitions. So syntax may be different than a simple usage of D3.js. 17 | 18 |

Who is this for?

19 |

I propose to share my work to make you save time while learning.

20 |

I think these examples could also be appropriated if you already are in and advanced step of your learning but stuck on some points.

21 | 22 |

What can you find here?

23 |

Most of these examples are based on Dashing D3.js tutorials adapted in Typescript 2 for Ionic 3.

24 |

Source code is available on this github repo.

25 |
26 | 27 |

Context

28 | 29 |
30 |

What is Ionic

31 |

I suppose if you're here you know what Ionic is, probably your favorite framework for building amazing mobile apps :-)

32 |

This is not exactly our subject here but if you are an Ionic developer I suggest you to make the documentation your bible.

33 | 34 |

What is D3.js

35 |

D3 (or D3.js) is a JavaScript library for visualizing data using web standards. D3 helps you bring data to life using SVG, Canvas and HTML

36 |

Learn more about D3.js here. Consider it as a complementary of your bible if you wanna learn data visualization.

37 |
38 | 39 |

Still don't understand anything?

40 |
41 |

I suggest you to be more familiar with the context.

42 |

Otherwise you're maybe not a developer and I'm sorry you're here :-)

43 |
44 | 45 | 46 | 47 | 48 | 49 |
50 | -------------------------------------------------------------------------------- /src/pages/home/home.scss: -------------------------------------------------------------------------------- 1 | page-home { 2 | 3 | button { 4 | align-items: baseline; 5 | } 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/pages/home/home.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | @Component({ 3 | selector: 'page-home', 4 | templateUrl: 'home.html' 5 | }) 6 | export class HomePage { 7 | } 8 | -------------------------------------------------------------------------------- /src/pages/index.ts: -------------------------------------------------------------------------------- 1 | import { HomePage } from '../pages/home/home'; 2 | import { InstallationPage } from './installation/installation'; 3 | import { BasicElementsPage } from '../pages/basic-elements/basic-elements'; 4 | import { BasicShapesPage } from '../pages/basic-shapes/basic-shapes'; 5 | import { PathsSvgPage } from '../pages/paths-svg/paths-svg'; 6 | import { DynamicSvgCoordPage } from '../pages/dynamic-svg-coord/dynamic-svg-coord'; 7 | import { ScalesPage } from '../pages/scales/scales'; 8 | import { GroupElementPage } from './group-element/group-element'; 9 | import { GroupElementD3Page } from './group-element-d3/group-element-d3'; 10 | import { TextElementPage } from './text-element/text-element'; 11 | import { AxesPage } from './axes/axes'; 12 | import { MenuOptionModel } from '../components/side-menu-content/models/menu-option-model'; 13 | 14 | export const PagesList = [ 15 | { component: HomePage, title: 'Home' }, 16 | { component: InstallationPage, title: 'Installation' }, 17 | { component: BasicElementsPage, title: 'Basic SVG Elements' }, 18 | { component: BasicShapesPage, title: 'Basic Shapes' }, 19 | { component: PathsSvgPage, title: 'SVG Paths' }, 20 | { component: DynamicSvgCoordPage, title: 'Dynamic coordinate space' }, 21 | { component: ScalesPage, title: 'Scales' }, 22 | { component: GroupElementPage, title: 'Group Element (SVG Part.)' }, 23 | { component: GroupElementD3Page, title: 'Group Element (D3 Part.)' }, 24 | { component: TextElementPage, title: 'SVG Text Element' }, 25 | { component: AxesPage, title: 'D3.js Axes' }, 26 | ]; 27 | 28 | export const Menu: MenuOptionModel[] = [ 29 | { 30 | displayName: 'Home', 31 | iconName: 'home', 32 | component: HomePage, 33 | selected: true 34 | }, { 35 | displayName: 'Beginners', 36 | subItems: [{ 37 | displayName: 'Installation', 38 | component: InstallationPage, 39 | }, { 40 | displayName: 'Basic SVG Elements', 41 | component: BasicElementsPage, 42 | }, { 43 | displayName: 'Basic Shapes', 44 | component: BasicShapesPage, 45 | }, { 46 | displayName: 'SVG Paths', 47 | component: PathsSvgPage 48 | }, { 49 | displayName: 'Dynamic coordinate space', 50 | component: DynamicSvgCoordPage, 51 | }, { 52 | displayName: 'Scales', 53 | component: ScalesPage, 54 | }, { 55 | displayName: 'Group Element (SVG Part.)', 56 | component: GroupElementPage 57 | }, { 58 | displayName: 'Group Element (D3 Part.)', 59 | component: GroupElementD3Page, 60 | }, { 61 | displayName: 'SVG Text Element', 62 | component: TextElementPage, 63 | }, { 64 | displayName: 'D3.js Axes', 65 | component: AxesPage 66 | }] 67 | } 68 | ]; 69 | 70 | export const Pages = PagesList.map((page) => { 71 | return page.component; 72 | }); 73 | 74 | export const RootPage = HomePage; 75 | -------------------------------------------------------------------------------- /src/pages/installation/installation.html: -------------------------------------------------------------------------------- 1 | 2 | D3.js with Ionic 3 | 4 | 5 | 6 | 7 |

Installation

8 | 9 |

Packages

10 | 11 | 12 |
13 |

You need to install D3 in your console as follows

14 | 15 | 18 | 19 |

Install D3 TypeScript type definitions to take advantage of the autocompletion of D3

20 | 23 |
24 | 25 | 26 |

Use libraries in your code

27 | 28 |
29 |

Depending on which component of D3 you need, you'll import it in your typescript files as follows

30 | 36 |
37 | 38 | 39 | 40 |
41 | -------------------------------------------------------------------------------- /src/pages/installation/installation.scss: -------------------------------------------------------------------------------- 1 | page-installation { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/pages/installation/installation.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | @Component({ 3 | selector: 'page-installation', 4 | templateUrl: 'installation.html', 5 | }) 6 | export class InstallationPage { 7 | } 8 | -------------------------------------------------------------------------------- /src/pages/paths-svg/paths-svg.html: -------------------------------------------------------------------------------- 1 | 2 | D3.js with Ionic 3 | 4 | 5 | 6 | 7 |

SVG Paths

8 | 9 |
10 |

The "curve" method sets the curve factory and returns the line generator. 11 | Instead of just providing the data to the svg container, we provide the generated data by the chosen generator.

12 | 13 | 28 |
29 | 30 |

Allowed factories

31 |
32 |
    33 |
  • d3Shape.curveBasis
  • 34 |
  • d3Shape.curveBasisClosed
  • 35 |
  • d3Shape.curveBasisOpen
  • 36 |
  • d3Shape.curveBundle
  • 37 |
  • d3Shape.curveCardinal
  • 38 |
  • d3Shape.curveCardinalClosed
  • 39 |
  • d3Shape.curveCardinalOpen
  • 40 |
  • d3Shape.curveCatmullRom
  • 41 |
  • d3Shape.curveCatmullRomClosed
  • 42 |
  • d3Shape.curveCatmullRomOpen
  • 43 |
  • d3Shape.curveLinear
  • 44 |
  • d3Shape.curveLinearClosed
  • 45 |
  • d3Shape.curveMonotoneX
  • 46 |
  • d3Shape.curveMonotoneY
  • 47 |
  • d3Shape.curveNatural
  • 48 |
  • d3Shape.curveStep
  • 49 |
  • d3Shape.curveStepAfter
  • 50 |
  • d3Shape.curveStepBefore
  • 51 |
52 |
53 | 54 | 55 |

Examples

56 |
57 | 58 | 59 | Interpolation 60 | 61 | 62 | {{interpolation}} 63 | 64 | 65 | 66 | 67 |
68 |
69 | 70 | 71 | 72 | 73 |
74 | -------------------------------------------------------------------------------- /src/pages/paths-svg/paths-svg.scss: -------------------------------------------------------------------------------- 1 | page-paths-svg { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/pages/paths-svg/paths-svg.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | import * as d3 from 'd3-selection'; 4 | import * as d3Shape from 'd3-shape'; 5 | 6 | @Component({ 7 | selector: 'page-paths-svg', 8 | templateUrl: 'paths-svg.html', 9 | }) 10 | 11 | export class PathsSvgPage { 12 | 13 | interpolations: Array<{ name: string, value: d3Shape.CurveFactory|d3Shape.CurveBundleFactory }> = [ 14 | { name: 'basis', value: d3Shape.curveBasis }, 15 | { name: 'basisClosed', value: d3Shape.curveBasisClosed }, 16 | { name: 'basisOpen', value: d3Shape.curveBasisOpen }, 17 | { name: 'bundle', value: d3Shape.curveBundle }, 18 | { name: 'cardinal', value: d3Shape.curveCardinal }, 19 | { name: 'cardinalClosed', value: d3Shape.curveCardinalClosed }, 20 | { name: 'cardinalOpen', value: d3Shape.curveCardinalOpen }, 21 | { name: 'catmullRom', value: d3Shape.curveCatmullRom }, 22 | { name: 'catmullRomClosed', value: d3Shape.curveCatmullRomClosed }, 23 | { name: 'catmullRomOpen', value: d3Shape.curveCatmullRomOpen }, 24 | { name: 'linear', value: d3Shape.curveLinear }, 25 | { name: 'linearClosed', value: d3Shape.curveLinearClosed }, 26 | { name: 'monotoneX', value: d3Shape.curveMonotoneX }, 27 | { name: 'monotoneY', value: d3Shape.curveMonotoneY }, 28 | { name: 'natural', value: d3Shape.curveNatural }, 29 | { name: 'step', value: d3Shape.curveStep }, 30 | { name: 'stepAfter', value: d3Shape.curveStepAfter }, 31 | { name: 'stepBefore', value: d3Shape.curveStepBefore } 32 | ]; 33 | 34 | interpolationSelected = 'linear'; 35 | 36 | interpolationsSelectList: string[] = this.interpolations.map((interpolation) => interpolation.name); 37 | 38 | ionViewDidLoad() { 39 | this.createSvgPathsLines(); 40 | } 41 | 42 | createSvgPathsLines(): void { 43 | 44 | // Data set 45 | const lineData = [ 46 | { x: 1, y: 90}, { x: 20, y: 20 }, 47 | { x: 40, y: 50}, { x: 60, y: 100 }, 48 | { x: 80, y: 10}, { x: 100, y: 40 }, 49 | { x: 120, y: 30}, { x: 140, y: 80 }, 50 | { x: 160, y: 5}, { x: 180, y: 60 }, 51 | { x: 200, y: 5}, { x: 220, y: 60 }, 52 | { x: 240, y: 90}, { x: 260, y: 120 }]; 53 | 54 | // Clear the previous svg drawn 55 | d3.select('#paths svg').remove(); 56 | 57 | const svgContainer = d3.select('#paths').append('svg') 58 | .attr('width', 300) 59 | .attr('height', 200) 60 | .style('border', '1px solid black'); 61 | 62 | // Generator 63 | const lineGenerator = d3Shape.line() 64 | .x((d) => d.x) 65 | .y((d) => d.y) 66 | .curve(this.interpolations.find((intplt) => intplt.name === this.interpolationSelected).value); 67 | 68 | // Provide the data to the path container 69 | svgContainer.append('path') 70 | .attr('d', lineGenerator(lineData)) 71 | .attr('stroke', 'green') 72 | .attr('stroke-width', 2) 73 | .attr('fill', 'yellow'); 74 | 75 | // Add the name of the interpolation to the svg as a text element 76 | svgContainer.append('text') 77 | .attr('x', 20) 78 | .attr('y', parseInt(svgContainer.attr('height'), 10) - 20) 79 | .text(this.interpolationSelected); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/pages/scales/scales.html: -------------------------------------------------------------------------------- 1 | 2 | D3.js with Ionic 3 | 4 | Scales 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

Scales

13 | 14 |
15 |

Resize the data to fit into the pre-defined SVG Coordinate Space

16 |

In this section we need to import d3-scale and d3-array:

17 | 21 |
22 | 23 | 24 | 25 |

Linear Scale Example

26 |
27 | 40 |
41 | 42 | 43 |
44 | 45 |

Initial Data

46 |

{{initialDataToScale.join(' | ')}}

47 | 48 |

Scaled Data

49 |

{{scaledData.join(' | ')}}

50 | 51 |
52 | 53 | 54 |

Other interpolators available

55 |
56 |
    57 |
  • scaleBand
  • 58 |
  • scaleIdentity
  • 59 |
  • scaleLinear
  • 60 |
  • scaleLog
  • 61 |
  • scaleOrdinal
  • 62 |
  • scalePoint
  • 63 |
  • scalePow
  • 64 |
  • scaleQuantile
  • 65 |
  • scaleQuantize
  • 66 |
  • scaleSequential
  • 67 |
  • scaleSqrt
  • 68 |
  • scaleThreshold
  • 69 |
  • scaleTime
  • 70 |
  • scaleUtc
  • 71 |
72 |
73 | 74 | 75 | 76 | 77 |
78 | -------------------------------------------------------------------------------- /src/pages/scales/scales.scss: -------------------------------------------------------------------------------- 1 | page-scales { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/pages/scales/scales.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | import * as d3Scale from 'd3-scale'; 4 | import * as d3Array from 'd3-array'; 5 | import {NavController, NavParams} from 'ionic-angular'; 6 | 7 | @Component({ 8 | selector: 'page-scales', 9 | templateUrl: 'scales.html', 10 | }) 11 | export class ScalesPage { 12 | 13 | initialDataToScale: number[]; 14 | scaledData: number[] = []; 15 | 16 | isPushed = false; 17 | 18 | constructor(public navCtrl: NavController, public navParams: NavParams) { 19 | this.isPushed = this.navParams.get('isPushed') || false; 20 | } 21 | 22 | ionViewDidLoad() { 23 | 24 | this.createScales(); 25 | 26 | } 27 | 28 | createScales(): void { 29 | 30 | this.initialDataToScale = [ 0, 1000, 3000, 2000, 5000, 4000, 7000, 6000, 9000, 8000, 10000 ]; 31 | 32 | const linearScale = d3Scale 33 | // Constructs a new continuous linear scale with 34 | // the unit domain [0, 1], the unit range [0, 1], 35 | // the default interpolator and clamping disabled 36 | .scaleLinear() 37 | // Sets the scale’s domain to the specified array of numbers. 38 | .domain([ 39 | d3Array.min(this.initialDataToScale), 40 | d3Array.max(this.initialDataToScale) 41 | ]) 42 | // Sets the scale’s range to the specified array of values 43 | .range([ 0, 100 ]); 44 | 45 | this.scaledData = this.initialDataToScale.map((data) => linearScale(data)); 46 | 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/pages/text-element/text-element.html: -------------------------------------------------------------------------------- 1 | 2 | D3.js with Ionic 3 | 4 | 5 | 6 | 7 |

SVG Text Element

8 | 9 |

Text Label in an existing SVG Element

10 |
11 |

The simple Text element

12 | 20 | 21 | 22 | 23 | 24 | Hello! 25 | Hello! 26 | 27 | 28 |

Text-anchor attribute

29 | 33 | 34 | 35 | 36 | 37 | Hello! 38 | Hello! 39 | 40 |
41 | 42 |

SVG Text Element and D3.js

43 |
44 | 60 |
61 |
62 | 63 | 64 | 65 | 66 |
67 | -------------------------------------------------------------------------------- /src/pages/text-element/text-element.scss: -------------------------------------------------------------------------------- 1 | page-text-element { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/pages/text-element/text-element.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { NavController, NavParams } from 'ionic-angular'; 3 | import * as d3 from 'd3-selection'; 4 | 5 | @Component({ 6 | selector: 'page-text-element', 7 | templateUrl: 'text-element.html', 8 | }) 9 | export class TextElementPage { 10 | 11 | constructor(public navCtrl: NavController, public navParams: NavParams) { 12 | } 13 | 14 | ionViewDidLoad() { 15 | this.createSVG(); 16 | } 17 | 18 | createSVG(): void { 19 | 20 | // Data Set 21 | const circleData = [ 22 | { cx: 20, cy: 20, radius: 20, color : 'green' }, 23 | { cx: 70, cy: 70, radius: 20, color : 'purple' }]; 24 | 25 | // SVG Viewport 26 | const svgContainer = d3.select('#svg-text').append('svg') 27 | .attr('width', 200) 28 | .attr('height', 200); 29 | 30 | // Add circles to the svgContainer 31 | const circles = svgContainer.selectAll('circle') 32 | .data(circleData) 33 | .enter() 34 | .append('circle'); 35 | 36 | // Add the circle attributes 37 | circles 38 | .attr('cx', (d) => d.cx) 39 | .attr('cy', (d) => d.cy) 40 | .attr('r', (d) => d.radius) 41 | .style('fill', (d) => d.color); 42 | 43 | // Add the SVG Text Element to the svgContainer 44 | const text = svgContainer.selectAll('text') 45 | .data(circleData) 46 | .enter() 47 | .append('text'); 48 | 49 | // Add the text attributes 50 | text 51 | .attr('x', (d) => d.cx) 52 | .attr('y', (d) => d.cy) 53 | .text((d) => '( ' + d.cx + ', ' + d.cy + ' )') 54 | .attr('font-family', 'sans-serif') 55 | .attr('font-size', '20px') 56 | .attr('fill', 'red'); 57 | 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/service-worker.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Check out https://googlechromelabs.github.io/sw-toolbox/ for 3 | * more info on how to use sw-toolbox to custom configure your service worker. 4 | */ 5 | 6 | 7 | 'use strict'; 8 | importScripts('./build/sw-toolbox.js'); 9 | 10 | self.toolbox.options.cache = { 11 | name: 'ionic-cache' 12 | }; 13 | 14 | // pre-cache our key assets 15 | self.toolbox.precache( 16 | [ 17 | './build/main.js', 18 | './build/vendor.js', 19 | './build/main.css', 20 | './build/polyfills.js', 21 | 'index.html', 22 | 'manifest.json' 23 | ] 24 | ); 25 | 26 | // dynamically cache any other local assets 27 | self.toolbox.router.any('/*', self.toolbox.fastest); 28 | 29 | // for any other requests go to the network, cache, 30 | // and then only use that cached resource if your user goes offline 31 | self.toolbox.router.default = self.toolbox.networkFirst; 32 | -------------------------------------------------------------------------------- /src/theme/variables.scss: -------------------------------------------------------------------------------- 1 | // Ionic Variables and Theming. For more info, please see: 2 | // http://ionicframework.com/docs/theming/ 3 | 4 | // Font path is used to include ionicons, 5 | // roboto, and noto sans fonts 6 | $font-path: "../assets/fonts"; 7 | 8 | 9 | // The app direction is used to include 10 | // rtl styles in your app. For more info, please see: 11 | // http://ionicframework.com/docs/theming/rtl-support/ 12 | $app-direction: ltr; 13 | 14 | 15 | @import "ionic.globals"; 16 | 17 | 18 | // Shared Variables 19 | // -------------------------------------------------- 20 | // To customize the look and feel of this app, you can override 21 | // the Sass variables found in Ionic's source scss files. 22 | // To view all the possible Ionic variables, see: 23 | // http://ionicframework.com/docs/theming/overriding-ionic-variables/ 24 | 25 | 26 | 27 | // Named Color Variables 28 | // -------------------------------------------------- 29 | // Named colors makes it easy to reuse colors on various components. 30 | // It's highly recommended to change the default colors 31 | // to match your app's branding. Ionic uses a Sass map of 32 | // colors so you can add, rename and remove colors as needed. 33 | // The "primary" color is the only required color in the map. 34 | 35 | //$colors: ( 36 | // primary: #488aff, 37 | // secondary: #32db64, 38 | // danger: #f53d3d, 39 | // light: #f4f4f4, 40 | // dark: #222 41 | //); 42 | $colors: ( 43 | primary: #132757, 44 | secondary: #6AC2E8, 45 | danger: #f53d3d, 46 | light: #ECEEFF, 47 | dark: #001909, 48 | white: #FFFFFF 49 | ); 50 | 51 | 52 | 53 | // Theme Variables 54 | // -------------------------------------------------- 55 | // 56 | 57 | // 58 | // 59 | $text-color: color($colors, primary); 60 | $link-color: color($colors, dark); 61 | //$background-color: #fff; 62 | //$subdued-text-color: #666; 63 | // 64 | $font-family-base: 'Barlow', sans-serif; 65 | //$font-size-base: 1.4rem; // 1.4rem == 14px 66 | // 67 | //$content-padding: 16px; 68 | //$content-margin: 16px; 69 | $heading-padding: 8px; 70 | // 71 | $toolbar-background: color($colors, light); 72 | //$toolbar-border-color: color($colors, dark); 73 | //$toolbar-text-color: color($colors, dark); 74 | //$toolbar-active-color: $link-color; 75 | //$toolbar-inactive-color: #8c8c8c; 76 | // 77 | //$tabs-background: #f8f8f8; 78 | //$tabs-border-color: #b2b2b2; 79 | //$tabs-tab-color-inactive: #8c8c8c; 80 | //$tabs-tab-color-active: $link-color; 81 | // 82 | //$list-text-color: $text-color; 83 | //$list-background-color: $background-color; 84 | //$list-border-color: #c8c7cc; 85 | 86 | 87 | $button-background: color($colors, secondary); 88 | 89 | 90 | // App Typography 91 | // -------------------------------------------------- 92 | $h1-font-size: 2.8rem; 93 | $h2-font-size: 2.4rem; 94 | $h3-font-size: 1.6rem; 95 | $h4-font-size: 1.6rem; 96 | $h5-font-size: 1.2rem; 97 | $h6-font-size: 1.2rem; 98 | 99 | 100 | // App iOS Variables 101 | // -------------------------------------------------- 102 | // iOS only Sass variables can go here 103 | $button-ios-background-color: $button-background; 104 | 105 | 106 | 107 | // App Material Design Variables 108 | // -------------------------------------------------- 109 | // Material Design only Sass variables can go here 110 | 111 | $button-md-background-color: $button-background; 112 | 113 | 114 | // App Windows Variables 115 | // -------------------------------------------------- 116 | // Windows only Sass variables can go here 117 | 118 | $button-wp-background-color: $button-background; 119 | 120 | 121 | // App Theme 122 | // -------------------------------------------------- 123 | // Ionic apps can have different themes applied, which can 124 | // then be future customized. This import comes last 125 | // so that the above variables are used and Ionic's 126 | // default are overridden. 127 | 128 | @import "ionic.theme.default"; 129 | 130 | 131 | // Ionicons 132 | // -------------------------------------------------- 133 | // The premium icon font for Ionic. For more info, please see: 134 | // http://ionicframework.com/docs/ionicons/ 135 | 136 | @import "ionic.ionicons"; 137 | 138 | 139 | // Fonts 140 | // -------------------------------------------------- 141 | 142 | @import "roboto"; 143 | @import "noto-sans"; 144 | @import "../assets/fonts/index"; 145 | 146 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "allowSyntheticDefaultImports": true, 4 | "declaration": false, 5 | "emitDecoratorMetadata": true, 6 | "experimentalDecorators": true, 7 | "lib": [ 8 | "dom", 9 | "es2015" 10 | ], 11 | "module": "es2015", 12 | "moduleResolution": "node", 13 | "sourceMap": true, 14 | "target": "es5" 15 | }, 16 | "include": [ 17 | "src/**/*.ts" 18 | ], 19 | "exclude": [ 20 | "node_modules" 21 | ], 22 | "compileOnSave": false, 23 | "atom": { 24 | "rewriteTsconfig": false 25 | }, 26 | "typedocOptions": { 27 | "out": "documentation", 28 | "theme": "minimal", 29 | "name": "D3.js Ionic", 30 | "hideGenerator": "true", 31 | "readme": "README.MD", 32 | "mode": "file", 33 | "ignoreCompilerErrors": "true", 34 | "experimentalDecorators": "true", 35 | "emitDecoratorMetadata": "true", 36 | "target": "ES5", 37 | "moduleResolution": "node", 38 | "preserveConstEnums": "true", 39 | "stripInternal": "true", 40 | "suppressExcessPropertyErrors": "true", 41 | "suppressImplicitAnyIndexErrors": "true", 42 | "module": "commonjs" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /tslint-codeclimate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint:latest", 3 | "rules": { 4 | "indent": [true, "spaces"], 5 | "quotemark": [true, "single"], 6 | "object-literal-sort-keys": false, 7 | "trailing-comma": false, 8 | "class-name": true, 9 | "semicolon": [true, "always"], 10 | "triple-equals": [true, "allow-null-check"], 11 | "eofline": true, 12 | "jsdoc-format": true, 13 | "member-access": false, 14 | "no-console": false, 15 | "whitespace": [true, 16 | "check-decl", 17 | "check-operator", 18 | "check-separator", 19 | "check-type" 20 | ], 21 | "variable-name": [ 22 | "allow-leading-underscore" 23 | ], 24 | "curly": false, 25 | "no-reference": false, 26 | "no-var-requires": false, 27 | "ordered-imports": false, 28 | "no-trailing-whitespace": false 29 | }, 30 | "rulesDirectory": [] 31 | } 32 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint-ionic-rules" 3 | } 4 | --------------------------------------------------------------------------------