Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 6 additions & 16 deletions geemap/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import ee
import bqplot as bq
from bqplot import Tooltip
from bqplot import pyplot as plt
import ipywidgets as widgets
import numpy as np
Expand Down Expand Up @@ -80,7 +79,6 @@ def transpose_df(
ValueError: If `label_col` is not a column in the DataFrame.
ValueError: If the length of `indexes` does not match the number of
rows in the transposed DataFrame.

"""
# Check if the specified column exists in the DataFrame.
if label_col not in df.columns:
Expand Down Expand Up @@ -446,19 +444,11 @@ def set_chart_type(
self._set_plt_options()

def get_chart_type(self) -> str | None:
"""Get the current chart type.

Returns:
The current chart type, or None if no chart type is set.
"""
"""Returns the current chart type, or None if no chart type is set."""
return self.chart_type

def get_data_table(self) -> DataTable:
"""Get the DataTable used by the chart.

Returns:
The DataTable instance containing the chart data.
"""
"""Returns the DataTable instance containing the chart data."""
return self.data_table

def set_data_table(self, data: dict[str, list[Any]] | pd.DataFrame) -> None:
Expand Down Expand Up @@ -583,11 +573,11 @@ def __init__(
def generate_tooltip(self) -> None:
"""Generates a tooltip for the bar chart."""
if (self.x_label is not None) and (self.y_label is not None):
self.bar_chart.tooltip = Tooltip(
self.bar_chart.tooltip = bqplot.Tooltip(
fields=["x", "y"], labels=[self.x_label, self.y_label]
)
else:
self.bar_chart.tooltip = Tooltip(fields=["x", "y"])
self.bar_chart.tooltip = bqplot.Tooltip(fields=["x", "y"])

def get_ylim(self) -> tuple[float, float]:
"""Gets the y-axis limits for the bar chart.
Expand Down Expand Up @@ -1080,12 +1070,12 @@ def grow_bin(bin_size, ref):
histogram.stroke_width = 0

if ("x_label" in kwargs) and ("y_label" in kwargs):
histogram.tooltip = Tooltip(
histogram.tooltip = bqplot.Tooltip(
fields=["midpoint", "count"],
labels=[kwargs["x_label"], kwargs["y_label"]],
)
else:
histogram.tooltip = Tooltip(fields=["midpoint", "count"])
histogram.tooltip = bqplot.Tooltip(fields=["midpoint", "count"])

if show:
plt.show()
Expand Down