本文整理汇总了TypeScript中iching.js.drawTrigrams方法的典型用法代码示例。如果您正苦于以下问题:TypeScript js.drawTrigrams方法的具体用法?TypeScript js.drawTrigrams怎么用?TypeScript js.drawTrigrams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iching.js
的用法示例。
在下文中一共展示了js.drawTrigrams方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
}
示例2: 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));
}
}