// prettier-ignore const data0 = {"features":[{"featureName":"Sex","shapValue":[-3.2596087,-3.0975301,-2.979021,-2.9361062,-2.915939,-2.8585145,-2.7992449,-2.782337,-2.7404644,-2.7025309,-2.673449,-2.6645625,-2.6423976,-2.6390557,-2.4737928,-2.4064813,-2.400731,-2.3946743,-2.3096812,-2.304805,-2.3032339,-2.2846951,-2.2237341,-2.0930355,-2.0471709,-2.0213788,-2.0082996,-1.9351444,-1.916455,-1.7866327,-1.6927158,-1.5933183,-1.3018429,-0.96978426,-0.8815843,-0.8638329,0.4631344,0.46495983,0.6363415,0.6479492,0.7007946,0.80188906,0.80318826,0.8093494,0.8292176,0.85086185,0.8626427,0.88087344,0.9055929,0.9506758,0.9529671,1.0119904,1.0354517,1.0389549,1.0726844,1.0753235,1.1215459,1.1322687,1.1391546,1.1426538,1.1533601,1.1575185,1.160524,1.1665621,1.1694717,1.1709008,1.1760601,1.1839235,1.1870342,1.193633,1.2147866,1.2329304,1.241817,1.2540079,1.2609451,1.2636591,1.2639108,1.2667074,1.2786207,1.2878882,1.2941678,1.3027885,1.3411094,1.353887,1.3678857,1.3784629,1.3803588,1.3978269,1.4066863,1.4311011,1.4383478,1.4430126,1.4535366,1.4652505,1.4862076,1.5068007,1.5339854,1.568639,1.643364,1.6894171],"featureValue":[]},{"featureName":"Pclass","shapValue":[-1.2935952,-1.2732625,-1.1662463,-1.1075286,-1.105552,-1.0477221,-1.0412934,-1.0270226,-0.9664386,-0.9443043,-0.9349371,-0.9331895,-0.9230982,-0.91279787,-0.9121362,-0.87646383,-0.84748346,-0.83560634,-0.7995921,-0.78569394,-0.78541636,-0.7664546,-0.7625571,-0.6947627,-0.64707017,-0.63598835,-0.62617093,-0.6258216,-0.5956124,-0.594424,-0.57429165,-0.55274,-0.5441526,-0.53118396,-0.5174771,-0.51589847,-0.42014495,-0.13112769,-0.09274798,-0.092636086,-0.08444876,-0.0766966,-0.028241597,0.07258848,0.276719,0.28023994,0.2891892,0.2984162,0.31369475,0.31628385,0.3169568,0.32404092,0.324721,0.32504392,0.33425134,0.3399167,0.34009233,0.3417353,0.3421131,0.3421141,0.3432273,0.34490693,0.34689918,0.36625177,0.3752636,0.38045293,0.38302475,0.39441267,0.39918292,0.4013591,0.4027604,0.40314755,0.4101268,0.41285223,0.41767395,0.42658302,0.45121127,0.45565265,0.4682091,0.4793293,0.48470297,0.48638064,0.49183342,0.4975044,0.5709668,0.7610211,0.7937349,0.7961995,0.82218266,0.85332847,0.89109164,0.91724813,0.98979247,0.99550766,1.020709,1.0544136,1.0784948,1.1256775,1.1346767,1.2163337],"featureValue":[1,1,1,1,1,1,1,2,1,1,1,1,1,2,1,1,1,1,1,2,2,1,2,1,2,2,1,1,2,1,1,1,1,1,2,2,1,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3]},{"featureName":"Age","shapValue":[-4.155392,-2.9130683,-2.5795822,-2.4589071,-2.4001257,-2.2817655,-1.4326963,-1.1958817,-1.1216425,-1.0166739,-0.8770388,-0.7515032,-0.7137042,-0.70726466,-0.69737184,-0.44947246,-0.43959096,-0.41371655,-0.37897155,-0.36441746,-0.36275262,-0.34093073,-0.3284387,-0.32453895,-0.3178017,-0.31223732,-0.2975724,-0.27787748,-0.2660578,-0.23876037,-0.23100276,-0.19111624,-0.18360427,-0.16255347,-0.13851972,-0.12681018,-0.11429459,-0.113309786,-0.098831154,-0.08359826,-0.08005727,-0.06515589,-0.052362796,-0.052043024,-0.019397678,-0.005657259,0.006089824,0.029902719,0.034796726,0.045554616,0.045854073,0.061193902,0.0828583,0.10529698,0.12810025,0.14704995,0.15753867,0.1745817,0.17482446,0.1832609,0.1855391,0.18844417,0.1955604,0.1970756,0.19914202,0.20315585,0.20941167,0.23794194,0.23858675,0.26744464,0.2714361,0.3037251,0.3334173,0.338944,0.35876387,0.40577823,0.41577327,0.45095903,0.496165,0.537067,0.538465,0.5565857,0.5743115,0.57781076,0.599394,0.6062135,0.6187506,0.6249331,0.64773154,0.66885936,0.6975423,0.73249793,0.73966485,0.7547418,0.76682633,0.7927266,0.79696196,0.80935395,0.9325851,0.95813453],"featureValue":[4,3,1,1,5,2,2,32,12,31,9,18,32,26,8,29,35,31,"NaN",35,29,18,18,20.5,18,27,27,17,"NaN",19,31,36,9,"NaN",19,19,"NaN",36,"NaN",22,28,"NaN",36,"NaN",22,36,20,53,23,"NaN",63,19,26,19,42,21,36,48,"NaN","NaN",49,20,"NaN",24,24,43,36,"NaN",22,22,"NaN",36,"NaN","NaN",21,50,21,37,"NaN",25,"NaN",23,39,"NaN",25,21,45.5,"NaN",41,24,36.5,54,"NaN","NaN","NaN",74,60,51,"NaN",58]},{"featureName":"Fare","shapValue":[-1.3061086,-1.1101534,-1.0906113,-1.087248,-0.93561465,-0.9200831,-0.7967989,-0.79092306,-0.78892124,-0.7858129,-0.755167,-0.70715976,-0.629477,-0.59213203,-0.5700994,-0.56709343,-0.50766295,-0.41705635,-0.3992192,-0.39885592,-0.39720187,-0.37085953,-0.30780593,-0.306878,-0.29624552,-0.27880576,-0.27756912,-0.271266,-0.2508795,-0.24939722,-0.24095185,-0.20934932,-0.18937823,-0.18021868,-0.17318216,-0.14151627,-0.1356951,-0.124647416,-0.10617498,-0.08445512,-0.08045913,-0.07895193,-0.07129144,-0.062518686,-0.05785367,-0.05779147,-0.05732518,-0.052544843,-0.045536872,-0.02547681,-0.019912656,-0.01752151,-0.006463451,-0.004512713,0.0001329905,0.042330172,0.054261003,0.057743754,0.08157126,0.08440385,0.089766346,0.11665511,0.15760219,0.1577362,0.17550366,0.18555383,0.19860642,0.2274482,0.23451188,0.23632567,0.2461017,0.2566979,0.27400956,0.2838971,0.30616298,0.3736432,0.39601982,0.39862368,0.43903598,0.4552742,0.50603485,0.5678236,0.62124085,0.6306054,0.7233097,0.74341077,0.7732191,0.783113,0.812247,0.8253019,0.9000748,0.92568964,0.9697393,0.9773216,1.0100789,1.0146582,1.0434402,1.0903134,1.1609437,1.3501264],"featureValue":[30.5,35,26.55,53.1,26.55,89.1042,82.1708,69.3,79.2,77.9583,83.475,28.5,28.7125,31.3875,512.3292,30,113.275,135.6333,36.75,146.5208,15.5,79.2,51.4792,29.125,24.15,15.55,15.5,11.1333,50.4958,26,26,69.55,120,29,52,26.25,34.375,120,22.525,41.5792,20.575,51.8625,26,21.075,27.9,8.05,26,26,7.55,13,8.05,262.375,25.4667,46.9,11.2417,7.25,13,46.9,11.1333,8.3,9.5,39.6875,7.25,12.475,7.7958,15.2458,8.05,7.925,8.05,11.5,7.925,7.75,7.775,9.5,7.75,8.05,6.4958,7.925,7.75,10.5,7.75,7.125,12,7.775,9.5875,13,12.35,13,7.8542,7.225,7.4958,0,6.8583,8.1375,7.8292,7.8958,7.875,7.8958,7.775,7.8958]},{"featureName":"PassengerId","shapValue":[-0.954718,-0.86840427,-0.86592585,-0.8025391,-0.7997678,-0.74306464,-0.70631516,-0.6919416,-0.66654503,-0.63725686,-0.5951373,-0.5707671,-0.5435823,-0.53229326,-0.5024717,-0.4544518,-0.439518,-0.4115479,-0.38246357,-0.37114635,-0.37093195,-0.36458838,-0.3543138,-0.34635624,-0.34581324,-0.34238324,-0.31403807,-0.2935771,-0.2885605,-0.2885542,-0.286332,-0.25662416,-0.24481803,-0.2122153,-0.20677131,-0.204887,-0.1988504,-0.1951753,-0.19077832,-0.17670053,-0.14302549,-0.1412745,-0.11624411,-0.098678045,-0.0896941,-0.089293316,-0.06267836,-0.0614471,-0.055681128,-0.050099812,-0.049195692,-0.047676902,-0.04163532,-0.031227747,-0.020890262,-0.02047417,0.0010258592,0.006803646,0.010332304,0.014558783,0.021910336,0.031292975,0.034000177,0.03558056,0.05290384,0.062183473,0.068956055,0.07321029,0.08385638,0.08399993,0.11191032,0.14941446,0.16160426,0.16828738,0.21714321,0.22117864,0.2502925,0.28221908,0.31192818,0.33178762,0.34129563,0.3964311,0.4009187,0.42457268,0.43147746,0.48214552,0.48514262,0.5826974,0.60179585,0.6335788,0.6377196,0.638372,0.7428791,0.7769122,0.8243561,0.8462541,0.9352762,1.0587187,1.0841888,1.0888953],"featureValue":[680,660,43,47,82,725,305,396,605,686,588,423,642,572,229,38,461,228,454,628,679,7,412,547,706,223,57,681,650,299,509,606,304,530,664,32,743,643,523,321,390,553,465,637,481,372,668,36,428,391,665,484,881,262,328,750,352,871,17,230,594,127,888,555,25,719,764,641,324,322,326,192,231,376,762,835,870,332,191,778,864,802,173,148,141,868,776,178,149,110,852,90,165,816,869,146,94,140,105,126]},{"featureName":"SibSp","shapValue":[-0.25815597,-0.19866705,-0.17392606,-0.17381617,-0.16593644,-0.16433197,-0.15986502,-0.15754195,-0.15672137,-0.15627027,-0.15568909,-0.15413024,-0.14836168,-0.14719765,-0.14440566,-0.14201003,-0.14115584,-0.14042312,-0.13974558,-0.13910016,-0.13574822,-0.13467523,-0.13415398,-0.13319741,-0.13224104,-0.13016905,-0.13004297,-0.12992078,-0.12926339,-0.12587272,-0.121213704,-0.12014826,-0.12007149,-0.11970708,-0.11963585,-0.11442374,-0.10908812,-0.108401805,-0.10784612,-0.10559792,-0.10474655,-0.10405359,-0.10298207,-0.102677405,-0.10163983,-0.099689536,-0.09149587,-0.09020742,-0.08879234,-0.08550378,-0.08236693,-0.08208594,-0.08196316,-0.07835852,-0.078109674,-0.07508551,-0.0750591,-0.073161,-0.07265429,-0.071059294,-0.06889812,-0.06607298,-0.06007294,-0.058433812,-0.03847838,-0.03810763,-0.03433089,-0.0020209437,-0.0011010634,0.020406002,0.024437949,0.030599458,0.051768415,0.053773485,0.06716934,0.0933646,0.098021716,0.119278535,0.13526314,0.16834314,0.17942438,0.18433514,0.19737671,0.223876,0.23454218,0.23758335,0.24225044,0.26752234,0.4602212,0.46258637,0.4736055,0.5465019,1.1956751,1.410369,1.6507329,1.9736094,2.0619333,2.278688,2.2898245,2.4284115],"featureValue":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,2,8,3,5,3,3,4,4,4]},{"featureName":"Embarked","shapValue":[-0.623163,-0.59708935,-0.5301751,-0.42459148,-0.42422074,-0.39673674,-0.3553365,-0.35043186,-0.33764938,-0.32734677,-0.32631555,-0.31135705,-0.29092076,-0.2760055,-0.26692915,-0.24818492,-0.24574956,-0.23682378,-0.23331784,-0.15876591,-0.14860007,-0.10274403,-0.06003858,-0.032280844,-0.020898284,-0.00018312842,0.03070674,0.03569165,0.03914604,0.04281468,0.043343514,0.044681452,0.049433995,0.049662102,0.050546464,0.05441337,0.055302165,0.057049967,0.058194585,0.05951842,0.06224584,0.06290717,0.068242006,0.06840474,0.06868623,0.069493,0.06969928,0.071088515,0.07270704,0.07434003,0.07563573,0.07576022,0.08003743,0.08114165,0.08542992,0.08592636,0.089315265,0.09091096,0.09195645,0.09558658,0.097163595,0.10261268,0.10313779,0.10441088,0.10504295,0.11023988,0.11133867,0.11143061,0.1120894,0.11822991,0.11875544,0.12152232,0.12471303,0.12700692,0.12817138,0.12965852,0.13225943,0.134202,0.1343857,0.13472947,0.13557737,0.13965133,0.14031693,0.1407785,0.14189771,0.14806375,0.14820002,0.14850675,0.15534532,0.16347802,0.1736879,0.19021153,0.192999,0.2068767,0.23450796,0.24694543,0.2558687,0.2633296,0.27943987,0.30000937],"featureValue":[]},{"featureName":"Parch","shapValue":[-0.27644184,-0.27143812,-0.2527077,-0.25244972,-0.24644698,-0.2111101,-0.20747067,-0.20262371,-0.20193942,-0.168125,-0.15936173,-0.14091435,-0.09322109,-0.09317097,-0.08984832,-0.08766975,-0.08620448,-0.08550546,-0.08415754,-0.07840943,-0.07743894,-0.07122306,-0.06425916,-0.062423736,-0.061561603,-0.060777336,-0.05779715,-0.056100335,-0.05309609,-0.04416447,-0.043742843,-0.043093923,-0.039720185,-0.033599954,-0.030412078,-0.02959869,-0.028953383,-0.027878791,-0.027157579,-0.025785603,-0.024794731,-0.02463929,-0.02406357,-0.023001846,-0.02185005,-0.021057235,-0.020920102,-0.019359212,-0.018428689,-0.018416423,-0.018393919,-0.018220114,-0.018084297,-0.018075617,-0.017830957,-0.017408581,-0.017043084,-0.016413251,-0.015300427,-0.013956186,-0.013202428,-0.01306702,-0.012491457,-0.011584968,-0.010407066,-0.009551015,-0.008566951,-0.0074211573,-0.0060368357,-0.0054732934,-0.00440096,-0.000591118,0.007614606,0.008344656,0.009003392,0.010148552,0.016773071,0.030425379,0.03400762,0.04098505,0.04559051,0.061232466,0.070791356,0.07205073,0.07687193,0.13870299,0.14865592,0.16066971,0.18282208,0.19457273,0.20221208,0.20286372,0.24150187,0.24210943,0.27247217,0.27615935,0.31777757,0.34415513,0.51989555,0.555243],"featureValue":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,2,0,1,2,0,0,0,0,0,0,0,1,0,1,2,2,1,2,1,2,1,2,2,1,1,1,2,1,2,2,2,2,2,6]},{"featureName":"Name","shapValue":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"featureValue":[]},{"featureName":"Ticket","shapValue":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"featureValue":[]},{"featureName":"Cabin","shapValue":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"featureValue":[]}]} console.log(data0); const featureNames = data0.features.map(m => m.featureName) const data3 = [] let maxV = 0 data0.features.forEach((item, y) => { for (var x = 0, len = item.shapValue.length; x < len; x++) { // data3.push([item.shapValue[x],item.featureValue[x] , y]) const v = typeof item.featureValue[x] === 'number' ? item.featureValue[x] : 0 maxV = Math.max(maxV, v) data3.push([item.shapValue[x], y, v]) } }) option = { title: { text: 'Awesome Chart' }, visualMap: { min: 0, max: maxV, dimension: 2, orient: 'vertical', right: 10, top: 'center', text: ['高', '低'], calculable: true, inRange: { color: ['#4F6E9A', '#FF2D55'], }, }, tooltip: { trigger: 'item', axisPointer: { type: 'cross', }, }, xAxis: { type: 'value', name: 'SHAP值', nameGap: 25, nameLocation: 'middle', nameTextStyle: { color: '#8e8e93', }, axisLabel: { color: '#8e8e93', }, axisLine: { show: true, lineStyle: { color: '#d8d8d8', }, }, splitLine: { show: false, }, }, yAxis: { type: 'category', // type: 'value', name: '特征名称', // nameLocation: 'middle', // nameGap: 120, // nameTextStyle: { // color: '#8e8e93', // width: 110, // overflow: 'truncate', // }, axisLabel: { color: '#8e8e93', }, axisLine: { show: true, lineStyle: { color: '#d8d8d8', }, }, data: featureNames, // axisLabel: { // interval: 0, // formatter(val){ // return featureNames[val - 1] // } // }, }, series: [ { name: 'Punch Card', type: 'scatter', symbolOffset: function (val, idx) { return [0, val[1] + Math.random() * 10]; }, // symbolSize: function (val) { // // console.log(val) // return Math.min(20, Math.max(10, val[2])); // }, data: data3 } ] };