gradio-pr-bot commited on
Commit
9fd6173
·
verified ·
1 Parent(s): 87661fa

Upload folder using huggingface_hub

Browse files
6.4.0/nativeplot/Index.svelte CHANGED
@@ -20,13 +20,20 @@
20
  let props = $props();
21
  const gradio = new Gradio<NativePlotEvents, NativePlotProps>(props);
22
 
23
- let unique_colors = $derived(
24
- gradio.props.color &&
25
- gradio.props.value &&
26
- gradio.props.value.datatypes[gradio.props.color] === "nominal"
27
- ? Array.from(new Set(_data.map((d) => d[gradio.props.color!])))
28
- : []
29
- );
 
 
 
 
 
 
 
30
 
31
  let x_lim = $derived(gradio.props.x_lim || null); // for some unknown reason, x_lim was getting set to undefined when used in re-render, so this line is needed
32
  let y_lim = $derived(gradio.props.y_lim || null);
@@ -610,7 +617,10 @@
610
  labelAngle: gradio.props.x_label_angle
611
  }),
612
  labels: gradio.props.x_axis_labels_visible,
613
- ticks: gradio.props.x_axis_labels_visible
 
 
 
614
  },
615
  field: escape_field_name(gradio.props.x),
616
  title: gradio.props.x_title || gradio.props.x,
@@ -624,9 +634,14 @@
624
  sort: _sort
625
  },
626
  y: {
627
- axis: gradio.props.y_label_angle
628
- ? { labelAngle: gradio.props.y_label_angle }
629
- : {},
 
 
 
 
 
630
  field: escape_field_name(gradio.props.y),
631
  title: gradio.props.y_title || gradio.props.y,
632
  type: gradio.props.value!.datatypes[gradio.props.y],
 
20
  let props = $props();
21
  const gradio = new Gradio<NativePlotEvents, NativePlotProps>(props);
22
 
23
+ let unique_colors = $derived.by(() => {
24
+ if (
25
+ !gradio.props.color ||
26
+ !gradio.props.value ||
27
+ gradio.props.value.datatypes[gradio.props.color] !== "nominal"
28
+ ) {
29
+ return [];
30
+ }
31
+ const color_index = gradio.props.value.columns.indexOf(gradio.props.color);
32
+ if (color_index === -1) return [];
33
+ return Array.from(
34
+ new Set(gradio.props.value.data.map((row) => row[color_index]))
35
+ );
36
+ });
37
 
38
  let x_lim = $derived(gradio.props.x_lim || null); // for some unknown reason, x_lim was getting set to undefined when used in re-render, so this line is needed
39
  let y_lim = $derived(gradio.props.y_lim || null);
 
617
  labelAngle: gradio.props.x_label_angle
618
  }),
619
  labels: gradio.props.x_axis_labels_visible,
620
+ ticks: gradio.props.x_axis_labels_visible,
621
+ ...(gradio.props.x_axis_format !== null && {
622
+ format: gradio.props.x_axis_format
623
+ })
624
  },
625
  field: escape_field_name(gradio.props.x),
626
  title: gradio.props.x_title || gradio.props.x,
 
634
  sort: _sort
635
  },
636
  y: {
637
+ axis: {
638
+ ...(gradio.props.y_label_angle && {
639
+ labelAngle: gradio.props.y_label_angle
640
+ }),
641
+ ...(gradio.props.y_axis_format !== null && {
642
+ format: gradio.props.y_axis_format
643
+ })
644
+ },
645
  field: escape_field_name(gradio.props.y),
646
  title: gradio.props.y_title || gradio.props.y,
647
  type: gradio.props.value!.datatypes[gradio.props.y],
6.4.0/nativeplot/package.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "@gradio/nativeplot",
3
- "version": "0.9.4",
4
  "description": "Gradio UI packages",
5
  "type": "module",
6
  "author": "",
 
1
  {
2
  "name": "@gradio/nativeplot",
3
+ "version": "0.10.0",
4
  "description": "Gradio UI packages",
5
  "type": "module",
6
  "author": "",
6.4.0/nativeplot/types.ts CHANGED
@@ -25,6 +25,8 @@ export interface NativePlotProps {
25
  y_lim: [number | null, number | null] | null;
26
  x_label_angle: number | null;
27
  y_label_angle: number | null;
 
 
28
  x_axis_labels_visible: boolean;
29
  caption: string | null;
30
  sort: "x" | "y" | "-x" | "-y" | string[] | null;
 
25
  y_lim: [number | null, number | null] | null;
26
  x_label_angle: number | null;
27
  y_label_angle: number | null;
28
+ x_axis_format: string | null;
29
+ y_axis_format: string | null;
30
  x_axis_labels_visible: boolean;
31
  caption: string | null;
32
  sort: "x" | "y" | "-x" | "-y" | string[] | null;