Многие примеры используют функции, называемые такими вещами, как textStyle()
, чтобы убедиться, что в TextBlocks все установлены согласованные свойства. Для примера см. Код в OrgChartEditor.
// This function provides a common style for most of the TextBlocks.
// Some of these values may be overridden in a particular TextBlock.
function textStyle() {
return { font: "9pt Segoe UI,sans-serif", stroke: "white" };
}
Затем использовать его как это:
...
$(go.TextBlock, textStyle(),
{ row: 2, column: 0 },
new go.Binding("text", "key", function(v) {return "ID: " + v;})),
$(go.TextBlock, textStyle(),
{ row: 2, column: 3, },
new go.Binding("text", "parent", function(v) {return "Boss: " + v;})),
$(go.TextBlock, textStyle(), // the comments
{
...
В качестве альтернативы, вы можете переопределить изображение. Вот пример:
function CustomPicture() {
go.Picture.call(this);
this.sourceCrossOrigin = function() { return 'anonymous' };
}
go.Diagram.inherit(CustomPicture, go.Picture);
$(CustomPicture,...
Затем используйте везде вместо $(go.Picture,...