123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889 |
- <!doctype html>
- <html class="no-js" lang="">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="x-ua-compatible" content="ie=edge">
- <title>app-angular documentation</title>
- <meta name="description" content="">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="icon" type="image/x-icon" href="../images/favicon.ico">
- <link rel="stylesheet" href="../styles/style.css">
- </head>
- <body>
- <div class="navbar navbar-default navbar-fixed-top visible-xs">
- <a href="../" class="navbar-brand">app-angular documentation</a>
- <button type="button" class="btn btn-default btn-menu fa fa-bars" id="btn-menu"></button>
- </div>
- <div class="xs-menu menu" id="mobile-menu">
- <div id="book-search-input" role="search">
- <input type="text" placeholder="Type to search">
- </div>
- <nav>
-
- <ul class="list">
-
- <li class="title">
- <a href="../">app-angular documentation</a>
- </li>
-
- <li class="divider"></li>
-
-
- <li class="chapter">
- <a data-type="chapter-link" href="../"><span class="fa fa-home"></span>Getting started</a>
- <ul class="links">
- <li class="link">
- <a href="../" ><span class="fa fa-file-text-o"></span>README</a>
- </li>
- <li class="link">
- <a
-
- href="../overview.html"
- href="../overview.html"
- >
- <span class="fa fa-th"></span>Overview
- </a>
- </li>
- </ul>
- </li>
-
- <li class="chapter">
- <a data-type="chapter-link" href="./modules.html" >
- <span class="fa fa-archive"></span>
- <span>Modules</span>
- <span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
- data-target="#xs-modules-links"
- ></span>
- </a>
- <ul class="links collapse in"
- id="xs-modules-links"
- >
- <li class="link">
- <a href="../modules/AppModule.html" >AppModule</a>
- </li>
- <li class="link">
- <a href="../modules/LessonModule.html" >LessonModule</a>
- </li>
- </ul>
- </li>
-
- <li class="chapter">
- <div class="simple">
- <span class="fa fa-cogs"></span>
- <span>Components</span>
- <span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
- data-target="#xs-components-links"
- ></span>
- </div>
- <ul class="links collapse in"
- id="xs-components-links"
- >
- <li class="link">
- <a href="../components/AppComponent.html" >AppComponent</a>
- </li>
- <li class="link">
- <a href="../components/BblComponent.html" >BblComponent</a>
- </li>
- <li class="link">
- <a href="../components/DetailComponent.html" >DetailComponent</a>
- </li>
- <li class="link">
- <a href="../components/EcharsComponent.html" >EcharsComponent</a>
- </li>
- <li class="link">
- <a href="../components/EchartsExempleComponent.html" class="active" >EchartsExempleComponent</a>
- </li>
- <li class="link">
- <a href="../components/EditComponent.html" >EditComponent</a>
- </li>
- <li class="link">
- <a href="../components/FlowfatherComponent.html" >FlowfatherComponent</a>
- </li>
- <li class="link">
- <a href="../components/FlowtestComponent.html" >FlowtestComponent</a>
- </li>
- <li class="link">
- <a href="../components/HomeComponent.html" >HomeComponent</a>
- </li>
- <li class="link">
- <a href="../components/NavTabsComponent.html" >NavTabsComponent</a>
- </li>
- <li class="link">
- <a href="../components/PageMineComponent.html" >PageMineComponent</a>
- </li>
- <li class="link">
- <a href="../components/PageSpotDetailComponent.html" >PageSpotDetailComponent</a>
- </li>
- </ul>
- </li>
-
-
- <li class="chapter">
- <div class="simple">
- <span class="fa fa-file-code-o"></span>
- <span>Classes</span>
- <span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
- data-target="#xs-classes-links"
- ></span>
- </div>
- <ul class="links collapse in"
- id="xs-classes-links"
- >
- <li class="link">
- <a href="../classes/TestChatCompletion.html" >TestChatCompletion</a>
- </li>
- </ul>
- </li>
-
-
- <li class="chapter">
- <div class="simple">
- <span class="fa fa-long-arrow-down"></span>
- <span>Injectables</span>
- <span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
- data-target="#xs-injectables-links"
- ></span>
- </div>
- <ul class="links collapse in"
- id="xs-injectables-links"
- >
- <li class="link">
- <a href="../injectables/DataServiceService.html" >DataServiceService</a>
- </li>
- </ul>
- </li>
-
- <li class="chapter">
- <div class="simple">
- <span class="fa fa-info"></span>
- <span>Interfaces</span>
- <span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
- data-target="#xs-interfaces-links"
- ></span>
- </div>
- <ul class="links collapse in"
- id="xs-interfaces-links"
- >
- <li class="link">
- <a href="../interfaces/TestChatMessage.html" >TestChatMessage</a>
- </li>
- </ul>
- </li>
-
- <li class="chapter">
- <div class="simple">
- <span class="fa fa-plus"></span>
- <span>Pipes</span>
- <span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
- data-target="#xs-pipes-links"
- ></span>
- </div>
- <ul class="links collapse in"
- id="xs-pipes-links"
- >
- <li class="link">
- <a href="../pipes/TokPipe.html" >TokPipe</a>
- </li>
- </ul>
- </li>
-
-
- <li class="chapter">
- <a data-type="chapter-link" href="../coverage.html" ><span class="fa fa-tasks"></span>Documentation coverage</a>
- </li>
-
- <li class="divider"></li>
- <li class="copyright">
- Documentation generated using <a href="https://compodoc.github.io/compodoc/" target="_blank">
- <img src="..//images/compodoc-vectorise.svg" class="img-responsive">
- </a>
- </li>
-
- </ul>
-
- </nav>
- </div>
- <div class="container-fluid main">
- <div class="row main">
- <div class="hidden-xs menu">
- <nav>
-
- <ul class="list">
-
- <li class="title">
- <a href="../">app-angular documentation</a>
- </li>
-
- <li class="divider"></li>
-
- <div id="book-search-input" role="search">
- <input type="text" placeholder="Type to search">
- </div>
-
- <li class="chapter">
- <a data-type="chapter-link" href="../"><span class="fa fa-home"></span>Getting started</a>
- <ul class="links">
- <li class="link">
- <a href="../" ><span class="fa fa-file-text-o"></span>README</a>
- </li>
- <li class="link">
- <a
-
- href="../overview.html"
- href="../overview.html"
- >
- <span class="fa fa-th"></span>Overview
- </a>
- </li>
- </ul>
- </li>
-
- <li class="chapter">
- <a data-type="chapter-link" href="./modules.html" >
- <span class="fa fa-archive"></span>
- <span>Modules</span>
- <span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
- data-target="#modules-links"
- ></span>
- </a>
- <ul class="links collapse in"
- id="modules-links"
- >
- <li class="link">
- <a href="../modules/AppModule.html" >AppModule</a>
- </li>
- <li class="link">
- <a href="../modules/LessonModule.html" >LessonModule</a>
- </li>
- </ul>
- </li>
-
- <li class="chapter">
- <div class="simple">
- <span class="fa fa-cogs"></span>
- <span>Components</span>
- <span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
- data-target="#components-links"
- ></span>
- </div>
- <ul class="links collapse in"
- id="components-links"
- >
- <li class="link">
- <a href="../components/AppComponent.html" >AppComponent</a>
- </li>
- <li class="link">
- <a href="../components/BblComponent.html" >BblComponent</a>
- </li>
- <li class="link">
- <a href="../components/DetailComponent.html" >DetailComponent</a>
- </li>
- <li class="link">
- <a href="../components/EcharsComponent.html" >EcharsComponent</a>
- </li>
- <li class="link">
- <a href="../components/EchartsExempleComponent.html" class="active" >EchartsExempleComponent</a>
- </li>
- <li class="link">
- <a href="../components/EditComponent.html" >EditComponent</a>
- </li>
- <li class="link">
- <a href="../components/FlowfatherComponent.html" >FlowfatherComponent</a>
- </li>
- <li class="link">
- <a href="../components/FlowtestComponent.html" >FlowtestComponent</a>
- </li>
- <li class="link">
- <a href="../components/HomeComponent.html" >HomeComponent</a>
- </li>
- <li class="link">
- <a href="../components/NavTabsComponent.html" >NavTabsComponent</a>
- </li>
- <li class="link">
- <a href="../components/PageMineComponent.html" >PageMineComponent</a>
- </li>
- <li class="link">
- <a href="../components/PageSpotDetailComponent.html" >PageSpotDetailComponent</a>
- </li>
- </ul>
- </li>
-
-
- <li class="chapter">
- <div class="simple">
- <span class="fa fa-file-code-o"></span>
- <span>Classes</span>
- <span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
- data-target="#classes-links"
- ></span>
- </div>
- <ul class="links collapse in"
- id="classes-links"
- >
- <li class="link">
- <a href="../classes/TestChatCompletion.html" >TestChatCompletion</a>
- </li>
- </ul>
- </li>
-
-
- <li class="chapter">
- <div class="simple">
- <span class="fa fa-long-arrow-down"></span>
- <span>Injectables</span>
- <span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
- data-target="#injectables-links"
- ></span>
- </div>
- <ul class="links collapse in"
- id="injectables-links"
- >
- <li class="link">
- <a href="../injectables/DataServiceService.html" >DataServiceService</a>
- </li>
- </ul>
- </li>
-
- <li class="chapter">
- <div class="simple">
- <span class="fa fa-info"></span>
- <span>Interfaces</span>
- <span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
- data-target="#interfaces-links"
- ></span>
- </div>
- <ul class="links collapse in"
- id="interfaces-links"
- >
- <li class="link">
- <a href="../interfaces/TestChatMessage.html" >TestChatMessage</a>
- </li>
- </ul>
- </li>
-
- <li class="chapter">
- <div class="simple">
- <span class="fa fa-plus"></span>
- <span>Pipes</span>
- <span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
- data-target="#pipes-links"
- ></span>
- </div>
- <ul class="links collapse in"
- id="pipes-links"
- >
- <li class="link">
- <a href="../pipes/TokPipe.html" >TokPipe</a>
- </li>
- </ul>
- </li>
-
-
- <li class="chapter">
- <a data-type="chapter-link" href="../coverage.html" ><span class="fa fa-tasks"></span>Documentation coverage</a>
- </li>
-
- <li class="divider"></li>
- <li class="copyright">
- Documentation generated using <a href="https://compodoc.github.io/compodoc/" target="_blank">
- <img src="..//images/compodoc-vectorise.svg" class="img-responsive">
- </a>
- </li>
-
- </ul>
-
- </nav>
- </div>
- <div class="content component">
- <div class="content-data">
- <ol class="breadcrumb">
- <li>Components</li>
- <li>EchartsExempleComponent</li>
- </ol>
- <ul class="nav nav-tabs" role="tablist">
- <li class="active">
- <a href="#infos" id="infos-tab" role="tab" data-toggle="tab">Infos</a>
- </li>
- <li>
- <a href="#source" role="tab" id="source-tab" data-toggle="tab">Source</a>
- </li>
- </ul>
- <div class="tab-content">
- <div class="tab-pane fade active in" id="infos"><p class="comment">
- <h3>File</h3>
- </p>
- <p class="comment">
- <code>src/modules/lesson/echarts-exemple/echarts-exemple.component.ts</code>
- </p>
- <section>
- <h3>Metadata</h3>
- <table class="table table-sm table-hover">
- <tbody>
- <tr>
- <td class="col-md-3">selector</td>
- <td class="col-md-9"><code>app-echarts-exemple</code></td>
- </tr>
- <tr>
- <td class="col-md-3">styleUrls</td>
- <td class="col-md-9"><code>echarts-exemple.component.scss</code></td>
- </tr>
- <tr>
- <td class="col-md-3">templateUrl</td>
- <td class="col-md-9"><code>echarts-exemple.component.html</code></td>
- </tr>
- </tbody>
- </table>
- </section>
- <section>
- <h3 id="methods">Methods</h3>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b><span class="modifier"></span> getWeightData</b>
- </td>
- </tr>
-
- <tr>
- <td class="col-md-4">
- <span class="modifier-icon method fa fa-play ">
- <span class="fa fa-"></span>
- </span>
- <code>getWeightData()</code>
- </td>
- </tr>
-
- <tr>
- <td class="col-md-4">
- <div class="io-description">
- <b>Returns: </b> <code>any</code>
-
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b><span class="modifier"></span> getHeightData</b>
- </td>
- </tr>
-
- <tr>
- <td class="col-md-4">
- <span class="modifier-icon method fa fa-play ">
- <span class="fa fa-"></span>
- </span>
- <code>getHeightData()</code>
- </td>
- </tr>
-
- <tr>
- <td class="col-md-4">
- <div class="io-description">
- <b>Returns: </b> <code>any</code>
-
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b><span class="modifier"></span> getDate</b>
- </td>
- </tr>
-
- <tr>
- <td class="col-md-4">
- <span class="modifier-icon method fa fa-play ">
- <span class="fa fa-"></span>
- </span>
- <code>getDate()</code>
- </td>
- </tr>
-
- <tr>
- <td class="col-md-4">
- <div class="io-description">
- <b>Returns: </b> <code>any</code>
-
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b><span class="modifier"></span> calculateBMI</b>
- </td>
- </tr>
-
- <tr>
- <td class="col-md-4">
- <span class="modifier-icon method fa fa-play ">
- <span class="fa fa-"></span>
- </span>
- <code>calculateBMI()</code>
- </td>
- </tr>
-
- <tr>
- <td class="col-md-4">
- <div class="io-description">
- <b>Returns: </b> <code>any</code>
-
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </section>
- <section>
- <h3 id="inputs">Properties</h3>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b> BMI</b>
- </td>
- </tr>
- <tr>
- <td class="col-md-4">
- <code>BMI: <code>any</code>
- </bcode>
- </td>
- </tr>
- </tbody>
- </table>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b> date</b>
- </td>
- </tr>
- <tr>
- <td class="col-md-4">
- <code>date: <code>any</code>
- </bcode>
- </td>
- </tr>
- </tbody>
- </table>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b> heightData</b>
- </td>
- </tr>
- <tr>
- <td class="col-md-4">
- <code>heightData: <code>any</code>
- </bcode>
- </td>
- </tr>
- </tbody>
- </table>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b> weightData</b>
- </td>
- </tr>
- <tr>
- <td class="col-md-4">
- <code>weightData: <code>any</code>
- </bcode>
- </td>
- </tr>
- </tbody>
- </table>
- </section>
- </div>
- <div class="tab-pane fade tab-source-code" id="source">
- <pre><code class="hljs javascript">import * as echarts from 'echarts';
- import { AfterViewInit, Component } from '@angular/core';
- import * as Parse from "parse"
- (Parse as any).serverURL = "http://metapunk.cn:9999/parse"
- Parse.initialize("dev")
- @Component({
- selector: 'app-echarts-exemple',
- templateUrl: './echarts-exemple.component.html',
- styleUrls: ['./echarts-exemple.component.scss']
- })
- export class EchartsExempleComponent implements AfterViewInit {
- date: Promise<string[] | null> = this.getDate();
- heightData: Promise<number[] | null> = this.getHeightData();
- weightData: Promise<number[] | null> = this.getWeightData();
- BMI: Promise<number[] | null> = this.calculateBMI();
- // 组件初始化
- async ngAfterViewInit() {
- //第一个echarts表
- var chartDom = document.getElementById('main');
- var myChart = echarts.init(chartDom);
- var option;
- option = {
- title: {
- text: '身体数据'
- },
- tooltip: {
- trigger: 'axis'
- },
- legend: {
- data: ['身高', '体重',]
- },
- // grid: {
- // left: '3%',
- // right: '4%',
- // bottom: '3%',
- // containLabel: true
- // },
- toolbox: {
- feature: {
- saveAsImage: {}
- }
- },
- xAxis: {
- type: 'category',
- boundaryGap: false,
- data: await this.date
- },
- yAxis: {
- type: 'value',
- min: 0,
- max: 250,
- },
- series: [
- {
- name: '身高',
- type: 'line',
- data: await this.heightData
- },
- {
- name: '体重',
- type: 'line',
- data: await this.weightData
- },
- ]
- };
- option && myChart.setOption(option);
- //第二个echarts表
- var chartDom = document.getElementById('main1');
- var myChart = echarts.init(chartDom);
- var option;
- option = {
- toolbox: {
- feature: {
- saveAsImage: {}
- }
- },
- title: {
- text: 'BMI'
- },
- tooltip: {
- trigger: 'axis'
- },
- xAxis: {
- type: 'category',
- boundaryGap: false,
- data: await this.date,
- },
- yAxis: {
- type: 'value'
- },
- series: [
- {
- data: await this.BMI,
- type: 'line',
- smooth: true,
- markLine: {
- data: [
- { type: 'max', name: '最大值', yAxis: 24.9 },
- { type: 'min', name: '最小值', yAxis: 18.5 }
- ]
- }
- }
- ]
- };
- option && myChart.setOption(option);
- }
- async getWeightData(): Promise<number[] | null> {
- const Upload = Parse.Object.extend("HealthData");
- const query = new Parse.Query(Upload);
- try {
- const result = await query.find();
- if (result.length > 0) {
- const weightDatas = result.map((result) => result.get("weight"));
- console.log("体重数组", weightDatas);
- return weightDatas;
- } else {
- return null;
- }
- } catch (error) {
- console.error("Error:", error);
- return null;
- }
- }
- async getHeightData(): Promise<number[] | null> {
- const Upload = Parse.Object.extend("HealthData");
- const query = new Parse.Query(Upload);
- try {
- const result = await query.find();
- if (result.length > 0) {
- const heightDatas = result.map((result) => result.get("height"));
- console.log("身高数组", heightDatas);
- return heightDatas;
- } else {
- return null;
- }
- } catch (error) {
- console.error("Error:", error);
- return null;
- }
- }
- async getDate(): Promise<string[] | null> {
- const Upload = Parse.Object.extend("HealthData");
- const query = new Parse.Query(Upload);
- query.descending("createdAt");
- try {
- const result = await query.find();
- if (result.length > 0) {
- const Dates = result.map((result) => {
- const date = result.get("createdAt");
- return date.toISOString().split('T')[0];
- }).reverse();
- console.log("日期数组", Dates);
- return Dates;
- } else {
- return null;
- }
- } catch (error) {
- console.error("Error:", error);
- return null;
- }
- }
- async calculateBMI(): Promise<number[] | null> {
- try {
- const heightData: number[] | null = await this.getHeightData();
- const weightData: number[] | null = await this.getWeightData();
- if (heightData === null || weightData === null) {
- return null;
- }
- const bmiData: number[] = [];
- for (let i = 0; i < heightData.length; i++) {
- const heightInMeter: number = heightData[i] / 100; // 将厘米转换为米
- const bmi: number = weightData[i] / (heightInMeter * heightInMeter);
- bmiData.push(bmi);
- }
- console.log(bmiData);
- return bmiData;
- } catch (error) {
- console.error('Error calculating BMI:', error);
- return null;
- }
- }
- }</code></pre>
- </div>
- </div>
- </div><div class="search-results">
- <div class="has-results">
- <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
- <ul class="search-results-list"></ul>
- </div>
- <div class="no-results">
- <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
- </div>
- </div>
- </div>
- </div>
- </div>
- <script src="../js/libs/bootstrap-native.js"></script>
- <script src="../js/libs/es6-shim.min.js"></script>
- <script src="../js/libs/EventDispatcher.js"></script>
- <script src="../js/libs/promise.min.js"></script>
- <script src="../js/libs/zepto.min.js"></script>
- <script src="../js/compodoc.js"></script>
- <script src="../js/search/search.js"></script>
- <script src="../js/search/lunr.min.js"></script>
- <script src="../js/search/search-lunr.js"></script>
- <script src="../js/menu.js"></script>
- <script src="../js/libs/highlight.pack.js"></script>
- <script src="../js/libs/highlightjs-line-numbers.min.js"></script>
- <script src="../js/search/search_index.js"></script>
- <script>
- document.addEventListener('DOMContentLoaded', function() {
- hljs.initHighlightingOnLoad();
- hljs.initLineNumbersOnLoad();
- });
- </script>
- </body>
- </html>
|