通过selectinput在闪亮的应用程序中选择列

问题描述

我正在尝试构建一个闪亮的应用程序,这很不错,但是我试图将我的数据框中的一列放入selectinput中,但是到目前为止,还没有找到解决方案。我有一列包含505个因数的列,称为AAPL,AAL等。我希望在selectinput中包含这些因数,以便您可以从这505个因数中进行选择,这是我现在的代码,以及我正在尝试的列名进入selectinput的是bcl-data $ Name。

var myArray = [
      {
      "id": "123","station": {
        "id": 5,"name": "Teststation"
      },"values": [
        {
          "id": "way","values": [ 339,340,341 ]
        },{
          "id": "time","values": [ 1,2,3 ]
        },{
          "name": "element_1","type": "line","result": "nok"
        },{
          "name": "element_2","type": "rect",{
          "name": "element_3","result": "ok"
        }
      ]
    }
  ];

function addColor(myArray) {
    const x =  myArray.map(obj => {

      for (const prop in obj) {
        if (obj.hasOwnProperty(prop) && Array.isArray(obj[prop])) {
          for (const item in obj[prop]) {
            if (obj[prop][item].hasOwnProperty('result') && (obj[prop][item].type === 'line')) {
              obj[prop][item].result === 'nok' ? obj[prop][item].line = { color: 'red' } : obj[prop][item].line = { color: 'green' };
          } else if (obj[prop][item].hasOwnProperty('result') && (obj[prop][item].type === 'rect')) {
              obj[prop][item].opacity = 0.2;
              obj[prop][item].line = { color: 'gray',width: 0 };
              obj[prop][item].result === 'nok' ? (obj[prop][item].fillcolor = 'red') : (obj[prop][item].fillcolor = 'green');
          }
          }
        }
    }

    return obj; //<---- Check here
  });

  return x;
 }

 addColor(myArray);

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)