├── .github └── workflows │ ├── build_and_test.yml │ ├── deploy_wasm_to_pages.yml │ └── generate_goldens.yaml ├── .gitignore ├── AUTHORS ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── charts.gif ├── charts_common ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── lib │ ├── common.dart │ └── src │ │ ├── chart │ │ ├── bar │ │ │ ├── bar_chart.dart │ │ │ ├── bar_error_decorator.dart │ │ │ ├── bar_label_decorator.dart │ │ │ ├── bar_lane_renderer.dart │ │ │ ├── bar_lane_renderer_config.dart │ │ │ ├── bar_renderer.dart │ │ │ ├── bar_renderer_config.dart │ │ │ ├── bar_renderer_decorator.dart │ │ │ ├── bar_target_line_renderer.dart │ │ │ ├── bar_target_line_renderer_config.dart │ │ │ ├── base_bar_renderer.dart │ │ │ ├── base_bar_renderer_config.dart │ │ │ └── base_bar_renderer_element.dart │ │ ├── cartesian │ │ │ ├── axis │ │ │ │ ├── auto_adjusting_static_tick_provider.dart │ │ │ │ ├── axis.dart │ │ │ │ ├── axis_tick.dart │ │ │ │ ├── collision_report.dart │ │ │ │ ├── draw_strategy │ │ │ │ │ ├── base_tick_draw_strategy.dart │ │ │ │ │ ├── gridline_draw_strategy.dart │ │ │ │ │ ├── none_draw_strategy.dart │ │ │ │ │ ├── range_tick_draw_strategy.dart │ │ │ │ │ ├── small_tick_draw_strategy.dart │ │ │ │ │ └── tick_draw_strategy.dart │ │ │ │ ├── end_points_tick_provider.dart │ │ │ │ ├── linear │ │ │ │ │ ├── bucketing_numeric_axis.dart │ │ │ │ │ ├── bucketing_numeric_tick_provider.dart │ │ │ │ │ ├── linear_scale.dart │ │ │ │ │ ├── linear_scale_domain_info.dart │ │ │ │ │ ├── linear_scale_function.dart │ │ │ │ │ └── linear_scale_viewport.dart │ │ │ │ ├── numeric_extents.dart │ │ │ │ ├── numeric_scale.dart │ │ │ │ ├── numeric_tick_provider.dart │ │ │ │ ├── ordinal_extents.dart │ │ │ │ ├── ordinal_scale.dart │ │ │ │ ├── ordinal_scale_domain_info.dart │ │ │ │ ├── ordinal_tick_provider.dart │ │ │ │ ├── range_axis_tick.dart │ │ │ │ ├── range_tick.dart │ │ │ │ ├── range_tick_provider.dart │ │ │ │ ├── scale.dart │ │ │ │ ├── simple_ordinal_scale.dart │ │ │ │ ├── spec │ │ │ │ │ ├── axis_spec.dart │ │ │ │ │ ├── bucketing_axis_spec.dart │ │ │ │ │ ├── date_time_axis_spec.dart │ │ │ │ │ ├── end_points_time_axis_spec.dart │ │ │ │ │ ├── numeric_axis_spec.dart │ │ │ │ │ ├── ordinal_axis_spec.dart │ │ │ │ │ ├── percent_axis_spec.dart │ │ │ │ │ ├── range_tick_spec.dart │ │ │ │ │ └── tick_spec.dart │ │ │ │ ├── static_tick_provider.dart │ │ │ │ ├── tick.dart │ │ │ │ ├── tick_formatter.dart │ │ │ │ ├── tick_provider.dart │ │ │ │ └── time │ │ │ │ │ ├── auto_adjusting_date_time_tick_provider.dart │ │ │ │ │ ├── base_time_stepper.dart │ │ │ │ │ ├── date_time_axis.dart │ │ │ │ │ ├── date_time_extents.dart │ │ │ │ │ ├── date_time_scale.dart │ │ │ │ │ ├── date_time_tick_formatter.dart │ │ │ │ │ ├── day_time_stepper.dart │ │ │ │ │ ├── hour_tick_formatter.dart │ │ │ │ │ ├── hour_time_stepper.dart │ │ │ │ │ ├── minute_time_stepper.dart │ │ │ │ │ ├── month_time_stepper.dart │ │ │ │ │ ├── simple_time_tick_formatter.dart │ │ │ │ │ ├── time_range_tick_provider.dart │ │ │ │ │ ├── time_range_tick_provider_impl.dart │ │ │ │ │ ├── time_stepper.dart │ │ │ │ │ ├── time_tick_formatter.dart │ │ │ │ │ ├── time_tick_formatter_impl.dart │ │ │ │ │ └── year_time_stepper.dart │ │ │ ├── cartesian_chart.dart │ │ │ └── cartesian_renderer.dart │ │ ├── common │ │ │ ├── base_chart.dart │ │ │ ├── behavior │ │ │ │ ├── a11y │ │ │ │ │ ├── a11y_explore_behavior.dart │ │ │ │ │ ├── a11y_node.dart │ │ │ │ │ ├── domain_a11y_explore_behavior.dart │ │ │ │ │ └── keyboard_domain_navigator.dart │ │ │ │ ├── calculation │ │ │ │ │ └── percent_injector.dart │ │ │ │ ├── chart_behavior.dart │ │ │ │ ├── chart_title │ │ │ │ │ └── chart_title.dart │ │ │ │ ├── domain_highlighter.dart │ │ │ │ ├── domain_outliner.dart │ │ │ │ ├── initial_selection.dart │ │ │ │ ├── legend │ │ │ │ │ ├── datum_legend.dart │ │ │ │ │ ├── legend.dart │ │ │ │ │ ├── legend_entry.dart │ │ │ │ │ ├── legend_entry_generator.dart │ │ │ │ │ ├── per_datum_legend_entry_generator.dart │ │ │ │ │ ├── per_series_legend_entry_generator.dart │ │ │ │ │ └── series_legend.dart │ │ │ │ ├── line_point_highlighter.dart │ │ │ │ ├── range_annotation.dart │ │ │ │ ├── selection │ │ │ │ │ ├── lock_selection.dart │ │ │ │ │ ├── select_nearest.dart │ │ │ │ │ └── selection_trigger.dart │ │ │ │ ├── slider │ │ │ │ │ └── slider.dart │ │ │ │ ├── sliding_viewport.dart │ │ │ │ ├── sunburst_ring_expander.dart │ │ │ │ └── zoom │ │ │ │ │ ├── initial_hint_behavior.dart │ │ │ │ │ ├── pan_and_zoom_behavior.dart │ │ │ │ │ ├── pan_behavior.dart │ │ │ │ │ └── panning_tick_provider.dart │ │ │ ├── canvas_shapes.dart │ │ │ ├── chart_canvas.dart │ │ │ ├── chart_context.dart │ │ │ ├── datum_details.dart │ │ │ ├── processed_series.dart │ │ │ ├── selection_model │ │ │ │ └── selection_model.dart │ │ │ ├── series_datum.dart │ │ │ ├── series_renderer.dart │ │ │ ├── series_renderer_config.dart │ │ │ └── unitconverter │ │ │ │ ├── identity_converter.dart │ │ │ │ └── unit_converter.dart │ │ ├── layout │ │ │ ├── layout_config.dart │ │ │ ├── layout_manager.dart │ │ │ ├── layout_manager_impl.dart │ │ │ ├── layout_margin_strategy.dart │ │ │ └── layout_view.dart │ │ ├── line │ │ │ ├── line_chart.dart │ │ │ ├── line_renderer.dart │ │ │ └── line_renderer_config.dart │ │ ├── link │ │ │ ├── link_chart.dart │ │ │ ├── link_renderer.dart │ │ │ └── link_renderer_config.dart │ │ ├── pie │ │ │ ├── arc_label_decorator.dart │ │ │ ├── arc_renderer.dart │ │ │ ├── arc_renderer_config.dart │ │ │ ├── arc_renderer_decorator.dart │ │ │ ├── arc_renderer_element.dart │ │ │ ├── base_arc_renderer.dart │ │ │ ├── base_arc_renderer_config.dart │ │ │ └── pie_chart.dart │ │ ├── sankey │ │ │ ├── sankey_chart.dart │ │ │ ├── sankey_renderer.dart │ │ │ └── sankey_renderer_config.dart │ │ ├── scatter_plot │ │ │ ├── comparison_points_decorator.dart │ │ │ ├── point_renderer.dart │ │ │ ├── point_renderer_config.dart │ │ │ ├── point_renderer_decorator.dart │ │ │ ├── scatter_plot_chart.dart │ │ │ ├── symbol_annotation_renderer.dart │ │ │ └── symbol_annotation_renderer_config.dart │ │ ├── sunburst │ │ │ ├── sunburst_arc_label_decorator.dart │ │ │ ├── sunburst_arc_renderer.dart │ │ │ ├── sunburst_arc_renderer_config.dart │ │ │ └── sunburst_chart.dart │ │ ├── time_series │ │ │ └── time_series_chart.dart │ │ └── treemap │ │ │ ├── base_treemap_renderer.dart │ │ │ ├── dice_treemap_renderer.dart │ │ │ ├── slice_dice_treemap_renderer.dart │ │ │ ├── slice_treemap_renderer.dart │ │ │ ├── squarified_treemap_renderer.dart │ │ │ ├── treemap_chart.dart │ │ │ ├── treemap_label_decorator.dart │ │ │ ├── treemap_renderer_config.dart │ │ │ ├── treemap_renderer_decorator.dart │ │ │ └── treemap_renderer_element.dart │ │ ├── common │ │ ├── color.dart │ │ ├── date_time_factory.dart │ │ ├── gesture_listener.dart │ │ ├── graphics_factory.dart │ │ ├── line_style.dart │ │ ├── material_palette.dart │ │ ├── math.dart │ │ ├── paint_style.dart │ │ ├── palette.dart │ │ ├── performance.dart │ │ ├── proxy_gesture_listener.dart │ │ ├── rate_limit_utils.dart │ │ ├── rtl_spec.dart │ │ ├── style │ │ │ ├── material_style.dart │ │ │ ├── style.dart │ │ │ └── style_factory.dart │ │ ├── symbol_renderer.dart │ │ ├── text_element.dart │ │ ├── text_measurement.dart │ │ ├── text_style.dart │ │ ├── text_utils.dart │ │ └── typed_registry.dart │ │ └── data │ │ ├── graph.dart │ │ ├── graph_utils.dart │ │ ├── sankey_graph.dart │ │ ├── series.dart │ │ └── tree.dart ├── pubspec.lock ├── pubspec.yaml └── test │ ├── chart │ ├── bar │ │ ├── bar_label_decorator_test.dart │ │ ├── bar_renderer_test.dart │ │ ├── bar_target_line_renderer_test.dart │ │ └── renderer_nearest_detail_test.dart │ ├── cartesian │ │ ├── axis │ │ │ ├── auto_adjusting_static_tick_provider_test.dart │ │ │ ├── axis_test.dart │ │ │ ├── axis_tick_test.dart │ │ │ ├── bucketing_numeric_tick_provider_test.dart │ │ │ ├── draw_strategy │ │ │ │ └── tick_draw_strategy_test.dart │ │ │ ├── end_points_tick_provider_test.dart │ │ │ ├── linear │ │ │ │ └── linear_scale_test.dart │ │ │ ├── numeric_tick_provider_test.dart │ │ │ ├── ordinal_scale_test.dart │ │ │ ├── range_tick_provider_test.dart │ │ │ ├── static_tick_provider_test.dart │ │ │ └── time │ │ │ │ ├── basic_date_time_tick_formatter_spec_test.dart │ │ │ │ ├── date_time_tick_formatter_test.dart │ │ │ │ ├── simple_date_time_factory.dart │ │ │ │ ├── simple_time_tick_formatter_test.dart │ │ │ │ ├── time_stepper_test.dart │ │ │ │ └── time_tick_provider_test.dart │ │ ├── cartesian_chart_test.dart │ │ └── cartesian_renderer_test.dart │ ├── common │ │ ├── behavior │ │ │ ├── a11y │ │ │ │ └── domain_a11y_explore_behavior_test.dart │ │ │ ├── calculation │ │ │ │ └── percent_injector_test.dart │ │ │ ├── chart_behavior_test.dart │ │ │ ├── domain_highlighter_test.dart │ │ │ ├── initial_selection_test.dart │ │ │ ├── line_point_highlighter_test.dart │ │ │ ├── range_annotation_test.dart │ │ │ ├── selection │ │ │ │ ├── lock_selection_test.dart │ │ │ │ └── select_nearest_test.dart │ │ │ ├── series_legend_behavior_test.dart │ │ │ └── slider │ │ │ │ └── slider_test.dart │ │ ├── gesture_listener_test.dart │ │ └── selection_model │ │ │ └── selection_model_test.dart │ ├── layout │ │ └── layout_manager_impl_test.dart │ ├── line │ │ ├── line_renderer_test.dart │ │ └── renderer_nearest_detail_test.dart │ ├── pie │ │ └── arc_label_decorator_test.dart │ ├── scatter_plot │ │ ├── comparison_points_decorator_test.dart │ │ ├── point_renderer_test.dart │ │ ├── renderer_nearest_detail_test.dart │ │ └── symbol_annotation_renderer_test.dart │ ├── sunburst │ │ └── sunburst_arc_label_decorator_test.dart │ └── treemap │ │ └── treemap_label_decorator_test.dart │ ├── common │ └── text_utils_test.dart │ ├── data │ ├── graph_test.dart │ ├── graph_utils_test.dart │ └── sankey_graph_test.dart │ ├── mox.dart │ └── mox.mocks.dart ├── charts_flutter ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── example │ ├── .gitignore │ ├── .metadata │ ├── README.md │ ├── analysis_options.yaml │ ├── android.iml │ ├── android │ │ ├── .gitignore │ │ ├── app │ │ │ ├── build.gradle │ │ │ └── src │ │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ │ ├── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── java │ │ │ │ │ └── io │ │ │ │ │ │ └── flutter │ │ │ │ │ │ └── plugins │ │ │ │ │ │ └── GeneratedPluginRegistrant.java │ │ │ │ ├── kotlin │ │ │ │ │ └── com │ │ │ │ │ │ └── example │ │ │ │ │ │ └── example │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── res │ │ │ │ │ ├── drawable-v21 │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── drawable │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── values-night │ │ │ │ │ └── styles.xml │ │ │ │ │ └── values │ │ │ │ │ └── styles.xml │ │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ ├── build.gradle │ │ ├── gradle.properties │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ └── settings.gradle │ ├── build_serve.sh │ ├── examples.iml │ ├── examples_android.iml │ ├── ios │ │ ├── .gitignore │ │ ├── Flutter │ │ │ ├── AppFrameworkInfo.plist │ │ │ ├── Debug.xcconfig │ │ │ └── Release.xcconfig │ │ ├── Runner.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ │ └── WorkspaceSettings.xcsettings │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ ├── Runner.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ ├── Runner │ │ │ ├── AppDelegate.swift │ │ │ ├── Assets.xcassets │ │ │ │ ├── AppIcon.appiconset │ │ │ │ │ ├── Contents.json │ │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ │ │ └── LaunchImage.imageset │ │ │ │ │ ├── Contents.json │ │ │ │ │ ├── LaunchImage.png │ │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ │ └── README.md │ │ │ ├── Base.lproj │ │ │ │ ├── LaunchScreen.storyboard │ │ │ │ └── Main.storyboard │ │ │ ├── Info.plist │ │ │ └── Runner-Bridging-Header.h │ │ └── RunnerTests │ │ │ └── RunnerTests.swift │ ├── lib │ │ ├── a11y │ │ │ ├── a11y_gallery.dart │ │ │ └── domain_a11y_explore_bar_chart.dart │ │ ├── app_config.dart │ │ ├── axes │ │ │ ├── axes_gallery.dart │ │ │ ├── bar_secondary_axis.dart │ │ │ ├── bar_secondary_axis_only.dart │ │ │ ├── custom_axis_tick_formatters.dart │ │ │ ├── custom_font_size_and_color.dart │ │ │ ├── custom_measure_tick_count.dart │ │ │ ├── flipped_vertical_axis.dart │ │ │ ├── gridline_dash_pattern.dart │ │ │ ├── hidden_ticks_and_labels_axis.dart │ │ │ ├── horizontal_bar_secondary_axis.dart │ │ │ ├── integer_only_measure_axis.dart │ │ │ ├── line_disjoint_axis.dart │ │ │ ├── measure_axis_label_alignment.dart │ │ │ ├── nonzero_bound_measure_axis.dart │ │ │ ├── numeric_initial_viewport.dart │ │ │ ├── ordinal_initial_viewport.dart │ │ │ ├── short_tick_length_axis.dart │ │ │ └── statically_provided_ticks.dart │ │ ├── bar_chart │ │ │ ├── bar_gallery.dart │ │ │ ├── custom_rounded_bars.dart │ │ │ ├── grouped.dart │ │ │ ├── grouped_fill_color.dart │ │ │ ├── grouped_single_target_line.dart │ │ │ ├── grouped_stacked.dart │ │ │ ├── grouped_stacked_weight_pattern.dart │ │ │ ├── grouped_target_line.dart │ │ │ ├── horizontal.dart │ │ │ ├── horizontal_bar_label.dart │ │ │ ├── horizontal_bar_label_custom.dart │ │ │ ├── horizontal_pattern_forward_hatch.dart │ │ │ ├── pattern_forward_hatch.dart │ │ │ ├── simple.dart │ │ │ ├── spark_bar.dart │ │ │ ├── stacked.dart │ │ │ ├── stacked_fill_color.dart │ │ │ ├── stacked_horizontal.dart │ │ │ ├── stacked_target_line.dart │ │ │ └── vertical_bar_label.dart │ │ ├── behaviors │ │ │ ├── behaviors_gallery.dart │ │ │ ├── chart_title.dart │ │ │ ├── initial_hint_animation.dart │ │ │ ├── initial_selection.dart │ │ │ ├── percent_of_domain.dart │ │ │ ├── percent_of_domain_by_category.dart │ │ │ ├── percent_of_series.dart │ │ │ ├── selection_bar_highlight.dart │ │ │ ├── selection_callback_example.dart │ │ │ ├── selection_line_highlight.dart │ │ │ ├── selection_line_highlight_custom_shape.dart │ │ │ ├── selection_scatter_plot_highlight.dart │ │ │ ├── selection_user_managed.dart │ │ │ ├── slider.dart │ │ │ └── sliding_viewport_on_selection.dart │ │ ├── combo_chart │ │ │ ├── combo_gallery.dart │ │ │ ├── date_time_line_point.dart │ │ │ ├── numeric_line_bar.dart │ │ │ ├── numeric_line_point.dart │ │ │ ├── ordinal_bar_line.dart │ │ │ └── scatter_plot_line.dart │ │ ├── gallery_app.dart │ │ ├── gallery_scaffold.dart │ │ ├── i18n │ │ │ ├── i18n_gallery.dart │ │ │ ├── rtl_bar_chart.dart │ │ │ ├── rtl_line_chart.dart │ │ │ ├── rtl_line_segments.dart │ │ │ └── rtl_series_legend.dart │ │ ├── legends │ │ │ ├── datum_legend_options.dart │ │ │ ├── datum_legend_with_measures.dart │ │ │ ├── default_hidden_series_legend.dart │ │ │ ├── legend_custom_symbol.dart │ │ │ ├── legends_gallery.dart │ │ │ ├── series_legend_options.dart │ │ │ ├── series_legend_with_measures.dart │ │ │ ├── simple_datum_legend.dart │ │ │ └── simple_series_legend.dart │ │ ├── line_chart │ │ │ ├── animation_zoom.dart │ │ │ ├── area_and_line.dart │ │ │ ├── dash_pattern.dart │ │ │ ├── line_annotation.dart │ │ │ ├── line_gallery.dart │ │ │ ├── points.dart │ │ │ ├── range_annotation.dart │ │ │ ├── range_annotation_margin.dart │ │ │ ├── segments.dart │ │ │ ├── simple.dart │ │ │ ├── simple_nulls.dart │ │ │ ├── stacked_area.dart │ │ │ ├── stacked_area_custom_color.dart │ │ │ └── stacked_area_nulls.dart │ │ ├── main.dart │ │ ├── original.dart │ │ ├── picker │ │ │ ├── animated_item_grid.dart │ │ │ ├── data.dart │ │ │ ├── full_screen_sample.dart │ │ │ ├── iterable_extensions.dart │ │ │ ├── model.dart │ │ │ ├── tag_item_selector.dart │ │ │ ├── tag_selection_screen.dart │ │ │ └── tagged_item.dart │ │ ├── pie_chart │ │ │ ├── auto_label.dart │ │ │ ├── donut.dart │ │ │ ├── gauge.dart │ │ │ ├── outside_label.dart │ │ │ ├── partial_pie.dart │ │ │ ├── pie_gallery.dart │ │ │ └── simple.dart │ │ ├── scatter_plot_chart │ │ │ ├── animation_zoom.dart │ │ │ ├── bucketing_axis.dart │ │ │ ├── comparison_points.dart │ │ │ ├── scatter_plot_gallery.dart │ │ │ ├── shapes.dart │ │ │ └── simple.dart │ │ └── time_series_chart │ │ │ ├── confidence_interval.dart │ │ │ ├── end_points_axis.dart │ │ │ ├── line_annotation.dart │ │ │ ├── range_annotation.dart │ │ │ ├── range_annotation_margin.dart │ │ │ ├── simple.dart │ │ │ ├── symbol_annotation.dart │ │ │ ├── time_series_gallery.dart │ │ │ └── with_bar_renderer.dart │ ├── linux │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── flutter │ │ │ ├── CMakeLists.txt │ │ │ ├── generated_plugin_registrant.cc │ │ │ ├── generated_plugin_registrant.h │ │ │ └── generated_plugins.cmake │ │ ├── main.cc │ │ ├── my_application.cc │ │ └── my_application.h │ ├── macos │ │ ├── .gitignore │ │ ├── Flutter │ │ │ ├── Flutter-Debug.xcconfig │ │ │ ├── Flutter-Release.xcconfig │ │ │ └── GeneratedPluginRegistrant.swift │ │ ├── Runner.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ └── xcshareddata │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ ├── Runner.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── Runner │ │ │ ├── AppDelegate.swift │ │ │ ├── Assets.xcassets │ │ │ │ └── AppIcon.appiconset │ │ │ │ │ ├── Contents.json │ │ │ │ │ ├── app_icon_1024.png │ │ │ │ │ ├── app_icon_128.png │ │ │ │ │ ├── app_icon_16.png │ │ │ │ │ ├── app_icon_256.png │ │ │ │ │ ├── app_icon_32.png │ │ │ │ │ ├── app_icon_512.png │ │ │ │ │ └── app_icon_64.png │ │ │ ├── Base.lproj │ │ │ │ └── MainMenu.xib │ │ │ ├── Configs │ │ │ │ ├── AppInfo.xcconfig │ │ │ │ ├── Debug.xcconfig │ │ │ │ ├── Release.xcconfig │ │ │ │ └── Warnings.xcconfig │ │ │ ├── DebugProfile.entitlements │ │ │ ├── Info.plist │ │ │ ├── MainFlutterWindow.swift │ │ │ └── Release.entitlements │ │ └── RunnerTests │ │ │ └── RunnerTests.swift │ ├── pubspec.lock │ ├── pubspec.yaml │ ├── web │ │ ├── favicon.png │ │ ├── icons │ │ │ ├── Icon-192.png │ │ │ ├── Icon-512.png │ │ │ ├── Icon-maskable-192.png │ │ │ └── Icon-maskable-512.png │ │ ├── index.html │ │ ├── manifest.json │ │ └── serve.json │ └── windows │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── flutter │ │ ├── CMakeLists.txt │ │ ├── generated_plugin_registrant.cc │ │ ├── generated_plugin_registrant.h │ │ └── generated_plugins.cmake │ │ └── runner │ │ ├── CMakeLists.txt │ │ ├── Runner.rc │ │ ├── flutter_window.cpp │ │ ├── flutter_window.h │ │ ├── main.cpp │ │ ├── resource.h │ │ ├── resources │ │ └── app_icon.ico │ │ ├── runner.exe.manifest │ │ ├── utils.cpp │ │ ├── utils.h │ │ ├── win32_window.cpp │ │ └── win32_window.h ├── lib │ ├── flutter.dart │ └── src │ │ ├── bar_chart.dart │ │ ├── base_chart.dart │ │ ├── base_chart_state.dart │ │ ├── behaviors │ │ ├── a11y │ │ │ └── domain_a11y_explore_behavior.dart │ │ ├── calculation │ │ │ └── percent_injector.dart │ │ ├── chart_behavior.dart │ │ ├── chart_title │ │ │ └── chart_title.dart │ │ ├── domain_highlighter.dart │ │ ├── initial_selection.dart │ │ ├── legend │ │ │ ├── datum_legend.dart │ │ │ ├── legend.dart │ │ │ ├── legend_content_builder.dart │ │ │ ├── legend_entry_layout.dart │ │ │ ├── legend_layout.dart │ │ │ └── series_legend.dart │ │ ├── line_point_highlighter.dart │ │ ├── range_annotation.dart │ │ ├── select_nearest.dart │ │ ├── slider │ │ │ └── slider.dart │ │ ├── sliding_viewport.dart │ │ └── zoom │ │ │ ├── initial_hint_behavior.dart │ │ │ ├── pan_and_zoom_behavior.dart │ │ │ └── pan_behavior.dart │ │ ├── canvas │ │ ├── circle_sector_painter.dart │ │ ├── line_painter.dart │ │ ├── pie_painter.dart │ │ ├── point_painter.dart │ │ └── polygon_painter.dart │ │ ├── cartesian_chart.dart │ │ ├── chart_canvas.dart │ │ ├── chart_container.dart │ │ ├── chart_gesture_detector.dart │ │ ├── chart_state.dart │ │ ├── combo_chart │ │ └── combo_chart.dart │ │ ├── graphics_factory.dart │ │ ├── line_chart.dart │ │ ├── line_style.dart │ │ ├── pie_chart.dart │ │ ├── scatter_plot_chart.dart │ │ ├── selection_model_config.dart │ │ ├── symbol_renderer.dart │ │ ├── text_element.dart │ │ ├── text_style.dart │ │ ├── time_series_chart.dart │ │ ├── user_managed_state.dart │ │ ├── util.dart │ │ ├── util │ │ └── color.dart │ │ └── widget_layout_delegate.dart ├── minimum_os.bzl ├── pubspec.lock ├── pubspec.yaml └── test │ ├── behaviors │ └── legend │ │ └── legend_layout_test.dart │ ├── example_widget_tests │ └── example_test.dart │ ├── goldens │ ├── example_area_and_line_combo_chart.png │ ├── example_auto_label_donut_chart.png │ ├── example_bar_chart_with_custom_bar_radius.png │ ├── example_bar_chart_with_secondary_measure_axis.png │ ├── example_bar_chart_with_secondary_measure_axis_only.png │ ├── example_bucketing_axis_scatter_plot_chart.png │ ├── example_comparison_points_scatter_plot_chart.png │ ├── example_custom_axis_fonts.png │ ├── example_custom_formatter.png │ ├── example_custom_tick_count.png │ ├── example_dash_pattern_line_chart.png │ ├── example_disjoint_measure_axes.png │ ├── example_end_points_axis_time_series_chart.png │ ├── example_gridline_dash_pattern.png │ ├── example_grouped_bar_chart.png │ ├── example_grouped_bar_single_target_line_chart.png │ ├── example_grouped_bar_target_line_chart.png │ ├── example_grouped_fill_color_bar_chart.png │ ├── example_grouped_stacked_bar_chart.png │ ├── example_horizontal_bar_chart.png │ ├── example_horizontal_bar_chart_with_bar_labels.png │ ├── example_horizontal_bar_chart_with_custom_bar_labels.png │ ├── example_horizontal_bar_chart_with_secondary_measure_axis.png │ ├── example_horizontal_pattern_forward_hatch_bar_chart.png │ ├── example_integer_measure_ticks.png │ ├── example_label_alignment_axis.png │ ├── example_line_annotation_line_chart.png │ ├── example_line_annotation_on_time_series_chart.png │ ├── example_menu.png │ ├── example_no_axis.png │ ├── example_non-zero_bound_axis.png │ ├── example_null_data_line_chart.png │ ├── example_numeric_axis_with_initial_viewport.png │ ├── example_numeric_line_bar_combo_chart.png │ ├── example_numeric_line_points_combo_chart.png │ ├── example_ordinal_axis_with_initial_viewport.png │ ├── example_ordinal_combo_chart.png │ ├── example_outside_label_pie_chart.png │ ├── example_pan_and_zoom_line_chart.png │ ├── example_pan_and_zoom_scatter_plot_chart.png │ ├── example_partial_pie_chart.png │ ├── example_pattern_forward_hatch_bar_chart.png │ ├── example_points_line_chart.png │ ├── example_range_annotation_line_chart.png │ ├── example_range_annotation_margin_labels_line_chart.png │ ├── example_range_annotation_margin_labels_on_time_series_chart.png │ ├── example_range_annotation_on_time_series_chart.png │ ├── example_scatter_plot_combo_chart.png │ ├── example_segments_line_chart.png │ ├── example_short_ticks_axis.png │ ├── example_simple_bar_chart.png │ ├── example_simple_line_chart.png │ ├── example_simple_pie_chart.png │ ├── example_simple_scatter_plot_chart.png │ ├── example_simple_time_series_chart.png │ ├── example_spark_bar_chart.png │ ├── example_stacked_area_chart.png │ ├── example_stacked_area_custom_color_chart.png │ ├── example_stacked_area_with_nulls_chart.png │ ├── example_stacked_bar_chart.png │ ├── example_stacked_bar_target_line_chart.png │ ├── example_stacked_fill_color_bar_chart.png │ ├── example_stacked_horizontal_bar_chart.png │ ├── example_statically_provided_ticks.png │ ├── example_symbol_annotation_time_series_chart.png │ ├── example_time_series_chart.png │ ├── example_time_series_chart_with_bars.png │ ├── example_time_series_chart_with_confidence_interval.png │ ├── example_time_series_combo_chart.png │ ├── example_vertical_bar_chart_with_bar_labels.png │ ├── example_weight_pattern_bar_chart.png │ ├── example_weighted_pattern_bar_chart.png │ ├── golden_bar_chart.png │ ├── golden_bar_chart_after_selection.png │ ├── golden_bar_chart_before_selection.png │ ├── golden_bar_chart_custom_colors.png │ ├── golden_customized_bar_chart.png │ ├── golden_empty_bar_chart.png │ ├── golden_grouped_bar_chart.png │ ├── golden_large_dataset_bar_chart.png │ ├── golden_line_chart.png │ ├── golden_line_chart_custom_axis.png │ ├── golden_line_chart_with_points.png │ ├── golden_numeric_combo_chart.png │ ├── golden_ordinal_combo_chart.png │ ├── golden_rtl_bar_chart.png │ ├── golden_stacked_bar_chart.png │ ├── golden_time_series_chart.png │ ├── golden_time_series_chart_multiple.png │ ├── sliding_viewport_after_pan.png │ ├── sliding_viewport_initial.png │ ├── sliding_viewport_zoomed_in.png │ └── sliding_viewport_zoomed_out.png │ ├── test_functions.dart │ ├── text_element_test.dart │ ├── user_managed_state_test.dart │ ├── widget_layout_delegate_test.dart │ └── widget_tests │ ├── bar_chart_test.dart │ ├── chart_corner_cases_test.dart │ ├── chart_customization_test.dart │ ├── chart_interactions_test.dart │ ├── chart_widget_test.dart │ ├── sliding_viewport_on_selection_test.dart │ ├── user_managed_state_test.dart │ └── widget_layout_delegate_test.dart ├── cspell.config.yaml ├── generate_contributions.sh └── test.sh /.github/workflows/build_and_test.yml: -------------------------------------------------------------------------------- 1 | # cspell:words subosito 2 | name: build_and_test 3 | on: 4 | pull_request: 5 | branches: [main] 6 | workflow_dispatch: 7 | 8 | jobs: 9 | spell_check: 10 | name: 🔤 Check Spelling 11 | uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/spell_check.yml@v1 12 | with: 13 | config: cspell.config.yaml 14 | 15 | build: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - name: Checkout repository 19 | uses: actions/checkout@v4 20 | 21 | - uses: subosito/flutter-action@v2 22 | with: 23 | flutter-version: "${{ vars.FLUTTER_VERSION }}" 24 | channel: "stable" 25 | architecture: x64 26 | 27 | - name: Get Dependencies 28 | run: | 29 | for dir in charts_common charts_flutter charts_flutter/example; do 30 | cd $dir 31 | flutter pub get 32 | cd $GITHUB_WORKSPACE 33 | done 34 | 35 | - name: Analyze 36 | run: | 37 | for dir in charts_common charts_flutter charts_flutter/example; do 38 | cd $dir 39 | dart analyze --no-fatal-warnings 40 | cd $GITHUB_WORKSPACE 41 | done 42 | 43 | - name: Check Formatting 44 | run: | 45 | for dir in charts_common charts_flutter charts_flutter/example; do 46 | cd $dir 47 | dart format lib test --set-exit-if-changed 48 | cd $GITHUB_WORKSPACE 49 | done 50 | 51 | - name: Run Common Tests 52 | # TODO: don't skip any tests 53 | run: | 54 | cd charts_common 55 | flutter test --coverage --exclude-tags skip-file 56 | cd $GITHUB_WORKSPACE 57 | 58 | - name: Run UI Tests 59 | run: | 60 | cd charts_flutter 61 | flutter test --coverage 62 | 63 | - name: Check Test Coverage 64 | uses: VeryGoodOpenSource/very_good_coverage@v2 65 | with: 66 | path: 'charts_flutter/coverage/lcov.info' 67 | min_coverage: 53.1 68 | 69 | concurrency: 70 | group: ${{ github.workflow }}-${{ github.ref }} 71 | cancel-in-progress: true -------------------------------------------------------------------------------- /.github/workflows/deploy_wasm_to_pages.yml: -------------------------------------------------------------------------------- 1 | name: Deploy WASM to GitHub Pages 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | workflow_dispatch: 7 | 8 | permissions: 9 | contents: read 10 | pages: write 11 | id-token: write 12 | 13 | jobs: 14 | build-and-deploy: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - name: Checkout repository 18 | uses: actions/checkout@v4 19 | 20 | - name: Setup Flutter 21 | uses: subosito/flutter-action@v2 22 | with: 23 | flutter-version: "${{ vars.FLUTTER_VERSION }}" 24 | channel: "stable" 25 | architecture: x64 26 | 27 | - name: Get dependencies 28 | run: | 29 | cd charts_flutter/example 30 | flutter pub get 31 | 32 | - name: Build WASM 33 | run: | 34 | cd charts_flutter/example 35 | flutter build web --wasm --base-href /nimble_charts/ 36 | 37 | - name: Update COOP and COEP headers 38 | run: | 39 | echo ' 40 | { 41 | "headers": [ 42 | { 43 | "source": "**/*", 44 | "headers": [ 45 | { 46 | "key": "Cross-Origin-Embedder-Policy", 47 | "value": "credentialless" 48 | }, 49 | { 50 | "key": "Cross-Origin-Opener-Policy", 51 | "value": "same-origin" 52 | } 53 | ] 54 | } 55 | ] 56 | } 57 | ' > charts_flutter/example/build/web/_headers 58 | 59 | - name: Setup Pages 60 | uses: actions/configure-pages@v4 61 | 62 | - name: Upload artifact 63 | uses: actions/upload-pages-artifact@v3 64 | with: 65 | path: 'charts_flutter/example/build/web' 66 | 67 | - name: Deploy to GitHub Pages 68 | id: deployment 69 | uses: actions/deploy-pages@v4 -------------------------------------------------------------------------------- /.github/workflows/generate_goldens.yaml: -------------------------------------------------------------------------------- 1 | name: generate_goldens 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | permissions: 7 | contents: write 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | 13 | defaults: 14 | run: 15 | working-directory: charts_flutter 16 | 17 | permissions: 18 | contents: write 19 | 20 | steps: 21 | - name: Checkout repository 22 | uses: actions/checkout@v4 23 | 24 | - uses: subosito/flutter-action@v2 25 | with: 26 | flutter-version: "${{ vars.FLUTTER_VERSION }}" 27 | channel: "stable" 28 | architecture: x64 29 | 30 | - name: Get Dependencies 31 | run: flutter pub get 32 | 33 | - name: Remove previous goldens 34 | run: if [ -e "./test/goldens/*.png" ]; then rm -rf "./test/goldens/*.png"; fi 35 | 36 | - name: Run tests and update goldens 37 | id: verify_diff 38 | run: | 39 | flutter test --update-goldens 40 | git diff --quiet . || echo "changed=true" >> $GITHUB_OUTPUT 41 | 42 | - name: Commit Updated Goldens 43 | if: steps.verify_diff.outputs.changed == 'true' 44 | run: | 45 | git config --local user.email "github-actions[bot]@users.noreply.github.com" 46 | git config --local user.name "github-actions[bot]" 47 | git add . 48 | git commit -m "Updated goldens via Update Goldens pipeline" -a 49 | 50 | - name: Push Changes 51 | if: steps.verify_diff.outputs.changed == 'true' 52 | uses: ad-m/github-push-action@master 53 | with: 54 | github_token: ${{ secrets.GITHUB_TOKEN }} 55 | branch: ${{ github.ref }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .dart_tool/ 2 | .packages 3 | 4 | .bundle 5 | _site 6 | 7 | build/ 8 | **/ios/.generated/ 9 | **/ios/Flutter/Generated.xcconfig 10 | **/ios/Runner/GeneratedPluginRegistrant.* 11 | 12 | charts_flutter/coverage/ 13 | 14 | charts_flutter/.DS_Store 15 | 16 | charts_flutter/test/failures/ 17 | 18 | charts_flutter/test/widget_tests/failures/ 19 | 20 | charts_flutter/test/example_widget_tests/failures/ 21 | 22 | charts_flutter/test/.DS_Store 23 | 24 | charts_common/coverage/ 25 | 26 | charts_common/.DS_Store 27 | 28 | charts_common/test/chart/.DS_Store 29 | 30 | .DS_Store 31 | 32 | .idea/ 33 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | # Below is a list of people and organizations that have contributed 2 | # to the Charts project. Names should be added to the list like so: 3 | # 4 | # Name/Organization 5 | 6 | Google Inc. 7 | Christian Findlay/Nimblesite sales at nimblesite.co -------------------------------------------------------------------------------- /charts.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts.gif -------------------------------------------------------------------------------- /charts_common/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # cspell:words runtimetype tostring bools 2 | include: package:austerity/analysis_options.yaml 3 | 4 | analyzer: 5 | errors: 6 | 7 | # Can't ignore these 8 | #argument_type_not_assignable: warning 9 | #return_of_invalid_type_from_closure: warning 10 | 11 | # Dangerous 12 | avoid_equals_and_hash_code_on_mutable_classes: warning 13 | avoid_dynamic_calls: warning 14 | inference_failure_on_collection_literal: warning 15 | inference_failure_on_instance_creation: warning 16 | inference_failure_on_function_invocation: warning 17 | 18 | # Probably OK 19 | unreachable_from_main: warning 20 | prefer_asserts_in_initializer_lists: warning 21 | avoid_classes_with_only_static_members: warning 22 | prefer_function_declarations_over_variables: warning 23 | overridden_fields: warning 24 | public_member_api_docs: warning 25 | avoid_setters_without_getters: warning 26 | constant_identifier_names: warning 27 | use_if_null_to_convert_nulls_to_bools: warning 28 | referenced_before_declaration: warning 29 | use_to_and_as_if_applicable: warning 30 | comment_references: warning 31 | prefer_asserts_with_message: warning 32 | no_default_cases: warning 33 | one_member_abstracts: warning 34 | join_return_with_assignment: warning 35 | use_setters_to_change_properties: warning 36 | unnecessary_null_comparison: warning 37 | prefer_null_aware_method_calls: warning 38 | parameter_assignments: warning 39 | 40 | use_late_for_private_fields_and_variables: ignore 41 | avoid_catches_without_on_clauses: ignore 42 | avoid_annotating_with_dynamic: ignore 43 | 44 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/bar/bar_chart.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/chart/bar/bar_renderer.dart' 17 | show BarRenderer; 18 | import 'package:nimble_charts_common/src/chart/cartesian/cartesian_chart.dart' 19 | show OrdinalCartesianChart; 20 | import 'package:nimble_charts_common/src/chart/common/series_renderer.dart' 21 | show SeriesRenderer; 22 | 23 | class BarChart extends OrdinalCartesianChart { 24 | BarChart({ 25 | super.vertical, 26 | super.layoutConfig, 27 | super.primaryMeasureAxis, 28 | super.secondaryMeasureAxis, 29 | super.disjointMeasureAxes, 30 | }); 31 | 32 | @override 33 | SeriesRenderer makeDefaultRenderer() => 34 | BarRenderer()..rendererId = SeriesRenderer.defaultRendererId; 35 | } 36 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/bar/bar_renderer_decorator.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'dart:math' show Rectangle; 17 | 18 | import 'package:nimble_charts_common/src/chart/bar/bar_renderer.dart' 19 | show ImmutableBarRendererElement; 20 | import 'package:nimble_charts_common/src/chart/common/chart_canvas.dart' 21 | show ChartCanvas; 22 | import 'package:nimble_charts_common/src/common/graphics_factory.dart' 23 | show GraphicsFactory; 24 | 25 | /// Decorates bars after the bars have already been painted. 26 | abstract class BarRendererDecorator { 27 | const BarRendererDecorator(); 28 | 29 | void decorate( 30 | Iterable> barElements, 31 | ChartCanvas canvas, 32 | GraphicsFactory graphicsFactory, { 33 | required Rectangle drawBounds, 34 | required double animationPercent, 35 | required bool renderingVertically, 36 | bool rtl = false, 37 | }); 38 | } 39 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/cartesian/axis/collision_report.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/chart/cartesian/axis/tick.dart' 17 | show Tick; 18 | 19 | /// A report that contains a list of ticks and if they collide. 20 | class CollisionReport { 21 | CollisionReport({ 22 | required this.ticksCollide, 23 | required List>? ticks, 24 | bool? alternateTicksUsed, 25 | }) : ticks = ticks ?? [], 26 | alternateTicksUsed = alternateTicksUsed ?? false; 27 | 28 | CollisionReport.empty() 29 | : ticksCollide = false, 30 | ticks = [], 31 | alternateTicksUsed = false; 32 | 33 | /// If [ticks] collide. 34 | final bool ticksCollide; 35 | 36 | final List> ticks; 37 | 38 | final bool alternateTicksUsed; 39 | } 40 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/cartesian/axis/ordinal_extents.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'dart:collection' show HashSet; 17 | 18 | import 'package:nimble_charts_common/src/chart/cartesian/axis/scale.dart' 19 | show Extents; 20 | 21 | /// A range of ordinals. 22 | class OrdinalExtents extends Extents { 23 | /// The extents representing the ordinal values in [range]. 24 | /// 25 | /// The elements of [range] must all be unique. 26 | OrdinalExtents(List range) : _range = range { 27 | // This asserts that all elements in [range] are unique. 28 | assert( 29 | () { 30 | final uniqueValueCount = HashSet.of(_range).length; 31 | return uniqueValueCount == range.length; 32 | }(), 33 | 'Ordinal values must be unique.', 34 | ); 35 | } 36 | 37 | factory OrdinalExtents.all(List range) => OrdinalExtents(range); 38 | final List _range; 39 | 40 | bool get isEmpty => _range.isEmpty; 41 | 42 | /// The number of values inside this extent. 43 | int get length => _range.length; 44 | 45 | String? operator [](int index) => _range[index]; 46 | 47 | int indexOf(String value) => _range.indexOf(value); 48 | } 49 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/cartesian/axis/ordinal_scale.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/chart/cartesian/axis/ordinal_scale_domain_info.dart' 17 | show OrdinalScaleDomainInfo; 18 | import 'package:nimble_charts_common/src/chart/cartesian/axis/scale.dart' 19 | show MutableScale; 20 | 21 | abstract class OrdinalScale extends MutableScale { 22 | /// The current domain collection with all added unique values. 23 | OrdinalScaleDomainInfo get domain; 24 | 25 | /// Sets the viewport of the scale based on the number of data points to show 26 | /// and the starting domain value. 27 | /// 28 | /// [viewportDataSize] How many ordinal domain values to show in the viewport. 29 | /// [startingDomain] The starting domain value of the viewport. Note that if 30 | /// the starting domain is in terms of position less than [domainValuesToShow] 31 | /// from the last domain value the viewport will be fixed to the last value 32 | /// and not guaranteed that this domain value is the first in the viewport. 33 | void setViewport(int? viewportDataSize, String? startingDomain); 34 | 35 | /// The number of full ordinal steps that fit in the viewport. 36 | int get viewportDataSize; 37 | 38 | /// The first fully visible ordinal step within the viewport. 39 | /// 40 | /// Start is defined by the leftmost domain for horizontal axes, and 41 | /// topmost domain for vertical axes. 42 | /// 43 | /// Null if no domains exist. 44 | String? get viewportStartingDomain; 45 | } 46 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/cartesian/axis/range_axis_tick.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/chart/cartesian/axis/axis_tick.dart' 17 | show AxisTicks; 18 | import 'package:nimble_charts_common/src/chart/cartesian/axis/range_tick.dart' 19 | show RangeTick; 20 | 21 | class RangeAxisTicks extends AxisTicks { 22 | RangeAxisTicks(RangeTick super.tick) 23 | : rangeStartValue = tick.rangeStartValue, 24 | rangeStartLocationPx = tick.rangeStartLocationPx, 25 | rangeEndValue = tick.rangeEndValue, 26 | rangeEndLocationPx = tick.rangeEndLocationPx; 27 | 28 | /// The value that this range tick starting point represents 29 | final D rangeStartValue; 30 | 31 | /// Position of the range tick starting point. 32 | double rangeStartLocationPx; 33 | 34 | /// The value that this range tick ending point represents. 35 | final D rangeEndValue; 36 | 37 | /// Position of the range tick ending point. 38 | double rangeEndLocationPx; 39 | } 40 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/cartesian/axis/range_tick.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/chart/cartesian/axis/tick.dart' 17 | show Tick; 18 | import 'package:nimble_charts_common/src/common/text_element.dart'; 19 | 20 | /// A labeled range on an axis. 21 | /// 22 | /// [D] is the type of the value this tick is associated with. 23 | class RangeTick extends Tick { 24 | RangeTick({ 25 | required super.value, 26 | required TextElement super.textElement, 27 | required this.rangeStartValue, 28 | required this.rangeStartLocationPx, 29 | required this.rangeEndValue, 30 | required this.rangeEndLocationPx, 31 | super.locationPx, 32 | super.labelOffsetPx, 33 | }); 34 | 35 | /// The value that this range tick starting point represents 36 | final D rangeStartValue; 37 | 38 | /// Position of the range tick starting point. 39 | double rangeStartLocationPx; 40 | 41 | /// The value that this range tick ending point represents. 42 | final D rangeEndValue; 43 | 44 | /// Position of the range tick ending point. 45 | double rangeEndLocationPx; 46 | 47 | @override 48 | String toString() => 'RangeTick(value: $value, locationPx: $locationPx, ' 49 | 'labelOffsetPx: $labelOffsetPx, rangeStartValue: $rangeStartValue, ' 50 | 'rangeStartLocationPx: $rangeStartLocationPx, ' 51 | 'rangeEndValue: $rangeEndValue, ' 52 | 'rangeEndLocationPx: $rangeEndLocationPx)'; 53 | } 54 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/cartesian/axis/spec/range_tick_spec.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/chart/cartesian/axis/spec/tick_spec.dart' 17 | show TickSpec; 18 | 19 | /// Definition for a range tick. 20 | /// 21 | /// Used to define a tick that is used by range tick provider. 22 | class RangeTickSpec extends TickSpec { 23 | /// Creates a range tick for [value]. 24 | /// A [label] optionally labels this tick. If not set, the tick formatter 25 | /// formatter of the axis is used. 26 | /// A [style] optionally sets the style for this tick. If not set, the style 27 | /// of the axis is used. 28 | /// A [rangeStartValue] represents value of this range tick's starting point. 29 | /// A [rangeEndValue] represents the value of this range tick's ending point. 30 | const RangeTickSpec( 31 | super.value, { 32 | required this.rangeStartValue, 33 | required this.rangeEndValue, 34 | super.label, 35 | super.style, 36 | }); 37 | final D rangeStartValue; 38 | final D rangeEndValue; 39 | } 40 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/cartesian/axis/spec/tick_spec.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/chart/cartesian/axis/spec/axis_spec.dart' 17 | show TextStyleSpec; 18 | 19 | /// Definition for a tick. 20 | /// 21 | /// Used to define a tick that is used by static tick provider. 22 | class TickSpec { 23 | /// [value] the value of this tick 24 | /// [label] optional label for this tick. If not set, uses the tick formatter 25 | /// of the axis. 26 | /// [style] optional style for this tick. If not set, uses the style of the 27 | /// axis. 28 | const TickSpec(this.value, {this.label, this.style}); 29 | final D value; 30 | final String? label; 31 | final TextStyleSpec? style; 32 | } 33 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/cartesian/axis/tick.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/common/text_element.dart'; 17 | 18 | /// A labeled point on an axis. 19 | /// 20 | /// [D] is the type of the value this tick is associated with. 21 | class Tick { 22 | Tick({ 23 | required this.value, 24 | required this.textElement, 25 | this.locationPx, 26 | this.labelOffsetPx, 27 | }); 28 | 29 | /// The value that this tick represents 30 | final D value; 31 | 32 | /// [TextElement] for this tick. 33 | TextElement? textElement; 34 | 35 | /// Location on the axis where this tick is rendered (in canvas coordinates). 36 | double? locationPx; 37 | 38 | /// Offset of the label for this tick from its location. 39 | /// 40 | /// This is a vertical offset for ticks on a vertical axis, or horizontal 41 | /// offset for ticks on a horizontal axis. 42 | double? labelOffsetPx; 43 | 44 | @override 45 | String toString() => 'Tick(value: $value, locationPx: $locationPx, ' 46 | 'labelOffsetPx: $labelOffsetPx)'; 47 | } 48 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/cartesian/axis/time/date_time_extents.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/chart/cartesian/axis/scale.dart' 17 | show Extents; 18 | 19 | class DateTimeExtents extends Extents { 20 | DateTimeExtents({required this.start, required this.end}); 21 | final DateTime start; 22 | final DateTime end; 23 | 24 | @override 25 | bool operator ==(Object other) => 26 | other is DateTimeExtents && start == other.start && end == other.end; 27 | 28 | @override 29 | int get hashCode => start.hashCode + (end.hashCode * 37); 30 | } 31 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/cartesian/axis/time/hour_tick_formatter.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:intl/intl.dart' show DateFormat; 17 | import 'package:nimble_charts_common/src/chart/cartesian/axis/time/time_tick_formatter_impl.dart' 18 | show CalendarField, TimeTickFormatterImpl; 19 | import 'package:nimble_charts_common/src/common/date_time_factory.dart'; 20 | 21 | /// Hour specific tick formatter which will format noon differently. 22 | class HourTickFormatter extends TimeTickFormatterImpl { 23 | HourTickFormatter({ 24 | required DateTimeFactory dateTimeFactory, 25 | required super.simpleFormat, 26 | required super.transitionFormat, 27 | required String? noonFormat, 28 | }) : super( 29 | dateTimeFactory: dateTimeFactory, 30 | transitionField: CalendarField.date, 31 | ) { 32 | _noonFormat = dateTimeFactory.createDateFormat(noonFormat); 33 | } 34 | late final DateFormat _noonFormat; 35 | 36 | @override 37 | String formatSimpleTick(DateTime date) => (date.hour == 12) 38 | ? _noonFormat.format(date) 39 | : super.formatSimpleTick(date); 40 | } 41 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/cartesian/axis/time/simple_time_tick_formatter.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/chart/cartesian/axis/time/time_tick_formatter.dart' 17 | show TimeTickFormatter; 18 | 19 | typedef DateTimeFormatterFunction = String Function(DateTime datetime); 20 | 21 | /// Formatter that formats all ticks using a single [DateTimeFormatterFunction]. 22 | class SimpleTimeTickFormatter implements TimeTickFormatter { 23 | SimpleTimeTickFormatter({required this.formatter}); 24 | DateTimeFormatterFunction formatter; 25 | 26 | @override 27 | String formatFirstTick(DateTime date) => formatter(date); 28 | 29 | @override 30 | String formatSimpleTick(DateTime date) => formatter(date); 31 | 32 | @override 33 | String formatTransitionTick(DateTime date) => formatter(date); 34 | 35 | // Transition fields don't matter here. 36 | @override 37 | bool isTransition(DateTime tickValue, DateTime prevTickValue) => false; 38 | } 39 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/cartesian/axis/time/time_range_tick_provider.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/common.dart'; 17 | import 'package:nimble_charts_common/src/chart/cartesian/axis/tick_provider.dart' 18 | show BaseTickProvider; 19 | 20 | /// Provides ticks for a particular time unit. 21 | /// 22 | /// Used by [AutoAdjustingDateTimeTickProvider]. 23 | abstract class TimeRangeTickProvider extends BaseTickProvider { 24 | /// Returns if this tick provider will produce a sufficient number of ticks 25 | /// for [domainExtents]. 26 | bool providesSufficientTicksForRange(DateTimeExtents domainExtents); 27 | 28 | /// Find the closet step size, from provided step size, in milliseconds. 29 | int getClosestStepSize(int stepSize); 30 | } 31 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/cartesian/axis/time/time_tick_formatter.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | /// Formatter of [DateTime] ticks 17 | abstract class TimeTickFormatter { 18 | /// Format for tick that is the first in a set of ticks. 19 | String formatFirstTick(DateTime date); 20 | 21 | /// Format for a 'simple' tick. 22 | /// 23 | /// Ex. Not a first tick or transition tick. 24 | String formatSimpleTick(DateTime date); 25 | 26 | /// Format for a transitional tick. 27 | String formatTransitionTick(DateTime date); 28 | 29 | /// Returns true if tick is a transitional tick. 30 | bool isTransition(DateTime tickValue, DateTime prevTickValue); 31 | } 32 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/common/behavior/a11y/a11y_node.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'dart:math' show Rectangle; 17 | 18 | typedef OnFocus = void Function(); 19 | 20 | /// Container for accessibility data. 21 | class A11yNode { 22 | A11yNode(this.label, this.boundingBox, {this.onFocus}); 23 | 24 | /// The bounding box for this node. 25 | final Rectangle boundingBox; 26 | 27 | /// The textual description of this node. 28 | final String label; 29 | 30 | /// Callback when the A11yNode is focused by the native platform 31 | OnFocus? onFocus; 32 | } 33 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/common/behavior/selection/selection_trigger.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | enum SelectionTrigger { 17 | hover, 18 | tap, 19 | tapAndDrag, 20 | pressHold, 21 | longPressHold, 22 | } 23 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/common/series_renderer_config.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/chart/common/series_renderer.dart' 17 | show SeriesRenderer; 18 | import 'package:nimble_charts_common/src/common/symbol_renderer.dart'; 19 | import 'package:nimble_charts_common/src/common/typed_registry.dart'; 20 | 21 | /// Interface for series renderer configuration. 22 | abstract class SeriesRendererConfig { 23 | /// Stores typed renderer attributes 24 | /// 25 | /// This is useful for storing attributes that is used on the native platform. 26 | /// Such as the SymbolRenderer that is associated with each renderer but is 27 | /// a native builder since legend is built natively. 28 | RendererAttributes get rendererAttributes; 29 | 30 | String? get customRendererId; 31 | 32 | SymbolRenderer? get symbolRenderer; 33 | 34 | SeriesRenderer build(); 35 | } 36 | 37 | class RendererAttributeKey extends TypedKey { 38 | const RendererAttributeKey(super.uniqueKey); 39 | } 40 | 41 | class RendererAttributes extends TypedRegistry {} 42 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/common/unitconverter/identity_converter.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/chart/common/unitconverter/unit_converter.dart' 17 | show UnitConverter; 18 | 19 | /// A No op unit converter. 20 | class IdentityConverter implements UnitConverter { 21 | const IdentityConverter(); 22 | 23 | @override 24 | U convert(U value) => value; 25 | 26 | @override 27 | U invert(U value) => value; 28 | } 29 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/common/unitconverter/unit_converter.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | /// Converts a num value in the 'from' unit to a num value in the 'to' unit. 17 | /// 18 | /// [F] Type of the value in the 'from' units. 19 | /// [T] Type of the value in 'to' units. 20 | abstract class UnitConverter { 21 | /// Converts 'from' unit value to the 'to' unit value. 22 | T convert(F value); 23 | 24 | /// Converts 'to' unit value back to the 'from' unit value. 25 | F invert(T value); 26 | } 27 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/line/line_chart.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/chart/cartesian/cartesian_chart.dart' 17 | show NumericCartesianChart; 18 | import 'package:nimble_charts_common/src/chart/common/series_renderer.dart' 19 | show SeriesRenderer; 20 | import 'package:nimble_charts_common/src/chart/line/line_renderer.dart' 21 | show LineRenderer; 22 | 23 | class LineChart extends NumericCartesianChart { 24 | LineChart({ 25 | super.vertical, 26 | super.layoutConfig, 27 | super.primaryMeasureAxis, 28 | super.secondaryMeasureAxis, 29 | super.disjointMeasureAxes, 30 | }); 31 | 32 | @override 33 | SeriesRenderer makeDefaultRenderer() => 34 | LineRenderer()..rendererId = SeriesRenderer.defaultRendererId; 35 | } 36 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/link/link_chart.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2021 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/chart/common/base_chart.dart'; 17 | import 'package:nimble_charts_common/src/chart/common/datum_details.dart'; 18 | import 'package:nimble_charts_common/src/chart/common/selection_model/selection_model.dart'; 19 | import 'package:nimble_charts_common/src/chart/common/series_renderer.dart'; 20 | import 'package:nimble_charts_common/src/chart/layout/layout_config.dart'; 21 | 22 | import 'package:nimble_charts_common/src/chart/link/link_renderer.dart'; 23 | 24 | class LinkChart extends BaseChart { 25 | LinkChart({LayoutConfig? layoutConfig}) 26 | : super(layoutConfig: layoutConfig ?? LayoutConfig()); 27 | 28 | /// Uses LinkRenderer as the default renderer. 29 | @override 30 | SeriesRenderer makeDefaultRenderer() => 31 | LinkRenderer()..rendererId = SeriesRenderer.defaultRendererId; 32 | 33 | /// Returns a list of datum details from the selection model of [type]. 34 | @override 35 | List> getDatumDetails(SelectionModelType type) => 36 | >[]; 37 | } 38 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/link/link_renderer_config.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2021 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/chart/common/series_renderer_config.dart'; 17 | import 'package:nimble_charts_common/src/chart/layout/layout_view.dart'; 18 | import 'package:nimble_charts_common/src/chart/link/link_renderer.dart'; 19 | import 'package:nimble_charts_common/src/chart/sankey/sankey_renderer.dart'; 20 | import 'package:nimble_charts_common/src/common/symbol_renderer.dart'; 21 | 22 | /// Configuration for a [SankeyRenderer]. 23 | class LinkRendererConfig extends LayoutViewConfig 24 | implements SeriesRendererConfig { 25 | LinkRendererConfig({ 26 | this.customRendererId, 27 | this.layoutPaintOrder = LayoutViewPaintOrder.bar, 28 | SymbolRenderer? symbolRenderer, 29 | }) : symbolRenderer = symbolRenderer ?? RectSymbolRenderer(); 30 | @override 31 | final String? customRendererId; 32 | 33 | @override 34 | final SymbolRenderer symbolRenderer; 35 | 36 | @override 37 | final rendererAttributes = RendererAttributes(); 38 | 39 | /// The order to paint this renderer on the canvas. 40 | final int layoutPaintOrder; 41 | 42 | @override 43 | LinkRenderer build() => 44 | LinkRenderer(config: this, rendererId: customRendererId); 45 | } 46 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/pie/arc_renderer_config.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/chart/pie/arc_renderer.dart' 17 | show ArcRenderer; 18 | import 'package:nimble_charts_common/src/chart/pie/base_arc_renderer_config.dart' 19 | show BaseArcRendererConfig; 20 | 21 | /// Configuration for an [ArcRenderer]. 22 | class ArcRendererConfig extends BaseArcRendererConfig { 23 | ArcRendererConfig({ 24 | super.customRendererId, 25 | super.arcLength, 26 | super.arcRendererDecorators, 27 | super.arcRatio, 28 | super.arcWidth, 29 | super.layoutPaintOrder, 30 | super.minHoleWidthForCenterContent, 31 | super.startAngle, 32 | super.strokeWidthPx, 33 | }); 34 | 35 | @override 36 | ArcRenderer build() => 37 | ArcRenderer(config: this, rendererId: customRendererId); 38 | } 39 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/pie/arc_renderer_decorator.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'dart:math' show Rectangle; 17 | 18 | import 'package:nimble_charts_common/src/chart/common/chart_canvas.dart' 19 | show ChartCanvas; 20 | import 'package:nimble_charts_common/src/chart/pie/arc_renderer_element.dart' 21 | show ArcRendererElementList; 22 | import 'package:nimble_charts_common/src/common/graphics_factory.dart' 23 | show GraphicsFactory; 24 | 25 | /// Decorates arcs after the arcs have already been painted. 26 | abstract class ArcRendererDecorator { 27 | const ArcRendererDecorator(); 28 | 29 | /// Configures whether the decorator should be rendered on top of or below 30 | /// series data elements. 31 | bool get renderAbove; 32 | 33 | void decorate( 34 | List> arcElementsList, 35 | ChartCanvas canvas, 36 | GraphicsFactory graphicsFactory, { 37 | required Rectangle drawBounds, 38 | required double animationPercent, 39 | bool rtl = false, 40 | }); 41 | } 42 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/sankey/sankey_chart.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2021 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/chart/common/base_chart.dart'; 17 | import 'package:nimble_charts_common/src/chart/common/datum_details.dart'; 18 | import 'package:nimble_charts_common/src/chart/common/selection_model/selection_model.dart'; 19 | import 'package:nimble_charts_common/src/chart/common/series_renderer.dart'; 20 | import 'package:nimble_charts_common/src/chart/layout/layout_config.dart'; 21 | 22 | import 'package:nimble_charts_common/src/chart/sankey/sankey_renderer.dart'; 23 | 24 | class SankeyChart extends BaseChart { 25 | SankeyChart({LayoutConfig? layoutConfig}) 26 | : super(layoutConfig: layoutConfig ?? LayoutConfig()); 27 | 28 | /// Uses SankeyRenderer as the default renderer. 29 | @override 30 | SeriesRenderer makeDefaultRenderer() => 31 | SankeyRenderer()..rendererId = SeriesRenderer.defaultRendererId; 32 | 33 | /// Returns a list of datum details from the selection model of [type]. 34 | @override 35 | List> getDatumDetails(SelectionModelType type) => 36 | >[]; 37 | } 38 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/sankey/sankey_renderer_config.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2021 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/chart/common/series_renderer_config.dart'; 17 | import 'package:nimble_charts_common/src/chart/layout/layout_view.dart'; 18 | import 'package:nimble_charts_common/src/chart/sankey/sankey_renderer.dart'; 19 | import 'package:nimble_charts_common/src/common/symbol_renderer.dart'; 20 | 21 | /// Configuration for a [SankeyRenderer]. 22 | class SankeyRendererConfig extends LayoutViewConfig 23 | implements SeriesRendererConfig { 24 | SankeyRendererConfig({ 25 | this.customRendererId, 26 | this.layoutPaintOrder = LayoutViewPaintOrder.sankey, 27 | SymbolRenderer? symbolRenderer, 28 | }) : symbolRenderer = symbolRenderer ?? RectSymbolRenderer(); 29 | @override 30 | final String? customRendererId; 31 | 32 | @override 33 | final SymbolRenderer symbolRenderer; 34 | 35 | @override 36 | final rendererAttributes = RendererAttributes(); 37 | 38 | /// The order to paint this renderer on the canvas. 39 | final int layoutPaintOrder; 40 | 41 | @override 42 | SankeyRenderer build() => 43 | SankeyRenderer(config: this, rendererId: customRendererId); 44 | } 45 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/scatter_plot/point_renderer_decorator.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'dart:math' show Rectangle; 17 | 18 | import 'package:nimble_charts_common/src/chart/common/chart_canvas.dart' 19 | show ChartCanvas; 20 | import 'package:nimble_charts_common/src/chart/scatter_plot/point_renderer.dart' 21 | show PointRendererElement; 22 | import 'package:nimble_charts_common/src/common/graphics_factory.dart' 23 | show GraphicsFactory; 24 | 25 | /// Decorates points after the points have already been painted. 26 | abstract class PointRendererDecorator { 27 | const PointRendererDecorator(); 28 | 29 | /// Configures whether the decorator should be rendered on top of or below 30 | /// series data elements. 31 | bool get renderAbove; 32 | 33 | void decorate( 34 | PointRendererElement pointElement, 35 | ChartCanvas canvas, 36 | GraphicsFactory graphicsFactory, { 37 | required Rectangle drawBounds, 38 | required double animationPercent, 39 | bool rtl = false, 40 | }); 41 | } 42 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/treemap/dice_treemap_renderer.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/chart/treemap/base_treemap_renderer.dart'; 17 | import 'package:nimble_charts_common/src/chart/treemap/treemap_renderer_config.dart'; 18 | import 'package:nimble_charts_common/src/data/tree.dart'; 19 | 20 | /// A treemap renderer that renders a treemap with dice layout. 21 | class DiceTreeMapRenderer extends BaseTreeMapRenderer { 22 | DiceTreeMapRenderer({String? rendererId, TreeMapRendererConfig? config}) 23 | : super( 24 | config: 25 | config ?? TreeMapRendererConfig(tileType: TreeMapTileType.dice), 26 | rendererId: rendererId ?? BaseTreeMapRenderer.defaultRendererId, 27 | ); 28 | 29 | /// Uses dicing as the tiling algorithm for this tree map. 30 | @override 31 | void tile(TreeNode node) { 32 | final children = node.children; 33 | if (children.isNotEmpty) { 34 | final rect = availableLayoutBoundingRect(node); 35 | final measure = measureForTreeNode(node); 36 | final scaleFactor = measure == 0 ? 0 : areaForRectangle(rect) / measure; 37 | scaleArea(children, scaleFactor); 38 | position(children, rect, rect.height, areaForRectangle(rect)); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/treemap/slice_dice_treemap_renderer.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/chart/treemap/base_treemap_renderer.dart'; 17 | import 'package:nimble_charts_common/src/chart/treemap/treemap_renderer_config.dart'; 18 | import 'package:nimble_charts_common/src/data/tree.dart'; 19 | 20 | /// A treemap renderer that renders a treemap with slice-and-dice layout. 21 | class SliceDiceTreeMapRenderer extends BaseTreeMapRenderer { 22 | SliceDiceTreeMapRenderer({ 23 | String? rendererId, 24 | TreeMapRendererConfig? config, 25 | }) : super( 26 | config: config ?? 27 | TreeMapRendererConfig(tileType: TreeMapTileType.sliceDice), 28 | rendererId: rendererId ?? BaseTreeMapRenderer.defaultRendererId, 29 | ); 30 | 31 | /// Uses slice-and-dice as the tiling algorithm for this tree map. 32 | @override 33 | void tile(TreeNode node) { 34 | final children = node.children; 35 | if (children.isNotEmpty) { 36 | final rect = availableLayoutBoundingRect(node); 37 | final measure = measureForTreeNode(node); 38 | final scaleFactor = measure == 0 ? 0 : areaForRectangle(rect) / measure; 39 | scaleArea(children, scaleFactor); 40 | position( 41 | children, 42 | rect, 43 | node.depth & 1 == 1 ? rect.height : rect.width, 44 | areaForRectangle(rect), 45 | ); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/treemap/slice_treemap_renderer.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/chart/treemap/base_treemap_renderer.dart'; 17 | import 'package:nimble_charts_common/src/chart/treemap/treemap_renderer_config.dart'; 18 | import 'package:nimble_charts_common/src/data/tree.dart'; 19 | 20 | /// A treemap renderer that renders a treemap with slice layout. 21 | class SliceTreeMapRenderer extends BaseTreeMapRenderer { 22 | SliceTreeMapRenderer({String? rendererId, TreeMapRendererConfig? config}) 23 | : super( 24 | config: 25 | config ?? TreeMapRendererConfig(tileType: TreeMapTileType.slice), 26 | rendererId: rendererId ?? BaseTreeMapRenderer.defaultRendererId, 27 | ); 28 | 29 | /// Uses slicing as the tiling algorithm for this tree map. 30 | @override 31 | void tile(TreeNode node) { 32 | final children = node.children; 33 | if (children.isNotEmpty) { 34 | final rect = availableLayoutBoundingRect(node); 35 | final measure = measureForTreeNode(node); 36 | final scaleFactor = measure == 0 ? 0 : areaForRectangle(rect) / measure; 37 | scaleArea(children, scaleFactor); 38 | position(children, rect, rect.width, areaForRectangle(rect)); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /charts_common/lib/src/chart/treemap/treemap_renderer_decorator.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'dart:math' show Rectangle; 17 | 18 | import 'package:nimble_charts_common/src/chart/common/chart_canvas.dart'; 19 | import 'package:nimble_charts_common/src/chart/treemap/treemap_renderer_element.dart'; 20 | import 'package:nimble_charts_common/src/common/graphics_factory.dart'; 21 | 22 | /// Decorator that gets rendered after [TreeMapRendererElement]s are rendered. 23 | abstract class TreeMapRendererDecorator { 24 | const TreeMapRendererDecorator(); 25 | 26 | /// Paints decorator on top of [rendererElement]. 27 | void decorate( 28 | TreeMapRendererElement rendererElement, 29 | ChartCanvas canvas, 30 | GraphicsFactory graphicsFactory, { 31 | required Rectangle drawBounds, 32 | required double animationPercent, 33 | bool rtl = false, 34 | bool renderVertically = false, 35 | bool renderMultiline = false, 36 | }); 37 | } 38 | -------------------------------------------------------------------------------- /charts_common/lib/src/common/graphics_factory.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/common/line_style.dart' show LineStyle; 17 | import 'package:nimble_charts_common/src/common/text_element.dart' 18 | show TextElement; 19 | import 'package:nimble_charts_common/src/common/text_style.dart' show TextStyle; 20 | 21 | /// Interface to native platform graphics functions. 22 | abstract class GraphicsFactory { 23 | LineStyle createLinePaint(); 24 | 25 | /// Returns a [TextStyle] object. 26 | TextStyle createTextPaint(); 27 | 28 | /// Returns a text element from [text]. 29 | TextElement createTextElement(String text); 30 | } 31 | -------------------------------------------------------------------------------- /charts_common/lib/src/common/line_style.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/common/paint_style.dart' 17 | show PaintStyle; 18 | 19 | abstract class LineStyle extends PaintStyle { 20 | List? get dashPattern; 21 | set dashPattern(List? dashPattern); 22 | 23 | int get strokeWidth; 24 | set strokeWidth(int strokeWidth); 25 | } 26 | -------------------------------------------------------------------------------- /charts_common/lib/src/common/paint_style.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/common/color.dart'; 17 | 18 | /// Style properties of a paintable object. 19 | abstract class PaintStyle { 20 | Color? get color; 21 | 22 | set color(Color? value); 23 | } 24 | -------------------------------------------------------------------------------- /charts_common/lib/src/common/performance.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | typedef PerformanceCallback = void Function(String tag); 17 | 18 | class Performance { 19 | static PerformanceCallback time = (_) {}; 20 | static PerformanceCallback timeEnd = (_) {}; 21 | } 22 | -------------------------------------------------------------------------------- /charts_common/lib/src/common/style/style_factory.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/common/style/material_style.dart' 17 | show MaterialStyle; 18 | import 'package:nimble_charts_common/src/common/style/style.dart' show Style; 19 | 20 | class StyleFactory { 21 | StyleFactory._internal(); 22 | static final StyleFactory _styleFactory = StyleFactory._internal(); 23 | 24 | Style _style = const MaterialStyle(); 25 | 26 | /// The [Style] that is used for all the charts in this application. 27 | static Style get style => _styleFactory._style; 28 | 29 | static set style(Style value) { 30 | _styleFactory._style = value; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /charts_common/lib/src/common/text_measurement.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | /// A measurement result for rendering text. 17 | class TextMeasurement { 18 | TextMeasurement({ 19 | required this.horizontalSliceWidth, 20 | required this.verticalSliceWidth, 21 | this.baseline, 22 | }); 23 | 24 | /// Rendered width of the text. 25 | final double horizontalSliceWidth; 26 | 27 | /// Vertical slice is likely based off the rendered text. 28 | /// 29 | /// This means that 'mo' and 'My' will have different heights so do not use 30 | /// this for centering vertical text. 31 | final double verticalSliceWidth; 32 | 33 | /// Baseline of the text for text vertical alignment. 34 | final double? baseline; 35 | } 36 | -------------------------------------------------------------------------------- /charts_common/lib/src/common/text_style.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/common/paint_style.dart' 17 | show PaintStyle; 18 | 19 | /// Paint properties of a text. 20 | abstract class TextStyle extends PaintStyle { 21 | int? get fontSize; 22 | set fontSize(int? value); 23 | 24 | String? get fontFamily; 25 | set fontFamily(String? fontFamily); 26 | 27 | double? get lineHeight; 28 | set lineHeight(double? value); 29 | 30 | String? get fontWeight; 31 | set fontWeight(String? value); 32 | } 33 | -------------------------------------------------------------------------------- /charts_common/lib/src/common/typed_registry.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | class TypedRegistry { 17 | final _registry = , Object?>{}; 18 | 19 | R? getAttr(TypedKey key) => _registry[key] as R?; 20 | 21 | void setAttr(TypedKey key, R value) { 22 | _registry[key] = value; 23 | } 24 | 25 | void mergeFrom(TypedRegistry other) { 26 | _registry.addAll(other._registry); 27 | } 28 | } 29 | 30 | class TypedKey { 31 | const TypedKey(this.uniqueKey); 32 | final String uniqueKey; 33 | 34 | @override 35 | int get hashCode => uniqueKey.hashCode; 36 | 37 | @override 38 | bool operator ==(Object other) => 39 | other is TypedKey && uniqueKey == other.uniqueKey; 40 | } 41 | -------------------------------------------------------------------------------- /charts_common/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: nimble_charts_common 2 | version: 0.5.0-beta 3 | description: Charts for Dart. A fork of charts_common 4 | homepage: https://github.com/Nimblesite/nimble_charts 5 | 6 | environment: 7 | sdk: '>=3.0.0 <4.0.0' 8 | 9 | dependencies: 10 | collection: ^1.14.5 11 | intl: ^0.20.1 12 | meta: ^1.1.1 13 | vector_math: ^2.0.8 14 | 15 | dev_dependencies: 16 | austerity: ^1.2.0 17 | build_runner: ^2.4.12 18 | mockito: ^5.4.4 19 | test: ^1.5.3 20 | -------------------------------------------------------------------------------- /charts_common/test/chart/cartesian/axis/time/simple_date_time_factory.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:intl/intl.dart' show DateFormat; 17 | import 'package:nimble_charts_common/src/common/date_time_factory.dart'; 18 | 19 | /// Returns DateTime for testing. 20 | class SimpleDateTimeFactory implements DateTimeFactory { 21 | const SimpleDateTimeFactory(); 22 | 23 | @override 24 | DateTime createDateTimeFromMilliSecondsSinceEpoch( 25 | int millisecondsSinceEpoch, 26 | ) => 27 | DateTime.fromMillisecondsSinceEpoch(millisecondsSinceEpoch); 28 | 29 | @override 30 | DateTime createDateTime( 31 | int year, [ 32 | int month = 1, 33 | int day = 1, 34 | int hour = 0, 35 | int minute = 0, 36 | int second = 0, 37 | int millisecond = 0, 38 | int microsecond = 0, 39 | ]) => 40 | DateTime( 41 | year, 42 | month, 43 | day, 44 | hour, 45 | minute, 46 | second, 47 | millisecond, 48 | microsecond, 49 | ); 50 | 51 | @override 52 | DateFormat createDateFormat(String? pattern) => DateFormat(pattern); 53 | } 54 | -------------------------------------------------------------------------------- /charts_common/test/chart/layout/layout_manager_impl_test.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/src/chart/layout/layout_config.dart'; 17 | import 'package:nimble_charts_common/src/chart/layout/layout_manager_impl.dart'; 18 | 19 | import 'package:test/test.dart'; 20 | 21 | void main() { 22 | test('default layout', () { 23 | final layout = LayoutManagerImpl()..measure(400, 300); 24 | 25 | expect(layout.marginTop, equals(0)); 26 | expect(layout.marginRight, equals(0)); 27 | expect(layout.marginBottom, equals(0)); 28 | expect(layout.marginLeft, equals(0)); 29 | }); 30 | 31 | test('all fixed margin', () { 32 | final layout = LayoutManagerImpl( 33 | config: LayoutConfig( 34 | topSpec: MarginSpec.fixedPixel(12), 35 | rightSpec: MarginSpec.fixedPixel(11), 36 | bottomSpec: MarginSpec.fixedPixel(10), 37 | leftSpec: MarginSpec.fixedPixel(9), 38 | ), 39 | )..measure(400, 300); 40 | 41 | expect(layout.marginTop, equals(12)); 42 | expect(layout.marginRight, equals(11)); 43 | expect(layout.marginBottom, equals(10)); 44 | expect(layout.marginLeft, equals(9)); 45 | }); 46 | } 47 | -------------------------------------------------------------------------------- /charts_common/test/mox.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: strict_raw_type 2 | 3 | import 'package:mockito/annotations.dart'; 4 | import 'package:nimble_charts_common/common.dart'; 5 | import 'package:nimble_charts_common/src/chart/cartesian/axis/numeric_tick_provider.dart'; 6 | import 'package:nimble_charts_common/src/chart/cartesian/axis/time/date_time_scale.dart'; 7 | 8 | // dart run build_runner build --delete-conflicting-outputs 9 | 10 | @GenerateNiceMocks([ 11 | MockSpec(), 12 | MockSpec(), 13 | MockSpec(), 14 | MockSpec>(as: #MockNumericTickFormatter), 15 | MockSpec(as: #MockDrawStrategy), 16 | MockSpec>(as: #MockTickDrawStrategy), 17 | MockSpec(), 18 | MockSpec(as: #MockCanvas), 19 | MockSpec(), 20 | MockSpec(as: #MockLinePaint), 21 | MockSpec(as: #MockNumericScale), 22 | MockSpec(as: #MockTextStyle), 23 | MockSpec(as: #MockChart), 24 | MockSpec(), 25 | MockSpec(), 26 | MockSpec(), 27 | MockSpec(as: #MockBehavior), 28 | MockSpec(), 29 | MockSpec(), 30 | ]) 31 | void main() {} 32 | -------------------------------------------------------------------------------- /charts_flutter/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | #cspell:words runtimetype tostring 2 | 3 | include: package:austerity/analysis_options.yaml 4 | 5 | analyzer: 6 | errors: 7 | 8 | unnecessary_import: error 9 | unused_shown_name: error 10 | 11 | # Can't ignore these 12 | #argument_type_not_assignable: warning 13 | #return_of_invalid_type_from_closure: warning 14 | 15 | # Dangerous 16 | deprecated_member_use: warning 17 | no_runtimetype_tostring: warning 18 | strict_raw_type: warning 19 | avoid_equals_and_hash_code_on_mutable_classes: warning 20 | avoid_dynamic_calls: warning 21 | inference_failure_on_collection_literal: warning 22 | type_annotate_public_apis: warning 23 | inference_failure_on_untyped_parameter: warning 24 | inference_failure_on_instance_creation: warning 25 | inference_failure_on_function_invocation: warning 26 | 27 | # Probably OK 28 | comment_references: warning 29 | prefer_asserts_in_initializer_lists: warning 30 | avoid_classes_with_only_static_members: warning 31 | prefer_function_declarations_over_variables: warning 32 | overridden_fields: warning 33 | public_member_api_docs: warning 34 | avoid_setters_without_getters: warning 35 | constant_identifier_names: warning 36 | use_if_null_to_convert_nulls_to_bools: warning 37 | referenced_before_declaration: warning 38 | use_to_and_as_if_applicable: warning 39 | prefer_asserts_with_message: warning 40 | no_default_cases: warning 41 | one_member_abstracts: warning 42 | join_return_with_assignment: warning 43 | use_setters_to_change_properties: warning 44 | unnecessary_null_comparison: warning 45 | prefer_null_aware_method_calls: warning 46 | parameter_assignments: warning 47 | 48 | use_late_for_private_fields_and_variables: ignore 49 | avoid_catches_without_on_clauses: ignore 50 | 51 | -------------------------------------------------------------------------------- /charts_flutter/example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Symbolication related 35 | app.*.symbols 36 | 37 | # Obfuscation related 38 | app.*.map.json 39 | 40 | # Android Studio will place build artifacts here 41 | /android/app/debug 42 | /android/app/profile 43 | /android/app/release 44 | -------------------------------------------------------------------------------- /charts_flutter/example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: "4cf269e36de2573851eaef3c763994f8f9be494d" 8 | channel: "stable" 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 4cf269e36de2573851eaef3c763994f8f9be494d 17 | base_revision: 4cf269e36de2573851eaef3c763994f8f9be494d 18 | - platform: android 19 | create_revision: 4cf269e36de2573851eaef3c763994f8f9be494d 20 | base_revision: 4cf269e36de2573851eaef3c763994f8f9be494d 21 | - platform: ios 22 | create_revision: 4cf269e36de2573851eaef3c763994f8f9be494d 23 | base_revision: 4cf269e36de2573851eaef3c763994f8f9be494d 24 | - platform: linux 25 | create_revision: 4cf269e36de2573851eaef3c763994f8f9be494d 26 | base_revision: 4cf269e36de2573851eaef3c763994f8f9be494d 27 | - platform: macos 28 | create_revision: 4cf269e36de2573851eaef3c763994f8f9be494d 29 | base_revision: 4cf269e36de2573851eaef3c763994f8f9be494d 30 | - platform: web 31 | create_revision: 4cf269e36de2573851eaef3c763994f8f9be494d 32 | base_revision: 4cf269e36de2573851eaef3c763994f8f9be494d 33 | - platform: windows 34 | create_revision: 4cf269e36de2573851eaef3c763994f8f9be494d 35 | base_revision: 4cf269e36de2573851eaef3c763994f8f9be494d 36 | 37 | # User provided section 38 | 39 | # List of Local paths (relative to this file) that should be 40 | # ignored by the migrate tool. 41 | # 42 | # Files that are not part of the templates will be ignored by default. 43 | unmanaged_files: 44 | - 'lib/main.dart' 45 | - 'ios/Runner.xcodeproj/project.pbxproj' 46 | -------------------------------------------------------------------------------- /charts_flutter/example/README.md: -------------------------------------------------------------------------------- 1 | # nimble_charts Example 2 | 3 | This example demonstrates the usage of the nimble_charts package, a resurrection of the discontinued Google Charts Flutter library. 4 | 5 | ## 🚀 Live Demo 6 | 7 | Check out the [live WASM web app demo](https://nimblesite.github.io/nimble_charts/) to see these examples in action! 8 | 9 | ## 📊 Features 10 | 11 | This example app showcases various chart types and features, including: 12 | 13 | - Line charts 14 | - Bar charts 15 | - Pie charts 16 | - Scatter plots 17 | - Time series charts 18 | - And more! 19 | 20 | ## 🛠️ Running the Example 21 | 22 | To run this example: 23 | 24 | 1. Ensure you have Flutter installed and set up. 25 | 2. Clone the nimble_charts repository. 26 | 3. Navigate to the `charts_flutter/example` directory. 27 | 4. Run `flutter pub get` to install dependencies. 28 | 5. Use `flutter run` to launch the example app on your preferred device or simulator. 29 | 30 | ## 📝 Usage 31 | 32 | Each chart in the example app demonstrates different features and customization options of the nimble_charts package. You can explore the source code in this directory to see how each chart is implemented. 33 | 34 | ## 🤝 Contributing 35 | 36 | If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request on the main nimble_charts repository. 37 | 38 | ## 📣 Acknowledgements 39 | 40 | This example app is based on the original work done by the Google Charts team. We express our gratitude for their efforts in creating such a valuable library for the Flutter community. 41 | -------------------------------------------------------------------------------- /charts_flutter/example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | 2 | include: package:austerity/analysis_options.yaml 3 | 4 | analyzer: 5 | errors: 6 | comment_references: warning 7 | avoid_dynamic_calls: warning 8 | 9 | avoid_annotating_with_dynamic: ignore 10 | unreachable_from_main: ignore 11 | public_member_api_docs: ignore 12 | -------------------------------------------------------------------------------- /charts_flutter/example/android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /charts_flutter/example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/to/reference-keystore 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /charts_flutter/example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.android.application" 3 | id "kotlin-android" 4 | // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. 5 | id "dev.flutter.flutter-gradle-plugin" 6 | } 7 | 8 | android { 9 | namespace = "com.example.example" 10 | compileSdk = flutter.compileSdkVersion 11 | ndkVersion = flutter.ndkVersion 12 | 13 | compileOptions { 14 | sourceCompatibility = JavaVersion.VERSION_1_8 15 | targetCompatibility = JavaVersion.VERSION_1_8 16 | } 17 | 18 | kotlinOptions { 19 | jvmTarget = JavaVersion.VERSION_1_8 20 | } 21 | 22 | defaultConfig { 23 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 24 | applicationId = "com.example.example" 25 | // You can update the following values to match your application needs. 26 | // For more information, see: https://flutter.dev/to/review-gradle-config. 27 | minSdk = flutter.minSdkVersion 28 | targetSdk = flutter.targetSdkVersion 29 | versionCode = flutter.versionCode 30 | versionName = flutter.versionName 31 | } 32 | 33 | buildTypes { 34 | release { 35 | // TODO: Add your own signing config for the release build. 36 | // Signing with the debug keys for now, so `flutter run --release` works. 37 | signingConfig = signingConfigs.debug 38 | } 39 | } 40 | } 41 | 42 | flutter { 43 | source = "../.." 44 | } 45 | -------------------------------------------------------------------------------- /charts_flutter/example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /charts_flutter/example/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java: -------------------------------------------------------------------------------- 1 | package io.flutter.plugins; 2 | 3 | import androidx.annotation.Keep; 4 | import androidx.annotation.NonNull; 5 | import io.flutter.Log; 6 | 7 | import io.flutter.embedding.engine.FlutterEngine; 8 | 9 | /** 10 | * Generated file. Do not edit. 11 | * This file is generated by the Flutter tool based on the 12 | * plugins that support the Android platform. 13 | */ 14 | @Keep 15 | public final class GeneratedPluginRegistrant { 16 | private static final String TAG = "GeneratedPluginRegistrant"; 17 | public static void registerWith(@NonNull FlutterEngine flutterEngine) { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /charts_flutter/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() 6 | -------------------------------------------------------------------------------- /charts_flutter/example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /charts_flutter/example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /charts_flutter/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /charts_flutter/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /charts_flutter/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /charts_flutter/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /charts_flutter/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /charts_flutter/example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /charts_flutter/example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /charts_flutter/example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /charts_flutter/example/android/build.gradle: -------------------------------------------------------------------------------- 1 | allprojects { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | } 6 | } 7 | 8 | rootProject.buildDir = "../build" 9 | subprojects { 10 | project.buildDir = "${rootProject.buildDir}/${project.name}" 11 | } 12 | subprojects { 13 | project.evaluationDependsOn(":app") 14 | } 15 | 16 | tasks.register("clean", Delete) { 17 | delete rootProject.buildDir 18 | } 19 | -------------------------------------------------------------------------------- /charts_flutter/example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /charts_flutter/example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /charts_flutter/example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip 6 | -------------------------------------------------------------------------------- /charts_flutter/example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | def flutterSdkPath = { 3 | def properties = new Properties() 4 | file("local.properties").withInputStream { properties.load(it) } 5 | def flutterSdkPath = properties.getProperty("flutter.sdk") 6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 7 | return flutterSdkPath 8 | }() 9 | 10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") 11 | 12 | repositories { 13 | google() 14 | mavenCentral() 15 | gradlePluginPortal() 16 | } 17 | } 18 | 19 | plugins { 20 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 21 | id "com.android.application" version "8.1.0" apply false 22 | id "org.jetbrains.kotlin.android" version "1.8.22" apply false 23 | } 24 | 25 | include ":app" 26 | -------------------------------------------------------------------------------- /charts_flutter/example/build_serve.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -d "build" ]; then 4 | echo "Deleting build folder..." 5 | rm -rf build 6 | echo "Build folder deleted successfully." 7 | else 8 | echo "Build folder not found. Nothing to delete." 9 | fi 10 | 11 | echo "Running flutter clean..." 12 | flutter clean 13 | 14 | flutter build web --wasm 15 | 16 | cd build/web 17 | 18 | npx serve --config serve.json -------------------------------------------------------------------------------- /charts_flutter/example/examples.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /charts_flutter/example/examples_android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /charts_flutter/example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /charts_flutter/example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /charts_flutter/example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /charts_flutter/example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | 4 | @main 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Example 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | example 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | CADisableMinimumFrameDurationOnPhone 45 | 46 | UIApplicationSupportsIndirectInputEvents 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /charts_flutter/example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /charts_flutter/example/ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /charts_flutter/example/lib/a11y/a11y_gallery.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | import 'package:example/a11y/domain_a11y_explore_bar_chart.dart'; 16 | import 'package:example/gallery_scaffold.dart'; 17 | import 'package:flutter/material.dart'; 18 | 19 | List buildGallery() => [ 20 | const GalleryScaffold( 21 | listTileIcon: Icon(Icons.accessibility), 22 | title: 'Screen reader enabled bar chart', 23 | subtitle: 'Requires TalkBack or Voiceover turned on to work. ' 24 | 'Bar chart with domain selection explore mode behavior.', 25 | childBuilder: DomainA11yExploreBarChart.withRandomData, 26 | ), 27 | ]; 28 | -------------------------------------------------------------------------------- /charts_flutter/example/lib/app_config.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:flutter/material.dart'; 17 | 18 | /// A particular configuration of the app. 19 | class AppConfig { 20 | AppConfig({ 21 | required this.appName, 22 | required this.appLink, 23 | required this.theme, 24 | }); 25 | final String appName; 26 | final String appLink; 27 | final ThemeData theme; 28 | } 29 | 30 | /// The default configuration of the app. 31 | AppConfig get defaultConfig => AppConfig( 32 | appName: 'nimble_charts Gallery', 33 | appLink: '', 34 | theme: ThemeData( 35 | brightness: Brightness.light, 36 | primarySwatch: Colors.lightBlue, 37 | ), 38 | ); 39 | -------------------------------------------------------------------------------- /charts_flutter/example/lib/gallery_app.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:example/main.dart'; 17 | import 'package:example/original.dart'; 18 | import 'package:example/picker/tag_selection_screen.dart'; 19 | import 'package:flutter/material.dart'; 20 | 21 | class GalleryApp extends StatelessWidget { 22 | const GalleryApp({super.key}); 23 | 24 | @override 25 | Widget build(BuildContext context) => ValueListenableBuilder( 26 | valueListenable: appState, 27 | builder: (_, currentState, __) => MaterialApp( 28 | debugShowCheckedModeBanner: false, 29 | title: currentState.isOriginal 30 | ? 'Charts Gallery' 31 | : 'nimble_charts Gallery', 32 | theme: currentState.isOriginal 33 | ? null 34 | : ThemeData( 35 | colorScheme: currentState.themeMode == ThemeMode.dark 36 | ? ColorScheme.fromSeed( 37 | seedColor: const Color.fromRGBO(0, 147, 173, 1), 38 | brightness: Brightness.dark, 39 | ) 40 | : ColorScheme.fromSeed( 41 | seedColor: const Color.fromRGBO(0, 147, 173, 1), 42 | ), 43 | ), 44 | darkTheme: ThemeData.dark(), 45 | themeMode: currentState.themeMode, 46 | home: 47 | currentState.isOriginal ? Original() : const TagSelectionScreen(), 48 | ), 49 | ); 50 | } 51 | -------------------------------------------------------------------------------- /charts_flutter/example/lib/i18n/i18n_gallery.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:example/gallery_scaffold.dart'; 17 | import 'package:example/i18n/rtl_bar_chart.dart'; 18 | import 'package:example/i18n/rtl_line_chart.dart'; 19 | import 'package:example/i18n/rtl_line_segments.dart'; 20 | import 'package:example/i18n/rtl_series_legend.dart'; 21 | import 'package:flutter/material.dart'; 22 | 23 | List buildGallery() => [ 24 | const GalleryScaffold( 25 | listTileIcon: Icon(Icons.flag), 26 | title: 'RTL Bar Chart', 27 | subtitle: 'Simple bar chart in RTL', 28 | childBuilder: RTLBarChart.withRandomData, 29 | ), 30 | const GalleryScaffold( 31 | listTileIcon: Icon(Icons.flag), 32 | title: 'RTL Line Chart', 33 | subtitle: 'Simple line chart in RTL', 34 | childBuilder: RTLLineChart.withRandomData, 35 | ), 36 | const GalleryScaffold( 37 | listTileIcon: Icon(Icons.flag), 38 | title: 'RTL Line Segments', 39 | subtitle: 'Stacked area chart with style segments in RTL', 40 | childBuilder: RTLLineSegments.withRandomData, 41 | ), 42 | const GalleryScaffold( 43 | listTileIcon: Icon(Icons.flag), 44 | title: 'RTL Series Legend', 45 | subtitle: 'Series legend in RTL', 46 | childBuilder: RTLSeriesLegend.withRandomData, 47 | ), 48 | ]; 49 | -------------------------------------------------------------------------------- /charts_flutter/example/lib/picker/iterable_extensions.dart: -------------------------------------------------------------------------------- 1 | extension IterableExtensions on Iterable { 2 | /// Non mutating sort 3 | List orderBy([int Function(T a, T b)? compare]) => toList()..sort(compare); 4 | } 5 | -------------------------------------------------------------------------------- /charts_flutter/example/lib/picker/model.dart: -------------------------------------------------------------------------------- 1 | import 'package:example/picker/tag_item_selector.dart'; 2 | import 'package:example/picker/tagged_item.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | class ChartSampleDefinition implements TaggedItem { 6 | ChartSampleDefinition({ 7 | required this.title, 8 | required this.subtitle, 9 | required this.build, 10 | required this.icon, 11 | required this.tags, 12 | }); 13 | 14 | @override 15 | final List tags; 16 | final IconData icon; 17 | final String title; 18 | final String subtitle; 19 | 20 | final Widget Function(BuildContext context, ChartSampleDefinition item) build; 21 | } 22 | -------------------------------------------------------------------------------- /charts_flutter/example/lib/picker/tagged_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:example/picker/tag_item_selector.dart'; 2 | 3 | abstract class TaggedItem { 4 | List get tags; 5 | } 6 | -------------------------------------------------------------------------------- /charts_flutter/example/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /charts_flutter/example/linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void fl_register_plugins(FlPluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /charts_flutter/example/linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /charts_flutter/example/linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /charts_flutter/example/linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /charts_flutter/example/linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /charts_flutter/example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /charts_flutter/example/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /charts_flutter/example/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /charts_flutter/example/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | 9 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 10 | } 11 | -------------------------------------------------------------------------------- /charts_flutter/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /charts_flutter/example/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /charts_flutter/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /charts_flutter/example/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @main 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /charts_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /charts_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /charts_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /charts_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /charts_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /charts_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /charts_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /charts_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /charts_flutter/example/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = example 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2024 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /charts_flutter/example/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /charts_flutter/example/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /charts_flutter/example/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /charts_flutter/example/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /charts_flutter/example/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /charts_flutter/example/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /charts_flutter/example/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /charts_flutter/example/macos/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /charts_flutter/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: nimble_charts Demo 3 | homepage: https://github.com/Nimblesite/nimble_charts 4 | environment: 5 | sdk: '>=3.0.0 <4.0.0' 6 | flutter: '>=3.0.0 <4.0.0' 7 | 8 | dependencies: 9 | cupertino_icons: ^1.0.8 10 | flutter: 11 | sdk: flutter 12 | flutter_staggered_animations: ^1.1.1 13 | flutter_test: 14 | sdk: flutter 15 | flutter_web_plugins: 16 | sdk: flutter 17 | meta: ^1.1.1 18 | nimble_charts: 19 | path: ../ 20 | flutter: 21 | uses-material-design: true 22 | dev_dependencies: 23 | austerity: ^1.2.0 24 | -------------------------------------------------------------------------------- /charts_flutter/example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/web/favicon.png -------------------------------------------------------------------------------- /charts_flutter/example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /charts_flutter/example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /charts_flutter/example/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /charts_flutter/example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /charts_flutter/example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | nimble_charts Gallery 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /charts_flutter/example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "short_name": "example", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /charts_flutter/example/web/serve.json: -------------------------------------------------------------------------------- 1 | { 2 | "headers": [ 3 | { 4 | "source": "**/*", 5 | "headers": [ 6 | { 7 | "key": "Cross-Origin-Embedder-Policy", 8 | "value": "credentialless" 9 | }, 10 | { 11 | "key": "Cross-Origin-Opener-Policy", 12 | "value": "same-origin" 13 | } 14 | ] 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /charts_flutter/example/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /charts_flutter/example/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void RegisterPlugins(flutter::PluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /charts_flutter/example/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /charts_flutter/example/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /charts_flutter/example/windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Add preprocessor definitions for the build version. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") 25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") 26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") 27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") 28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") 29 | 30 | # Disable Windows macros that collide with C++ standard library functions. 31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 32 | 33 | # Add dependency libraries and include directories. Add any application-specific 34 | # dependencies here. 35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 36 | target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") 37 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 38 | 39 | # Run the Flutter tool portions of the build. This must not be removed. 40 | add_dependencies(${BINARY_NAME} flutter_assemble) 41 | -------------------------------------------------------------------------------- /charts_flutter/example/windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /charts_flutter/example/windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.Create(L"example", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /charts_flutter/example/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /charts_flutter/example/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/example/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /charts_flutter/example/windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /charts_flutter/example/windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | unsigned int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr) 51 | -1; // remove the trailing null character 52 | int input_length = (int)wcslen(utf16_string); 53 | std::string utf8_string; 54 | if (target_length == 0 || target_length > utf8_string.max_size()) { 55 | return utf8_string; 56 | } 57 | utf8_string.resize(target_length); 58 | int converted_length = ::WideCharToMultiByte( 59 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 60 | input_length, utf8_string.data(), target_length, nullptr, nullptr); 61 | if (converted_length == 0) { 62 | return std::string(); 63 | } 64 | return utf8_string; 65 | } 66 | -------------------------------------------------------------------------------- /charts_flutter/example/windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /charts_flutter/lib/src/behaviors/domain_highlighter.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:flutter/material.dart'; 17 | import 'package:nimble_charts/src/behaviors/chart_behavior.dart'; 18 | import 'package:nimble_charts_common/common.dart' as common; 19 | 20 | /// Chart behavior that monitors the specified [common.SelectionModel] and 21 | /// darkens the color for selected data. 22 | /// 23 | /// This is typically used for bars and pies to highlight segments. 24 | /// 25 | /// It is used in combination with SelectNearest to update the selection model 26 | /// and expand selection out to the domain value. 27 | @immutable 28 | class DomainHighlighter extends ChartBehavior { 29 | DomainHighlighter([this.selectionModelType = common.SelectionModelType.info]); 30 | @override 31 | final desiredGestures = {}; 32 | 33 | /// The type of selection model to monitor for highlighting. 34 | final common.SelectionModelType selectionModelType; 35 | 36 | @override 37 | common.DomainHighlighter createCommonBehavior() => 38 | common.DomainHighlighter(selectionModelType); 39 | 40 | @override 41 | void updateCommonBehavior(common.ChartBehavior commonBehavior) {} 42 | 43 | @override 44 | String get role => 'domainHighlight-$selectionModelType'; 45 | 46 | @override 47 | bool operator ==(Object other) => 48 | other is DomainHighlighter && 49 | selectionModelType == other.selectionModelType; 50 | 51 | @override 52 | int get hashCode => selectionModelType.hashCode; 53 | } 54 | -------------------------------------------------------------------------------- /charts_flutter/lib/src/behaviors/legend/legend.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/common.dart' 17 | show LegendEntry, LegendTapHandling; 18 | 19 | /// Interface for legends that can handle tap events. 20 | abstract class TappableLegend { 21 | /// Delegates handling of legend entry clicks according to the configured 22 | /// [LegendTapHandling] strategy. 23 | void onLegendEntryTapUp(LegendEntry detail); 24 | } 25 | -------------------------------------------------------------------------------- /charts_flutter/lib/src/behaviors/sliding_viewport.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:flutter/material.dart'; 17 | import 'package:nimble_charts/src/behaviors/chart_behavior.dart'; 18 | import 'package:nimble_charts_common/common.dart' as common; 19 | 20 | /// Chart behavior that centers the viewport on the selected domain. 21 | /// 22 | /// It is used in combination with SelectNearest to update the selection model 23 | /// and notify this behavior to update the viewport on selection change. 24 | /// 25 | /// This behavior can only be used on [common.CartesianChart]. 26 | @immutable 27 | class SlidingViewport extends ChartBehavior { 28 | SlidingViewport([this.selectionModelType = common.SelectionModelType.info]); 29 | @override 30 | final desiredGestures = {}; 31 | 32 | /// The type of selection model to monitor for viewport changes. 33 | final common.SelectionModelType selectionModelType; 34 | 35 | @override 36 | common.SlidingViewport createCommonBehavior() => 37 | common.SlidingViewport(selectionModelType); 38 | 39 | @override 40 | void updateCommonBehavior(common.ChartBehavior commonBehavior) {} 41 | 42 | @override 43 | String get role => 'slidingViewport-$selectionModelType'; 44 | 45 | @override 46 | bool operator ==(Object other) => 47 | other is SlidingViewport && 48 | selectionModelType == other.selectionModelType; 49 | 50 | @override 51 | int get hashCode => selectionModelType.hashCode; 52 | } 53 | -------------------------------------------------------------------------------- /charts_flutter/lib/src/chart_state.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | abstract class ChartState { 17 | void setAnimation(Duration transition); 18 | 19 | /// Request to the native platform to rebuild the chart. 20 | void requestRebuild(); 21 | 22 | /// Informs the chart that the configuration has changed. 23 | /// 24 | /// This flag is set by checks that detect if a configuration has changed, 25 | /// such as behaviors, axis, and renderers. 26 | /// 27 | /// This flag is read on chart rebuild, if chart is marked as dirty, then the 28 | /// chart will call a base chart draw. 29 | void markChartDirty(); 30 | 31 | /// Reset the chart dirty flag. 32 | void resetChartDirtyFlag(); 33 | 34 | /// Gets if the chart is dirty. 35 | bool get chartIsDirty; 36 | } 37 | -------------------------------------------------------------------------------- /charts_flutter/lib/src/line_style.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/common.dart' as common 17 | show Color, LineStyle; 18 | 19 | class LineStyle implements common.LineStyle { 20 | LineStyle({this.strokeWidth = 0}); 21 | @override 22 | common.Color? color; 23 | 24 | @override 25 | List? dashPattern; 26 | 27 | @override 28 | int strokeWidth; 29 | } 30 | -------------------------------------------------------------------------------- /charts_flutter/lib/src/selection_model_config.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:meta/meta.dart' show immutable; 17 | 18 | import 'package:nimble_charts_common/common.dart' as common; 19 | 20 | @immutable 21 | class SelectionModelConfig { 22 | const SelectionModelConfig({ 23 | this.type = common.SelectionModelType.info, 24 | this.changedListener, 25 | this.updatedListener, 26 | }); 27 | final common.SelectionModelType type; 28 | 29 | /// Listens for change in selection. 30 | final common.SelectionModelListener? changedListener; 31 | 32 | /// Listens anytime update selection is called. 33 | final common.SelectionModelListener? updatedListener; 34 | } 35 | -------------------------------------------------------------------------------- /charts_flutter/lib/src/text_style.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:nimble_charts_common/common.dart' as common 17 | show Color, TextStyle; 18 | 19 | class TextStyle implements common.TextStyle { 20 | @override 21 | int? fontSize; 22 | @override 23 | String? fontFamily; 24 | @override 25 | common.Color? color; 26 | @override 27 | double? lineHeight; 28 | @override 29 | String? fontWeight; 30 | 31 | @override 32 | bool operator ==(Object other) => 33 | other is TextStyle && 34 | fontSize == other.fontSize && 35 | fontFamily == other.fontFamily && 36 | fontWeight == other.fontWeight && 37 | color == other.color && 38 | lineHeight == other.lineHeight; 39 | 40 | @override 41 | int get hashCode => 42 | Object.hash(fontSize, fontFamily, color, lineHeight, fontWeight); 43 | } 44 | -------------------------------------------------------------------------------- /charts_flutter/lib/src/util.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:flutter/rendering.dart' 17 | show 18 | RenderBox, 19 | RenderCustomMultiChildLayoutBox, 20 | RenderPointerListener, 21 | RenderSemanticsGestureHandler; 22 | import 'package:nimble_charts/src/chart_container.dart' 23 | show ChartContainerRenderObject; 24 | 25 | /// Get the [ChartContainerRenderObject] from a [RenderBox]. 26 | /// 27 | /// [RenderBox] is expected to be a [RenderSemanticsGestureHandler] with child 28 | /// of [RenderPointerListener] with child of [ChartContainerRenderObject]. 29 | ChartContainerRenderObject getChartContainerRenderObject(RenderBox box) { 30 | assert(box is RenderCustomMultiChildLayoutBox); 31 | final semanticHandler = (box as RenderCustomMultiChildLayoutBox) 32 | .getChildrenAsList() 33 | .firstWhere((child) => child is RenderSemanticsGestureHandler); 34 | 35 | assert(semanticHandler is RenderSemanticsGestureHandler); 36 | final renderPointerListener = 37 | (semanticHandler as RenderSemanticsGestureHandler).child; 38 | 39 | assert(renderPointerListener is RenderPointerListener); 40 | final chartContainerRenderObject = 41 | (renderPointerListener! as RenderPointerListener).child; 42 | 43 | assert(chartContainerRenderObject is ChartContainerRenderObject); 44 | 45 | return chartContainerRenderObject! as ChartContainerRenderObject; 46 | } 47 | -------------------------------------------------------------------------------- /charts_flutter/lib/src/util/color.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'dart:ui' as ui; 17 | 18 | import 'package:nimble_charts/flutter.dart'; 19 | import 'package:nimble_charts_common/common.dart' as common show Color; 20 | 21 | // ignore: avoid_classes_with_only_static_members 22 | /// Utility class for converting between common and Flutter colors. 23 | class ColorUtil { 24 | /// Converts a common color to a Flutter color. 25 | static ui.Color toDartColor(common.Color color) => color.toDartColor(); 26 | 27 | /// Converts a Flutter color to a common color. 28 | static common.Color fromDartColor(ui.Color color) => color.fromDartColor(); 29 | } 30 | 31 | /// Extension methods for common colors. 32 | extension ColorExtensions on Color { 33 | /// Converts a common color to a Flutter color. 34 | ui.Color toDartColor() => ui.Color.fromARGB(a, r, g, b); 35 | 36 | /// Returns a new color with the alpha channel multiplied by the given value. 37 | Color withAlpha(double alpha) => Color( 38 | r: r, 39 | g: g, 40 | b: b, 41 | a: (a * alpha).round(), 42 | ); 43 | } 44 | 45 | /// Extension methods for Flutter colors. 46 | extension UIColorExtensions on ui.Color { 47 | /// Converts a Flutter color to a common color. 48 | common.Color fromDartColor() => common.Color( 49 | r: red, 50 | g: green, 51 | b: blue, 52 | a: alpha, 53 | ); 54 | } 55 | -------------------------------------------------------------------------------- /charts_flutter/minimum_os.bzl: -------------------------------------------------------------------------------- 1 | """Minimum OS version definitions""" 2 | 3 | IOS_MINIMUM_OS = "9.0" 4 | -------------------------------------------------------------------------------- /charts_flutter/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: nimble_charts 2 | version: 0.5.0-beta 3 | description: Charts for Flutter. A fork of charts_flutter 4 | homepage: https://github.com/Nimblesite/nimble_charts 5 | publish_to: 'none' 6 | 7 | environment: 8 | sdk: '>=3.0.0 <4.0.0' 9 | flutter: '>=3.0.0 <4.0.0' 10 | 11 | dependencies: 12 | collection: ^1.14.5 13 | flutter: 14 | sdk: flutter 15 | meta: ^1.1.1 16 | nimble_charts_common: 17 | path: ../charts_common 18 | 19 | dev_dependencies: 20 | austerity: ^1.2.0 21 | build_runner: ^2.4.12 22 | example: 23 | path: example 24 | flutter_staggered_animations: ^1.1.1 25 | flutter_test: 26 | sdk: flutter 27 | mockito: ^5.0.0 28 | test: ^1.3.0 29 | 30 | -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_area_and_line_combo_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_area_and_line_combo_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_auto_label_donut_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_auto_label_donut_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_bar_chart_with_custom_bar_radius.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_bar_chart_with_custom_bar_radius.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_bar_chart_with_secondary_measure_axis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_bar_chart_with_secondary_measure_axis.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_bar_chart_with_secondary_measure_axis_only.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_bar_chart_with_secondary_measure_axis_only.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_bucketing_axis_scatter_plot_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_bucketing_axis_scatter_plot_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_comparison_points_scatter_plot_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_comparison_points_scatter_plot_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_custom_axis_fonts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_custom_axis_fonts.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_custom_formatter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_custom_formatter.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_custom_tick_count.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_custom_tick_count.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_dash_pattern_line_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_dash_pattern_line_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_disjoint_measure_axes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_disjoint_measure_axes.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_end_points_axis_time_series_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_end_points_axis_time_series_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_gridline_dash_pattern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_gridline_dash_pattern.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_grouped_bar_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_grouped_bar_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_grouped_bar_single_target_line_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_grouped_bar_single_target_line_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_grouped_bar_target_line_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_grouped_bar_target_line_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_grouped_fill_color_bar_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_grouped_fill_color_bar_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_grouped_stacked_bar_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_grouped_stacked_bar_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_horizontal_bar_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_horizontal_bar_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_horizontal_bar_chart_with_bar_labels.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_horizontal_bar_chart_with_bar_labels.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_horizontal_bar_chart_with_custom_bar_labels.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_horizontal_bar_chart_with_custom_bar_labels.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_horizontal_bar_chart_with_secondary_measure_axis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_horizontal_bar_chart_with_secondary_measure_axis.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_horizontal_pattern_forward_hatch_bar_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_horizontal_pattern_forward_hatch_bar_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_integer_measure_ticks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_integer_measure_ticks.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_label_alignment_axis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_label_alignment_axis.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_line_annotation_line_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_line_annotation_line_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_line_annotation_on_time_series_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_line_annotation_on_time_series_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_menu.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_no_axis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_no_axis.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_non-zero_bound_axis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_non-zero_bound_axis.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_null_data_line_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_null_data_line_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_numeric_axis_with_initial_viewport.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_numeric_axis_with_initial_viewport.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_numeric_line_bar_combo_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_numeric_line_bar_combo_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_numeric_line_points_combo_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_numeric_line_points_combo_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_ordinal_axis_with_initial_viewport.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_ordinal_axis_with_initial_viewport.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_ordinal_combo_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_ordinal_combo_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_outside_label_pie_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_outside_label_pie_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_pan_and_zoom_line_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_pan_and_zoom_line_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_pan_and_zoom_scatter_plot_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_pan_and_zoom_scatter_plot_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_partial_pie_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_partial_pie_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_pattern_forward_hatch_bar_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_pattern_forward_hatch_bar_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_points_line_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_points_line_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_range_annotation_line_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_range_annotation_line_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_range_annotation_margin_labels_line_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_range_annotation_margin_labels_line_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_range_annotation_margin_labels_on_time_series_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_range_annotation_margin_labels_on_time_series_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_range_annotation_on_time_series_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_range_annotation_on_time_series_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_scatter_plot_combo_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_scatter_plot_combo_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_segments_line_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_segments_line_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_short_ticks_axis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_short_ticks_axis.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_simple_bar_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_simple_bar_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_simple_line_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_simple_line_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_simple_pie_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_simple_pie_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_simple_scatter_plot_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_simple_scatter_plot_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_simple_time_series_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_simple_time_series_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_spark_bar_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_spark_bar_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_stacked_area_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_stacked_area_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_stacked_area_custom_color_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_stacked_area_custom_color_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_stacked_area_with_nulls_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_stacked_area_with_nulls_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_stacked_bar_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_stacked_bar_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_stacked_bar_target_line_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_stacked_bar_target_line_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_stacked_fill_color_bar_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_stacked_fill_color_bar_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_stacked_horizontal_bar_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_stacked_horizontal_bar_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_statically_provided_ticks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_statically_provided_ticks.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_symbol_annotation_time_series_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_symbol_annotation_time_series_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_time_series_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_time_series_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_time_series_chart_with_bars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_time_series_chart_with_bars.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_time_series_chart_with_confidence_interval.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_time_series_chart_with_confidence_interval.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_time_series_combo_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_time_series_combo_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_vertical_bar_chart_with_bar_labels.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_vertical_bar_chart_with_bar_labels.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_weight_pattern_bar_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_weight_pattern_bar_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/example_weighted_pattern_bar_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/example_weighted_pattern_bar_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/golden_bar_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/golden_bar_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/golden_bar_chart_after_selection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/golden_bar_chart_after_selection.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/golden_bar_chart_before_selection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/golden_bar_chart_before_selection.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/golden_bar_chart_custom_colors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/golden_bar_chart_custom_colors.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/golden_customized_bar_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/golden_customized_bar_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/golden_empty_bar_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/golden_empty_bar_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/golden_grouped_bar_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/golden_grouped_bar_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/golden_large_dataset_bar_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/golden_large_dataset_bar_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/golden_line_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/golden_line_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/golden_line_chart_custom_axis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/golden_line_chart_custom_axis.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/golden_line_chart_with_points.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/golden_line_chart_with_points.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/golden_numeric_combo_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/golden_numeric_combo_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/golden_ordinal_combo_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/golden_ordinal_combo_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/golden_rtl_bar_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/golden_rtl_bar_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/golden_stacked_bar_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/golden_stacked_bar_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/golden_time_series_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/golden_time_series_chart.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/golden_time_series_chart_multiple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/golden_time_series_chart_multiple.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/sliding_viewport_after_pan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/sliding_viewport_after_pan.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/sliding_viewport_initial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/sliding_viewport_initial.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/sliding_viewport_zoomed_in.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/sliding_viewport_zoomed_in.png -------------------------------------------------------------------------------- /charts_flutter/test/goldens/sliding_viewport_zoomed_out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nimblesite/nimble_charts/565808a502a3ed90026f5a61ad3fbeddc96b0714/charts_flutter/test/goldens/sliding_viewport_zoomed_out.png -------------------------------------------------------------------------------- /charts_flutter/test/test_functions.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | 4 | Future matchesGolden( 5 | String filename, 6 | ) async { 7 | if (T == Widget) throw ArgumentError('You must specify the root widget type'); 8 | 9 | await expectLater( 10 | find.byType(T), 11 | matchesGoldenFile( 12 | '../goldens/$filename.png', 13 | ), 14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /charts_flutter/test/text_element_test.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the Charts project authors. Please see the AUTHORS file 2 | // for details. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import 'package:flutter/material.dart' show BuildContext; 17 | import 'package:flutter/widgets.dart' show InheritedWidget; 18 | import 'package:mockito/mockito.dart'; 19 | import 'package:nimble_charts/src/graphics_factory.dart'; 20 | import 'package:nimble_charts/src/text_element.dart'; 21 | import 'package:test/test.dart'; 22 | 23 | // Can't use Mockito annotations with BuildContext yet? Fake it. 24 | class FakeBuildContext extends Fake implements BuildContext { 25 | @override 26 | T? dependOnInheritedWidgetOfExactType({ 27 | Object? aspect, 28 | }) => 29 | null; 30 | } 31 | 32 | // Gave up trying to figure out how to use mockito for now. 33 | class FakeGraphicsFactoryHelper extends Fake implements GraphicsFactoryHelper { 34 | FakeGraphicsFactoryHelper(this.textScaleFactor); 35 | double textScaleFactor; 36 | 37 | @override 38 | double getTextScaleFactorOf(BuildContext context) => textScaleFactor; 39 | } 40 | 41 | void main() { 42 | test('Text element gets assigned scale factor', () { 43 | final context = FakeBuildContext(); 44 | final helper = FakeGraphicsFactoryHelper(3); 45 | final graphicsFactory = GraphicsFactory(context, helper: helper); 46 | 47 | final textElement = 48 | graphicsFactory.createTextElement('test') as TextElement; 49 | 50 | expect(textElement.text, equals('test')); 51 | expect(textElement.textScaleFactor, equals(3.0)); 52 | }); 53 | } 54 | -------------------------------------------------------------------------------- /charts_flutter/test/widget_tests/bar_chart_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | import 'package:nimble_charts/flutter.dart' as charts; 4 | 5 | import '../test_functions.dart'; 6 | 7 | void main() { 8 | group('BarChart Widget Tests', () { 9 | testWidgets('Renders basic bar chart', (tester) async { 10 | final seriesList = [ 11 | charts.Series( 12 | id: 'Sales', 13 | colorFn: (_, __) => charts.MaterialPalette.blue.shadeDefault, 14 | domainFn: (sales, _) => sales.year, 15 | measureFn: (sales, _) => sales.sales, 16 | data: [ 17 | OrdinalSales('2014', 5), 18 | OrdinalSales('2015', 25), 19 | OrdinalSales('2016', 100), 20 | OrdinalSales('2017', 75), 21 | ], 22 | ), 23 | ]; 24 | 25 | await tester.pumpWidget( 26 | MaterialApp( 27 | home: Scaffold( 28 | body: SizedBox( 29 | height: 400, 30 | child: charts.BarChart( 31 | seriesList, 32 | animate: false, 33 | ), 34 | ), 35 | ), 36 | ), 37 | ); 38 | 39 | expect(find.byType(charts.BarChart), findsOneWidget); 40 | 41 | await matchesGolden( 42 | 'golden_bar_chart', 43 | ); 44 | }); 45 | 46 | // Add more test cases here, e.g.: 47 | // - Test with multiple series 48 | // - Test with different color schemes 49 | // - Test with custom axis specifications 50 | // - Test with behaviors like legends or tooltips 51 | }); 52 | } 53 | 54 | class OrdinalSales { 55 | OrdinalSales(this.year, this.sales); 56 | final String year; 57 | final int sales; 58 | } 59 | -------------------------------------------------------------------------------- /charts_flutter/test/widget_tests/chart_interactions_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | import 'package:nimble_charts/flutter.dart' as charts; 4 | 5 | import '../test_functions.dart'; 6 | 7 | void main() { 8 | group('Chart Interactions', () { 9 | testWidgets('Supports tap selection', (tester) async { 10 | final seriesList = [ 11 | charts.Series( 12 | id: 'Sales', 13 | colorFn: (_, __) => charts.MaterialPalette.blue.shadeDefault, 14 | domainFn: (sales, _) => sales.year, 15 | measureFn: (sales, _) => sales.sales, 16 | data: [ 17 | OrdinalSales('2014', 5), 18 | OrdinalSales('2015', 25), 19 | OrdinalSales('2016', 100), 20 | OrdinalSales('2017', 75), 21 | ], 22 | ), 23 | ]; 24 | 25 | charts.SelectionModel? selectionModel; 26 | 27 | await tester.pumpWidget( 28 | MaterialApp( 29 | home: Scaffold( 30 | body: SizedBox( 31 | height: 400, 32 | child: charts.BarChart( 33 | seriesList, 34 | animate: false, 35 | selectionModels: [ 36 | charts.SelectionModelConfig( 37 | changedListener: (model) { 38 | selectionModel = model; 39 | }, 40 | ), 41 | ], 42 | ), 43 | ), 44 | ), 45 | ), 46 | ); 47 | 48 | await matchesGolden('golden_bar_chart_before_selection'); 49 | 50 | await tester.tap(find.byType(charts.BarChart)); 51 | await tester.pump(); 52 | 53 | expect(selectionModel, isNotNull); 54 | expect(selectionModel!.selectedDatum, isNotEmpty); 55 | 56 | await matchesGolden('golden_bar_chart_after_selection'); 57 | }); 58 | 59 | // Add more interaction tests here 60 | }); 61 | } 62 | 63 | class OrdinalSales { 64 | OrdinalSales(this.year, this.sales); 65 | final String year; 66 | final int sales; 67 | } 68 | -------------------------------------------------------------------------------- /cspell.config.yaml: -------------------------------------------------------------------------------- 1 | $schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json 2 | version: "0.2" 3 | ignorePaths: 4 | # Various platform-specific API names we can just ignore. 5 | - charts_flutter/example/windows/ 6 | - charts_flutter/example/macos/ 7 | - charts_flutter/example/ios/ 8 | - charts_flutter/example/linux/ 9 | - charts_flutter/example/android/ 10 | - .gitignore 11 | - "gradlew" 12 | - "gradlew.bat" 13 | - "build" 14 | - "*.iml" 15 | - "*.yml" 16 | - "*.yaml" 17 | - "charts_common/test/data/" 18 | - 'coverage' 19 | words: 20 | - Aplos # Group inside Google which wrote the original flutter_charts. 21 | - barchart 22 | - cbraun 23 | - credentialless # CORS policy name (in serve.json for web) 24 | - cupertino 25 | - dasharray 26 | - defaultlabel # Probably could be capitalized 27 | - ellipsize 28 | - ellipsized 29 | - Findlay 30 | - focusable 31 | - Gemlock 32 | - genhtml 33 | - goldens 34 | - gradlew 35 | - gridline 36 | - gridlines 37 | - hashcode 38 | - hotfixes 39 | - hovercard 40 | - Jaspr 41 | - LTWH 42 | - niced 43 | - nicing 44 | - Nimblesite 45 | - nonclaiming 46 | - OPENSOURCE 47 | - Outliner 48 | - paintable 49 | - Postrender # Probably could be capitalized 50 | - pubspec 51 | - Rangeband 52 | - RRGGBB # Color format 53 | - Sankey 54 | - squarification 55 | - squarified 56 | - Squarify 57 | - Statick 58 | - stylepack 59 | - tappable 60 | - tostring # Used in a lint name 61 | - TRBL 62 | - treemap 63 | - Treemaps 64 | - unitconverter # Probably could be capitalized 65 | - Unlisten 66 | - sublist 67 | - preprocess 68 | - lerp 69 | - rgba 70 | - argb 71 | - ltrb 72 | - buildable 73 | - abdushakoor 74 | - eseidel 75 | - davidmigloz -------------------------------------------------------------------------------- /generate_contributions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | contributor_data=$(curl -s -H "Accept: application/vnd.github.v3+json" \ 4 | "https://api.github.com/repos/Nimblesite/nimble_charts/commits?since=$(date -v-3m +%Y-%m-%dT%H:%M:%SZ)&per_page=100" | \ 5 | jq -r '.[] | select(.author != null) | "\(.author.login) \(.author.avatar_url)"' | 6 | sort | uniq -c | sort -rn | 7 | awk '{printf "%s %s %s\n", $2, $3, $1}') 8 | 9 | echo "| Avatar | Username | Commits |" 10 | echo "|--------|----------|---------|" 11 | 12 | echo "$contributor_data" | while read -r username avatar_url commits; do 13 | echo "| \"$username\" | [$username](https://github.com/$username) | $commits |" 14 | done -------------------------------------------------------------------------------- /test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd charts_common 4 | 5 | flutter test --update-goldens --coverage --exclude-tags skip-file 6 | 7 | cd ../charts_flutter 8 | 9 | flutter test --update-goldens --coverage --exclude-tags skip-file 10 | 11 | lcov ./coverage --output-file ./coverage/lcov.info --capture --directory 12 | 13 | genhtml ./coverage/lcov.info --output-directory ./coverage/html --------------------------------------------------------------------------------