在cytoscape.js中,如何在节点上创建"重复 - 线性渐变"式样式?

时间:2018-01-02 07:44:06

标签: cytoscape.js

我使用JSON来指定"样式"我的图表。我需要让节点具有像this这样的背景。在CSS中,它将是:

background: repeating-linear-gradient(
  45deg,
  white,
  white 10px,
  red 10px,
  red 20px
)

我怎样才能以JSON格式"样式" for cytoscape.js?我试过以下的东西:

{
    selector: '.someClass',
    style: {
      'background-image': 'repeating-linear-gradient(45deg, white, white 10px, red 10px, red 20px)',
    },
}

但这并不奏效。有什么建议怎么做?谢谢!

1 个答案:

答案 0 :(得分:0)

我在文档中的任何位置都看不到repeating-linear-gradient。你仔细阅读了文档吗?

如果要以编程方式创建图像,请尝试将数据uri用于background-image

http://js.cytoscape.org/#style/background-image

相关问题