當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript js.getWuXing方法代碼示例

本文整理匯總了TypeScript中iching.js.getWuXing方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript js.getWuXing方法的具體用法?TypeScript js.getWuXing怎麽用?TypeScript js.getWuXing使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在iching.js的用法示例。


在下文中一共展示了js.getWuXing方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: updateChanges

  updateChanges() {
    if (this.calendar && this.birthday && this.birthtime) {
      var lunarInfo;
      var dateArray = this.birthday.split('-');
      if (this.calendar == 'solar') {
        lunarInfo = lunarCalendar.solarToLunar(dateArray[0], dateArray[1], dateArray[2]);
      } else {
        var solarInfo = lunarCalendar.lunarToSolar(dateArray[0], dateArray[1], dateArray[2]);
        lunarInfo = lunarCalendar.solarToLunar(solarInfo.year, solarInfo.month, solarInfo.day);
      }
      var upper_yao = iching.getXianTianBaGua(Math.round(lunarInfo.lunarDay));
      var lower_yao = iching.getXianTianBaGua(lunarInfo.lunarMonth);
      var hexagram = iching.trigram2hexagram(upper_yao, lower_yao);
      var gong = iching.getGongName(hexagram);
      var name = iching.getHexagramName(hexagram);
      var wuxing = iching.getWuXing(gong);
      var sizhu = lunarInfo.GanZhiYear + '年 ' + lunarInfo.GanZhiMonth + '月 ' + lunarInfo.GanZhiDay + '日';
      this.gua_infos = [];
      this.gua_infos.push({
        sizhu: sizhu,
        gong: gong,
        name: name,
        wuxing: wuxing
      });

      d3.select("svg").remove();
      var svgContainer = d3.select('#bazi').append("svg")
                           .attr("width", 400)
                           .attr("height", 420);
      iching.drawTrigrams(svgContainer, upper_yao, lower_yao, lunarInfo.GanZhiDay.substring(0,1));
    }
  }
開發者ID:l2yao,項目名稱:Iching,代碼行數:32,代碼來源:bazi-page.ts

示例2: updateSelectedValue

 updateSelectedValue() {
   if(this.upper_yao && this.lower_yao) {
     var hexagram = iching.trigram2hexagram(this.upper_yao, this.lower_yao);
     var gong = iching.getGongName(hexagram);
     var name = iching.getHexagramName(hexagram);
     var wuxing = iching.getWuXing(gong);
     this.gua_infos = [];
     this.gua_infos.push({
       title: hexagram,
       gong: gong,
       name: name,
       wuxing: wuxing
     })
   }
 }
開發者ID:l2yao,項目名稱:Iching,代碼行數:15,代碼來源:bagong-page.ts

示例3: updateChanges

  updateChanges(event) {
    if( typeof this.flip1 != 'undefined' && typeof this.flip2 != 'undefined' && typeof this.flip3 != 'undefined'
      && typeof this.flip4 != 'undefined' && typeof this.flip5 != 'undefined' && typeof this.flip6 != 'undefined') {
      var first_yao = iching.zheng2yinyang(this.flip1);
      var second_yao = iching.zheng2yinyang(this.flip2);
      var third_yao = iching.zheng2yinyang(this.flip3);
      var forth_yao = iching.zheng2yinyang(this.flip4);
      var fifth_yao = iching.zheng2yinyang(this.flip5);
      var sixth_yao = iching.zheng2yinyang(this.flip6);

      var upper_yao = iching.yinyang2trigram(forth_yao, fifth_yao, sixth_yao);
      var lower_yao = iching.yinyang2trigram(first_yao, second_yao, third_yao);

      var today = new Date();
      var day = today.getDate();
      var month = today.getMonth()+1; //January is 0!
      var year = today.getFullYear();
      var lunarInfo = lunarCalendar.solarToLunar(year, month, day);

      var hexagram = iching.trigram2hexagram(upper_yao, lower_yao);
      var gong = iching.getGongName(hexagram);
      var name = iching.getHexagramName(hexagram);
      var wuxing = iching.getWuXing(gong);
      var sizhu = lunarInfo.GanZhiYear + '年 ' + lunarInfo.GanZhiMonth + '月 ' + lunarInfo.GanZhiDay + '日';
      this.gua_infos = [];
      this.gua_infos.push({
        sizhu: sizhu,
        gong: gong,
        name: name,
        wuxing: wuxing
      });

      d3.select("svg").remove();
      var svgContainer = d3.select('#zhanbu').append("svg")
                           .attr("width", 400)
                           .attr("height", 420);
      iching.drawTrigrams(svgContainer, upper_yao, lower_yao, lunarInfo.GanZhiDay.substring(0,1));
    }
  }
開發者ID:l2yao,項目名稱:Iching,代碼行數:39,代碼來源:zhanbu-page.ts


注:本文中的iching.js.getWuXing方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。