| 151924 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 151925 | // Licensed under the MIT license. |
| 151926 | const scatterplot = context => { |
| 151927 | const { |
| 151928 | specColumns, |
| 151929 | insight, |
| 151930 | specViewOptions |
| 151931 | } = context; |
| 151932 | const errors = []; |
| 151933 | if (!specColumns.x) errors.push('Must set a field for x axis'); |
| 151934 | if (!specColumns.y) errors.push('Must set a field for y axis'); |
| 151935 | (0, _facet.checkForFacetErrors)(insight.facets, errors); |
| 151936 | const specCapabilities = { |
| 151937 | roles: [{ |
| 151938 | role: 'x', |
| 151939 | axisSelection: specColumns.x && specColumns.x.quantitative ? 'range' : 'exact' |
| 151940 | }, { |
| 151941 | role: 'y', |
| 151942 | axisSelection: specColumns.y && specColumns.y.quantitative ? 'range' : 'exact' |
| 151943 | }, { |
| 151944 | role: 'z', |
| 151945 | allowNone: true |
| 151946 | }, { |
| 151947 | role: 'color', |
| 151948 | allowNone: true |
| 151949 | }, { |
| 151950 | role: 'sort', |
| 151951 | allowNone: true |
| 151952 | }, { |
| 151953 | role: 'facet', |
| 151954 | allowNone: true |
| 151955 | }], |
| 151956 | signals: [_constants.SignalNames.PointSize] |
| 151957 | }; |
| 151958 | |
| 151959 | if (errors.length) { |
| 151960 | return { |
| 151961 | errors, |
| 151962 | specCapabilities, |
| 151963 | vegaSpec: null |
| 151964 | }; |
| 151965 | } |
| 151966 | |
| 151967 | let axes; |
| 151968 | |
| 151969 | if (!insight.hideAxes) { |
| 151970 | axes = (0, _axes.default)(context); |
| 151971 | } |
| 151972 | |
| 151973 | let marks = (0, _marks.default)(context); |
| 151974 | |
| 151975 | if (specColumns.facet) { |
| 151976 | marks = (0, _facet.facetMarks)(specViewOptions, marks[0].from.data, marks, axes); |
| 151977 | axes = []; |
| 151978 | } |
| 151979 | |
| 151980 | const size = specColumns.facet ? (0, _facet.facetSize)(context) : insight.size; |
| 151981 | var vegaSpec = { |
| 151982 | $schema: 'https://vega.github.io/schema/vega/v3.json', |
| 151983 | height: size.height, |
nothing calls this directly
no outgoing calls
no test coverage detected