首页 \ 问答 \ HTML5 / CSS3布局显示任务运行状态[关闭](HTML5/CSS3 layout to show tasks running status [closed])

HTML5 / CSS3布局显示任务运行状态[关闭](HTML5/CSS3 layout to show tasks running status [closed])

我需要创建一个设计来展示任务状态,即运行/挂起/失败/通过,如下面的屏幕截图所示。

在此处输入图像描述

如何使用HTML5 / CSS3创建它?

或者,任何实现相同目标的指针都会有很大的帮助。

在此先感谢Manish Kumar


I need to create a design to showcase the task status i.e. running/pending/failed/passed as shown in the below screenshot.

enter image description here

How can i create it using HTML5/CSS3?

or,any pointers to achieve the same will be of great help.

Thanks in advance, Manish Kumar


原文:https://stackoverflow.com/questions/36760716
更新时间:2023-06-07 13:06

最满意答案

您可以简单地从前一个元素中移除additionalClass ,然后放入单击元素中:

  events: {
            click: function (event) {   
                let old_HL = document.querySelector('#container .highcharts-link.highcharts-point.additionalClass');
                if (old_HL) old_HL.classList.remove('additionalClass');
                event.target.classList.add('additionalClass');
            }
   }

的jsfiddle

编辑:没有DOM功能的变体:

plotOptions: {
  series: {
    animation: false,
    dataLabels: {
      enabled: true,
      nodeFormat: "{point.name}mm"
    },
    allowPointSelect: true,//you need this to allow selection
    colorByPoint: false,
    point: {
      events: {
        select: function(event) {
          if (typeof this.isNode !== 'undefined') return;//to disable selecting the root node
          this.custom_old_color = this.color;//save old color
          this.update({
            color: 'red'
          });
        },
        unselect: function(event) {
          if (typeof this.isNode !== 'undefined') return;
          this.update({
            color: this.custom_old_color//restore old color
          });
        }
      }
    }
  }

的jsfiddle


You can simply remove the additionalClass from the previous element and then put in on the clicked element:

  events: {
            click: function (event) {   
                let old_HL = document.querySelector('#container .highcharts-link.highcharts-point.additionalClass');
                if (old_HL) old_HL.classList.remove('additionalClass');
                event.target.classList.add('additionalClass');
            }
   }

JSFiddle

EDIT: a variant without DOM functions:

plotOptions: {
  series: {
    animation: false,
    dataLabels: {
      enabled: true,
      nodeFormat: "{point.name}mm"
    },
    allowPointSelect: true,//you need this to allow selection
    colorByPoint: false,
    point: {
      events: {
        select: function(event) {
          if (typeof this.isNode !== 'undefined') return;//to disable selecting the root node
          this.custom_old_color = this.color;//save old color
          this.update({
            color: 'red'
          });
        },
        unselect: function(event) {
          if (typeof this.isNode !== 'undefined') return;
          this.update({
            color: this.custom_old_color//restore old color
          });
        }
      }
    }
  }

JSFiddle

相关问答

更多
  • 您的点击事件在链接上工作的原因,但不在节点上是因为节点也附加了拖动行为。 最简单的方法是取消拖动行为,然后添加点击行为,如下所示... library(networkD3) library(htmlwidgets) URL <- paste0('https://cdn.rawgit.com/christophergandrud/networkD3/', 'master/JSONdata/energy.json') energy <- jsonlite::fromJSON(URL ...
  • 您可以简单地从前一个元素中移除additionalClass ,然后放入单击元素中: events: { click: function (event) { let old_HL = document.querySelector('#container .highcharts-link.highcharts-point.additionalClass'); if (old_HL) old_HL.classLis ...
  • 这就是你需要的:首先,相应地过滤link数组。 var firstLink = link.filter(d => d.source.node === 0 && d.target.node === 4); 在这种情况下,我们得到第一个链接(在顶部),它从节点0(源)到节点4(目标)。 然后,应用不透明度: firstLink.attr("opacity", .5); 这是一个显示它的小提琴: https : //jsfiddle.net/7mm1ko4f/ That's what you need: Fi ...
  • 看到这个现场演示 : http : //jsfiddle.net/kkulig/v79mb8eo/ 我创建了改变给定节点中所有链接点的状态的函数: function linksHover(point, state) { if (point.isNode) { point.linksFrom.forEach(function(l) { l.setState(state); }); } } 它在point的mouseOver和mouseOut事件上执行: plotOpt ...
  • 将链接修改为: link = link .data(school.links) .enter().append("path") .attr("d", d3.sankeyLinkHorizontal()) .attr("stroke-width", function(d) { return Math.max(1, d.width); }) .style("stroke", function(d){ return d.target.name == "Ralei ...
  • 值得注意的是: path[fill-opacity="0.8"] 。 这是一个CSS选择器,可以通过svg fill-opacity属性的值进行选择。 我刚刚从我之前的一个答案中修改了一个概念。 请注意,最好通过类或ID进一步限制此规则,以防止这种情况渗透到页面的其他区域。 https://stackoverflow.com/a/26634831/3771976 google.charts.load('current', {'packages':['sankey']}); goog ...
  • 是的,通过简单的Sankey代码插件更改,可以实现您想要的功能。 在Sankey插件中的函数computeNodeBreadths()有一行: moveSinksRight(x); 它应该改为: moveSourcesRight(x); 以下两个例子说明了这一点: 例1 (原Sankey插件) 的jsfiddle 例2 (提议更改) 的jsfiddle 例3 (同时使用MoveSinksRight()和MoveSourcesRight() ) 的jsfiddle 例4 (没有MoveSinksRight ...
  • 由于脚本在程序中的位置而引发错误。 在将图表集成到包含许多其他内容的页面时,我将脚本放在head部分中,这似乎导致了问题。 现在,我把它放在最后,一切正常。 我很抱歉发布了这个,我很傻。