@@ -157,10 +157,8 @@ class BarHorizontalSortedTemplate(Template):
157
157
"sort" : "-x" ,
158
158
},
159
159
"yOffset" : {"field" : "rev" },
160
- "color" : {
161
- "field" : "rev" ,
162
- "type" : "nominal" ,
163
- },
160
+ "color" : Template .anchor ("color" ),
161
+ "row" : Template .anchor ("row" ),
164
162
},
165
163
}
166
164
@@ -188,10 +186,8 @@ class BarHorizontalTemplate(Template):
188
186
"title" : Template .anchor ("y_label" ),
189
187
},
190
188
"yOffset" : {"field" : "rev" },
191
- "color" : {
192
- "field" : "rev" ,
193
- "type" : "nominal" ,
194
- },
189
+ "color" : Template .anchor ("color" ),
190
+ "row" : Template .anchor ("row" ),
195
191
},
196
192
}
197
193
@@ -441,10 +437,8 @@ class ScatterTemplate(Template):
441
437
"type" : "quantitative" ,
442
438
"title" : Template .anchor ("y_label" ),
443
439
},
444
- "color" : {
445
- "field" : "rev" ,
446
- "type" : "nominal" ,
447
- },
440
+ "color" : Template .anchor ("color" ),
441
+ "shape" : Template .anchor ("shape" ),
448
442
},
449
443
}
450
444
@@ -472,10 +466,8 @@ class ScatterJitterTemplate(Template):
472
466
"field" : Template .anchor ("y" ),
473
467
"title" : Template .anchor ("y_label" ),
474
468
},
475
- "color" : {
476
- "field" : "rev" ,
477
- "type" : "nominal" ,
478
- },
469
+ "color" : Template .anchor ("color" ),
470
+ "shape" : Template .anchor ("shape" ),
479
471
"xOffset" : {"field" : "randomX" , "type" : "quantitative" },
480
472
"yOffset" : {"field" : "randomY" , "type" : "quantitative" },
481
473
},
@@ -502,15 +494,26 @@ class SmoothLinearTemplate(Template):
502
494
},
503
495
},
504
496
],
497
+ "encoding" : {
498
+ "x" : {
499
+ "field" : Template .anchor ("x" ),
500
+ "type" : "quantitative" ,
501
+ "title" : Template .anchor ("x_label" ),
502
+ },
503
+ "color" : Template .anchor ("color" ),
504
+ "strokeDash" : Template .anchor ("stroke_dash" ),
505
+ "shape" : Template .anchor ("shape" ),
506
+ },
505
507
"layer" : [
506
508
{
507
- "mark" : "line" ,
508
- "encoding" : {
509
- "x" : {
510
- "field" : Template .anchor ("x" ),
511
- "type" : "quantitative" ,
512
- "title" : Template .anchor ("x_label" ),
509
+ "layer" : [
510
+ {"mark" : "line" },
511
+ {
512
+ "transform" : [{"filter" : {"param" : "hover" , "empty" : False }}],
513
+ "mark" : "point" ,
513
514
},
515
+ ],
516
+ "encoding" : {
514
517
"y" : {
515
518
"field" : Template .anchor ("y" ),
516
519
"type" : "quantitative" ,
@@ -521,18 +524,6 @@ class SmoothLinearTemplate(Template):
521
524
"field" : "rev" ,
522
525
"type" : "nominal" ,
523
526
},
524
- "tooltip" : [
525
- {
526
- "field" : Template .anchor ("x" ),
527
- "title" : Template .anchor ("x_label" ),
528
- "type" : "quantitative" ,
529
- },
530
- {
531
- "field" : Template .anchor ("y" ),
532
- "title" : Template .anchor ("y_label" ),
533
- "type" : "quantitative" ,
534
- },
535
- ],
536
527
},
537
528
"transform" : [
538
529
{
@@ -558,26 +549,10 @@ class SmoothLinearTemplate(Template):
558
549
"scale" : {"zero" : False },
559
550
},
560
551
"color" : {"field" : "rev" , "type" : "nominal" },
561
- "tooltip" : [
562
- {
563
- "field" : Template .anchor ("x" ),
564
- "title" : Template .anchor ("x_label" ),
565
- "type" : "quantitative" ,
566
- },
567
- {
568
- "field" : Template .anchor ("y" ),
569
- "title" : Template .anchor ("y_label" ),
570
- "type" : "quantitative" ,
571
- },
572
- ],
573
552
},
574
553
},
575
554
{
576
- "mark" : {
577
- "type" : "circle" ,
578
- "size" : 10 ,
579
- "tooltip" : {"content" : "encoding" },
580
- },
555
+ "mark" : {"type" : "circle" , "size" : 10 },
581
556
"encoding" : {
582
557
"x" : {
583
558
"aggregate" : "max" ,
@@ -595,6 +570,38 @@ class SmoothLinearTemplate(Template):
595
570
"color" : {"field" : "rev" , "type" : "nominal" },
596
571
},
597
572
},
573
+ {
574
+ "transform" : [
575
+ {
576
+ "pivot" : Template .anchor ("group_by" ),
577
+ "value" : Template .anchor ("y" ),
578
+ "groupby" : [Template .anchor ("x" )],
579
+ }
580
+ ],
581
+ "mark" : {
582
+ "type" : "rule" ,
583
+ "tooltip" : {"content" : "data" },
584
+ "stroke" : "grey" ,
585
+ },
586
+ "encoding" : {
587
+ "opacity" : {
588
+ "condition" : {"value" : 0.3 , "param" : "hover" , "empty" : False },
589
+ "value" : 0 ,
590
+ }
591
+ },
592
+ "params" : [
593
+ {
594
+ "name" : "hover" ,
595
+ "select" : {
596
+ "type" : "point" ,
597
+ "fields" : [Template .anchor ("x" )],
598
+ "nearest" : True ,
599
+ "on" : "mouseover" ,
600
+ "clear" : "mouseout" ,
601
+ },
602
+ }
603
+ ],
604
+ },
598
605
],
599
606
}
600
607
@@ -628,10 +635,9 @@ class SimpleLinearTemplate(Template):
628
635
"title" : Template .anchor ("y_label" ),
629
636
"scale" : {"zero" : False },
630
637
},
631
- "color" : {
632
- "field" : "rev" ,
633
- "type" : "nominal" ,
634
- },
638
+ "color" : Template .anchor ("color" ),
639
+ "strokeDash" : Template .anchor ("stroke_dash" ),
640
+ "shape" : Template .anchor ("shape" ),
635
641
},
636
642
}
637
643
0 commit comments