Skip to content

Commit 735082a

Browse files
committed
fixed histogram attributes
1 parent 2c1d70d commit 735082a

File tree

4 files changed

+35
-6
lines changed

4 files changed

+35
-6
lines changed

src/traces/histogram/attributes.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,10 @@ module.exports = {
252252
bardir: barAttrs._deprecated.bardir
253253
},
254254

255-
tooltip: {
256-
type: 'object',
255+
tooltip: {annotationAttrs,
256+
valType: 'any',
257257
description: 'Accepts any properties typically used in annotations. This flexible structure allows for customization according to specific needs.',
258-
editType: 'plot'
258+
editType: 'calc'
259259
},
260260
tooltiptemplate: tooltiptemplateAttrs({}, {
261261
keys: constants.eventDataKeys

src/traces/histogram/defaults.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
3838
coerce('xhoverformat');
3939
coerce('yhoverformat');
4040

41+
coerce('tooltip');
42+
coerce('tooltiptemplate');
43+
4144
var orientation = coerce('orientation', (y && !x) ? 'h' : 'v');
4245
var sampleLetter = orientation === 'v' ? 'x' : 'y';
4346
var aggLetter = orientation === 'v' ? 'y' : 'x';
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"data": [
3+
{"z":[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0.479425538604203,0.42073549240394825,0.2590347239999257,0.033913221008892595,-0.19951142125004898,-0.38408870938290723,-0.47462768589678817,-0.4489612516838977,-0.3133734449877386,-0.1010608896776051,0.13599489604735257,0.3397543882321063,0.4603301568291037,0.46820104845885746,0.36143999434346163,0.16618582395229636,-0.06975643207562429,-0.2886198806908126,-0.43681911654264977,-0.47806979806556316],[0.8414709848078965,0.7384602626041288,0.4546487134128409,0.059523302749876744,-0.35017548837401463,-0.6741391071468371,-0.833049961066805,-0.7880011308845267,-0.5500221413615028,-0.17737854894038602,0.23869349855450117,0.5963250528764563,0.8079554366909637,0.8217701511725654,0.6343868724111538,0.29168356226783737,-0.12243405673851628,-0.5065755486182741,-0.7666896787563757,-0.8390914362975802],[0.9974949866040544,0.8753842058167891,0.5389488413540798,0.0705600040299336,-0.41510438314691145,-0.7991367400579124,-0.9875125521345757,-0.9341108507444101,-0.6520062348371742,-0.21026775312939655,0.28295160788871765,0.7068945470133586,0.957765047219918,0.9741412606432601,0.752013719096941,0.34576699172034125,-0.14513555427481242,-0.6005038548040795,-0.9088478683732044,-0.9946742265870426],[0.9092974268256817,0.7979835653540055,0.49129549643388193,0.06432115545729157,-0.37840124765396416,-0.72847782813465,-0.9001976297355174,-0.8515176560872232,-0.5943564625123038,-0.1916760780080705,0.2579332953294609,0.6443916022321794,0.8730803709656549,0.8880086151442936,0.6855213799524474,0.3151946025542913,-0.13230280634522198,-0.5474078740297428,-0.8284884026347462,-0.9067260757315837],[0.5984721441039564,0.5252087174427744,0.3233558794572173,0.04233424474998412,-0.24905228953044703,-0.47946213733156917,-0.5924829320872974,-0.5604432415034112,-0.3911874992581194,-0.1261554140534463,0.16976391633539115,0.4241191192817572,0.574635170156555,0.5844604902748424,0.4511894986016438,0.2074515818868843,-0.0870777172006391,-0.36028735417588875,-0.545286081388122,-0.596779758359612],[0.1411200080598672,0.12384445820716831,0.07624746575887673,0.009982434469478687,-0.05872664492762098,-0.11305739348309445,-0.13970774909946293,-0.13215277525819374,-0.09224219304455371,-0.029747504914657785,0.04003040989885004,0.10000748425976688,0.13549923859094465,0.13781605361390525,0.10639069220927921,0.048917178846713476,-0.020532965943782493,-0.0849559245590183,-0.12857870990075454,-0.1407209427195081],[-0.35078322768961984,-0.30784124362403054,-0.18952898678057029,-0.024813423918728386,0.14597733051683126,0.2810277433044853,0.34727276334600926,0.32849329935939453,0.22928721908526792,0.07394363090774263,-0.09950393699028207,-0.24858947079196256,-0.33681163228288286,-0.3425705594746185,-0.2644562661410251,-0.12159385562138761,0.051038971488334264,0.21117567833135176,0.3196092141095956,0.3497912675127834],[-0.7568024953079282,-0.6641566726773585,-0.4089021333016356,-0.0535340907332177,0.3149409643133779,0.6063074873459349,0.7492287917633427,0.7087127576894708,0.4946791233116909,0.15953078700964363,-0.21467624978306993,-0.5363230535329319,-0.7266592688575256,-0.7390839520378132,-0.5705551073052852,-0.2623344734994043,0.11011478865374665,0.4556041101569482,0.6895456557448896,0.7546623760610064],[-0.977530117665097,-0.8578633849855334,-0.5281617766300059,-0.06914774506952932,0.40679606609588603,0.7831420127722354,0.9677474816893965,0.9154146157156391,0.6389563256138466,0.20605924262087827,-0.27728832953300614,-0.6927460478486331,-0.9385953732878621,-0.9546438166881925,-0.7369621593961925,-0.3388464630301511,0.1422306651692096,0.5884847660672846,0.8906572721083589,0.9747658151790043],[-0.9589242746631385,-0.8415352216177445,-0.5181089967534271,-0.06783161980090216,0.39905330338932815,0.7682360604393477,0.9493278367245317,0.8979910496137723,0.6267947350248265,0.20213720907119684,-0.2720105554446849,-0.6795606492879366,-0.9207305956792999,-0.9364735806462414,-0.7229351724130583,-0.3323970207275786,0.13952351438338687,0.5772838271206204,0.8737049255013992,0.9562125865948901],[-0.7055403255703919,-0.6191698864310322,-0.3812050647886408,-0.04990794829456958,0.2936083745425595,0.5652391273416245,0.6984796283637233,0.6607079560337191,0.4611719330711226,0.14872493695926334,-0.20013511068373355,-0.49999510327535174,-0.6774388566463158,-0.6890219514041658,-0.5319084419776275,-0.2445651949995204,0.10265614122383222,0.42474367381750155,0.6428391416071514,0.7035451677325225],[-0.27941549819892586,-0.2452101687412882,-0.1509688379721747,-0.019765070445179098,0.11627787565772676,0.2238519424669352,0.2766192466508119,0.2616605118210736,0.18263815796815594,0.05889961331619216,-0.07925961087140347,-0.19801331804211275,-0.26828645900021747,-0.2728737179777018,-0.21065197399062777,-0.09685528002621675,0.04065496443459431,0.16821145571036328,0.2545839160486248,0.2786253548137082],[0.21511998808781552,0.1887855502599316,0.11622982560217349,0.015216985980121653,-0.08952150252080339,-0.17234200503308583,-0.21296717407571455,-0.2014505514147513,-0.1406118079338568,-0.045346389862510876,0.06102140595781295,0.15244903340373075,0.20655182062650113,0.21008351841332046,0.16217944397370895,0.0745681854434869,-0.0312999655396857,-0.12950479333428241,-0.19600233108307993,-0.21451166236246624],[0.6569865987187891,0.5765599824312772,0.35497137421222796,0.04647339352654919,-0.27340289471069096,-0.5263406190634532,-0.650411803098649,-0.6152394938306449,-0.4294350992454181,-0.138490015292236,0.18636225441262333,0.46558654462642685,0.6308190108172687,0.6416049825779119,0.4953036778474351,0.22773475846024002,-0.09559157232538983,-0.3955137523331289,-0.5986003717453734,-0.6551287432365397],[0.9379999767747389,0.8231724226710855,0.5068035503556529,0.06635149352141535,-0.39034572301610065,-0.7514726927762542,-0.9286129388183836,-0.8783963509293159,-0.6131177011890242,-0.19772645497028388,0.2660751233763779,0.6647322318261614,0.9006397065778377,0.9160391702513835,0.707160297064443,0.32514392007855847,-0.13647902833320322,-0.5646871507364809,-0.8546401644865887,-0.9353474593526193],[0.9893582466233818,0.8682435446991146,0.5345525419802729,0.06998443381300311,-0.4117183045441479,-0.792618042771031,-0.979457240606921,-0.9264911461767628,-0.6466877066541816,-0.20855256252041027,0.2806435224432541,0.7011282853277887,0.949952391260276,0.9661950210643687,0.7458794124825067,0.3429465102709998,-0.14395165833253265,-0.5956054404866631,-0.9014342383437266,-0.986560496036106],[0.7984871126234903,0.7007383659325692,0.4314244281564648,0.056482743914709636,-0.33228788594192726,-0.6397028523748146,-0.7904962501294102,-0.7477485963317867,-0.5219260075081489,-0.16831772924064364,0.2265005994310005,0.5658636818773687,0.7666835998143197,0.7797926334913993,0.6019812342709254,0.2767838340714156,-0.11617990188246004,-0.4806987459397784,-0.7275257720361802,-0.7962291157897863],[0.4121184852417566,0.36166799608084055,0.222668567867006,0.02915210840153438,-0.1715018039159572,-0.3301660933003065,-0.40799420809968046,-0.38593111146079634,-0.2693786189182488,-0.08687284555673806,0.11690243019347103,0.2920559139175316,0.39570392410849203,0.4024698130208766,0.3106970550803082,0.1428548221174657,-0.05996325353583019,-0.2481002334319773,-0.375493623385838,-0.41095307853690777],[-0.0751511204618093,-0.06595131282380662,-0.04060432367408991,-0.005315979963660839,0.03127390104315517,0.060206840359177054,0.07439904536830741,0.07037576931385751,0.04912205049061451,0.015841540515865917,-0.021317531070207008,-0.05325732757540569,-0.07215787287591162,-0.07339165430259903,-0.05665659913258328,-0.02605003252693758,0.010934490567948442,0.0452418690181102,0.06847246006729521,0.07493860483147616]],
4+
"x":[0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5],
5+
"y":[0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5],
6+
"type":"heatmap",
7+
"colorscale":"Viridis",
8+
"tooltip":{"bgcolor":"rgba(255, 255, 255, 0.2)"},
9+
"tooltiptemplate": "x: %{x}<br>y: %{y}<br>amplitude: %{x}"
10+
}
11+
],
12+
"config": {
13+
"editable": true,
14+
"modeBarButtonsToAdd": [
15+
"tooltip",
16+
"hoverclosest",
17+
"hovercompare",
18+
"togglespikelines"
19+
],
20+
"displaylogo": false,
21+
"displayModeBar": true
22+
}
23+
}

test/image/mocks/tooltip_tooltiptemplate_histogram.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22
"data": [{
33
"name":"H1",
44
"x":[15.23921160702866,15.03624024253109,17.197213230383564,7.467288036989801,9.73118879555351,10.412133555738741,13.771539114987359,19.06527554952006,6.893448656421133,11.049577750887122,13.256892510523139,5.75315036856648,9.316709825863082,1.6269833164006098,18.641703507992695,11.751584767477825,16.317694590114698,16.462629247884376,18.481165427641738,6.066337228231702,15.30176001093007,14.242703415677054,5.252479334458437,5.537966466622146,10.332773687712724,14.74723097563124,15.945896551123065,0.7829495766325634,9.101356872626877,12.5992538760891,18.506589677349435,17.88311772298359,13.239650604461104,14.893573026174689,13.290944291798736,1.2002263131283186,9.095191132532289,1.0828712108895555,18.71571427987662,18.353955013977508,10.000145823485894,17.77534914439723,13.450935215307755,1.5633741222188102,11.023184693914668,1.1310347587465541,14.240214475316593,5.403764243212052,13.429120962894281,8.264091281946154,8.381692805334096,4.342360376842025,1.4326282407154456,0.6602555085308648,5.22207774108959,9.04441085507353,19.43525005320762,12.72165912107182,3.5073982130798442,2.1812404046032974,4.911810050113036,11.171412334479356,16.76936352413933,4.587344341274601,19.990084680470815,18.766364300875814,14.441083351837289,2.213347387568916,15.187481980048705,19.03820481209533,15.634336487448873,19.560340966478936,2.221945048102185,8.082876333318605,12.491339168223469,8.2620860149176,3.267562602664027,15.613002546991675,1.809684402449574,9.384835169858231,0.784701354499362,7.736720378466413,19.110503994209395,18.18815635436725,15.441766892507427,13.325460022521323,4.350130599007782,11.826798147970157,8.451710593669393,17.80921376484458,17.668898753220198,6.903996269297961,9.86587737515345,5.162452452761177,17.65180653562772,2.5023093246149486,4.186956795808792,13.576474411009098,10.300076652914514,14.713166745686575],"type":"histogram",
5-
"tooltiptemplate":"Count: %{y}"},
5+
"tooltiptemplate":"Count: %{y}",
6+
"tooltip": {"arrowcolor": "blue"}},
67
{"name":"H2",
78
"x":[9.93930814479408,6.947631964344634,17.062657909316307,3.73745305647627,15.543332253916876,3.1717875672865214,1.3969395969400167,15.608368228140527,17.972102731028897,4.877437062932676,11.950697341929747,14.702979150022193,17.98722627222531,9.415151324090367,2.379402843949645,9.089357239971005,3.906445818222959,9.803104299504337,2.317716581150142,12.977275997656292,13.893794949388585,2.222428675530259,8.134836005844193,19.179300974916124,1.3425381870022757,19.649105422231806,9.893775272091752,7.371183440448359,0.27498466058639925,3.853254647701112,2.2831144402916514,1.222410379215635,11.947313843023302,11.725935566611039,12.234343111660277,18.676696610837254,15.454687173696737,0.26488259169332284,12.177910392641264,5.530213776191529,19.308693706427256,16.741687983862395,0.060315868468214795,5.285004836361562,8.832697108525254,12.275305474270251,14.959162079353053,6.868602059440054,18.973035635072225,2.039133745285364,1.4505708229303438,3.069641847044282,11.517687737749307,10.627295696440092,11.541368584461926,3.3607961789277074,18.512014444966994,15.650505737453138,14.615832288776687,1.361979674930609,14.079978058649953,6.340703907023045,18.294478020790464,12.301252209774836,8.692325117952702,18.850035958133404,17.913326644123476,1.5447007535622492,10.011912383417524,19.34533193110649,18.34520495610937,7.784744458265072,16.36577042855992,18.694860395751075,15.0677456305028,11.037614113035337,7.567991150976702,13.67595565969121,14.983411976986885,12.574852617001051,7.999559224808497,4.809315125646185,10.26138678181902,4.645200208941967,2.9927516792900843,6.255038768512384,2.4272073816674533,12.859923027804392,19.112860962334402,13.00012061300225,13.156848215858972,11.794865433749424,1.0931884007895198,7.298685335549413,15.288012059956333,18.18117897572211,3.195928865142803,8.286669053735697,9.727089201212294,2.3263730235563873],
89
"type":"histogram",
9-
"tooltiptemplate":"Count: %{y}"},
10+
"tooltiptemplate":"Count: %{y}",
11+
"tooltip": {"arrowcolor": "blue"}},
1012
{"name":"H3",
1113
"x":[8.424847346078977,17.769072475845338,7.404715350280213,1.140877389941386,9.438453569956607,11.182233136392437,9.545039196399177,9.14597545430418,10.488737669653476,19.16470146724785,2.409862031362404,10.129222991006632,0.7716117210389695,11.782743219231893,3.804822597114792,15.303807958215554,16.821666392002538,19.244097661018962,16.921367819419682,6.664076239755465,10.669268449481027,1.5764306149059348,1.4780159947925942,3.5192161527392707,0.19113234471882512,12.084188168832426,15.261335985626443,5.934792395469755,2.1976755919672497,3.2213231440892987,3.9529742691982306,15.09743133471514,19.363879386687223,12.131947595591509,14.202769090916158,19.824831980780683,3.082381009141948,14.116081633148713,16.47901142501033,7.510953351893281,18.910455180283,5.834796703989092,0.022478918711370532,11.58065158386449,15.846224695275783,19.745393645005844,16.069135935179823,19.226963772917955,4.978611871564493,3.50657141755909,18.130906598003932,5.256984870183883,9.078685336477747,19.20192771761044,17.490811185485256,3.8895480322011178,4.819236830946778,17.22244071088553,3.378124836925054,10.145299297006803,1.7018508220566497,10.27783823401175,10.269951697176634,3.250872850842401,13.341488434398743,9.444781580461308,17.125993928951463,17.28747991548027,11.255649620975356,2.057505420204757,18.1702342467505,15.808877858798205,5.220621339893723,9.841506215340367,18.57975812198436,5.9255025186409505,19.87374605757019,16.617764729821364,2.217621216290948,9.745573270895768,12.549014911867943,18.812301299687043,14.332163481167981,15.961659751233352,2.8520219827170767,3.765096216495225,14.215534095320127,16.609619105562565,11.722974958077376,14.130186032209089,3.864782625533729,0.48025081170719686,12.627827226620479,8.147584101012235,17.737369254682918,19.963573895192425,4.902593225542393,19.253275747935813,2.1261282846532703,14.734260396715054],"type":"histogram",
12-
"tooltiptemplate":"%{fullData.name}<br>x: %{x}<br>Count: %{y}"}
14+
"tooltiptemplate":"%{fullData.name}<br>x: %{x}<br>Count: %{y}",
15+
"tooltip": {"arrowcolor": "blue"}}
1316
],
1417
"config": {
1518
"editable": true,

0 commit comments

Comments
 (0)