本文整理汇总了TypeScript中d3-collection.values函数的典型用法代码示例。如果您正苦于以下问题:TypeScript values函数的具体用法?TypeScript values怎么用?TypeScript values使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了values函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
let booleanFlag: boolean;
// ---------------------------------------------------------------------
// Test Objects
// ---------------------------------------------------------------------
// test keys(...) signatures ------------------------------------------------------
stringArray = d3Collection.keys(keyValueObj);
stringArray = d3Collection.keys([0, 1, 2]);
stringArray = d3Collection.keys(document); // purely for the fun of it
// test values(...) signatures ------------------------------------------------------
anyArray = d3Collection.values(keyValueObj);
// stringArray = d3Collection.values(keyValueObj); // test fails, as values in keyValueObj are not all strings
stringArray = d3Collection.values(keyValueObj2);
stringArray = d3Collection.values<string>(keyValueObj2);
// stringArray = d3Collection.values<string>(keyValueObj); // test fails, as values in keyValueObj do not meet generic constraint
stringArray = d3Collection.values(['1', '2']);
anyArray = d3Collection.values(document); // purely for the fun of it
// test entries(...) signatures ------------------------------------------------------
anyKVArray = d3Collection.entries(keyValueObj);
// stringKVArray = d3Collection.entries(keyValueObj); // test fails, as values in keyValueObj are not all strings
stringKVArray = d3Collection.entries(keyValueObj2);
示例2: function
.on("click", function (d) {
console.log(d3Values(d.id).map(JSON.stringify as any).join("\n"));
})