| 1 |
/* Copyright 2015 Bloomberg Finance L.P. |
| 2 |
* |
| 3 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
* you may not use this file except in compliance with the License. |
| 5 |
* You may obtain a copy of the License at |
| 6 |
* |
| 7 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
* |
| 9 |
* Unless required by applicable law or agreed to in writing, software |
| 10 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
* See the License for the specific language governing permissions and |
| 13 |
* limitations under the License. |
| 14 |
*/ |
| 15 |
|
| 16 |
import * as widgets from '@jupyter-widgets/base'; |
| 17 |
import * as d3 from 'd3'; |
| 18 |
import * as serialize from './serialize'; |
| 19 |
import { semver_range } from './version'; |
| 20 |
|
| 21 |
export class MarketMapModel extends widgets.WidgetModel { |
| 22 |
defaults() { |
| 23 |
return { |
| 24 |
...widgets.WidgetModel.prototype.defaults(), |
| 25 |
_model_name: 'MarketMapModel', |
| 26 |
_view_name: 'MarketMap', |
| 27 |
_model_module: 'bqplot', |
| 28 |
_view_module: 'bqplot', |
| 29 |
_model_module_version: semver_range, |
| 30 |
_view_module_version: semver_range, |
| 31 |
|
| 32 |
map_width: 1080, |
| 33 |
map_height: 800, |
| 34 |
|
| 35 |
names: [], |
| 36 |
groups: [], |
| 37 |
display_text: [], |
| 38 |
ref_data: undefined, |
| 39 |
title: '', |
| 40 |
|
| 41 |
tooltip_fields: [], |
| 42 |
tooltip_formats: [], |
| 43 |
show_groups: false, |
| 44 |
|
| 45 |
cols: 0, |
| 46 |
rows: 0, |
| 47 |
|
| 48 |
row_groups: 1, |
| 49 |
colors: d3.scaleOrdinal(d3.schemeCategory10).range(), |
| 50 |
scales: {}, |
| 51 |
axes: [], |
| 52 |
color: [], |
| 53 |
map_margin: { |
| 54 |
top: 50, |
| 55 |
right: 50, |
| 56 |
left: 50, |
| 57 |
bottom: 50, |
| 58 |
}, |
| 59 |
preserve_aspect: false, |
| 60 |
stroke: 'white', |
| 61 |
group_stroke: 'black', |
| 62 |
selected_stroke: 'dodgerblue', |
| 63 |
hovered_stroke: 'orangered', |
| 64 |
font_style: {}, |
| 65 |
title_style: {}, |
| 66 |
|
| 67 |
selected: [], |
| 68 |
enable_hover: true, |
| 69 |
enable_select: true, |
| 70 |
tooltip_widget: null, |
| 71 |
}; |
| 72 |
} |
| 73 |
static serializers = { |
| 74 |
...widgets.WidgetModel.serializers, |
| 75 |
scales: { deserialize: widgets.unpack_models }, |
| 76 |
axes: { deserialize: widgets.unpack_models }, |
| 77 |
tooltip_widget: { deserialize: widgets.unpack_models }, |
| 78 |
style: { deserialize: widgets.unpack_models }, |
| 79 |
layout: { deserialize: widgets.unpack_models }, |
| 80 |
names: serialize.array_or_json_serializer, |
| 81 |
groups: serialize.array_or_json_serializer, |
| 82 |
display_text: serialize.array_or_json_serializer, |
| 83 |
color: serialize.array_or_json_serializer, |
| 84 |
}; |
| 85 |
} |