@malloydata/render 0.0.286 → 0.0.287
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/component/default-settings.d.ts +3 -0
- package/dist/component/tag-utils.d.ts +9 -1
- package/dist/module/index.mjs +68 -17
- package/dist/module/index.umd.js +68 -17
- package/dist/register/register.mjs +180 -111
- package/dist/register/register.umd.js +180 -111
- package/dist/util.d.ts +1 -0
- package/dist/webcomponent/malloy-render.mjs +180 -111
- package/dist/webcomponent/malloy-render.umd.js +180 -111
- package/package.json +5 -5
|
@@ -27467,7 +27467,7 @@ ${spaces}}`;
|
|
|
27467
27467
|
return new Tag(structuredClone(this));
|
|
27468
27468
|
}
|
|
27469
27469
|
static escapeString(str) {
|
|
27470
|
-
return str.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
27470
|
+
return str.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n");
|
|
27471
27471
|
}
|
|
27472
27472
|
static escapeProp(str) {
|
|
27473
27473
|
return str.replace(/\\/g, "\\\\").replace(/`/g, "\\`");
|
|
@@ -53597,7 +53597,8 @@ class FilterElement extends malloy_element_1$C.MalloyElement {
|
|
|
53597
53597
|
code: this.exprSrc,
|
|
53598
53598
|
e: { node: "false" },
|
|
53599
53599
|
expressionType: "scalar",
|
|
53600
|
-
fieldUsage: exprVal.fieldUsage
|
|
53600
|
+
fieldUsage: exprVal.fieldUsage,
|
|
53601
|
+
isSourceFilter: false
|
|
53601
53602
|
};
|
|
53602
53603
|
}
|
|
53603
53604
|
const stableFilter = this.getStableFilter();
|
|
@@ -53607,7 +53608,8 @@ class FilterElement extends malloy_element_1$C.MalloyElement {
|
|
|
53607
53608
|
e: exprVal.value,
|
|
53608
53609
|
expressionType: exprVal.expressionType,
|
|
53609
53610
|
fieldUsage: exprVal.fieldUsage,
|
|
53610
|
-
stableFilter
|
|
53611
|
+
stableFilter,
|
|
53612
|
+
isSourceFilter: false
|
|
53611
53613
|
};
|
|
53612
53614
|
return exprCond;
|
|
53613
53615
|
}
|
|
@@ -53930,6 +53932,7 @@ class Drill extends filters_1$4.Filter {
|
|
|
53930
53932
|
const exprCond = {
|
|
53931
53933
|
node: "filterCondition",
|
|
53932
53934
|
code: filter2.exprSrc,
|
|
53935
|
+
isSourceFilter: false,
|
|
53933
53936
|
e: collectedWheres === void 0 ? fExpr.value : {
|
|
53934
53937
|
node: "and",
|
|
53935
53938
|
kids: { left: collectedWheres, right: fExpr.value }
|
|
@@ -56441,7 +56444,10 @@ class RefinedSource extends source_1$7.Source {
|
|
|
56441
56444
|
if ((0, malloy_types_1$u.expressionIsCalculation)(fc.expressionType)) {
|
|
56442
56445
|
el.logError("aggregate-in-source-filter", "Can't use aggregate computations in top level filters");
|
|
56443
56446
|
} else {
|
|
56444
|
-
filterList.push(
|
|
56447
|
+
filterList.push({
|
|
56448
|
+
...fc,
|
|
56449
|
+
isSourceFilter: true
|
|
56450
|
+
});
|
|
56445
56451
|
moreFilters = true;
|
|
56446
56452
|
}
|
|
56447
56453
|
}
|
|
@@ -85618,7 +85624,6 @@ function convertFieldInfos(source2, fields) {
|
|
|
85618
85624
|
return result;
|
|
85619
85625
|
}
|
|
85620
85626
|
function getResultMetadataAnnotation(field2, resultMetadata) {
|
|
85621
|
-
var _a;
|
|
85622
85627
|
const tag = malloy_tag_1$1.Tag.withPrefix("#(malloy) ");
|
|
85623
85628
|
let hasAny = false;
|
|
85624
85629
|
if (resultMetadata.referenceId !== void 0) {
|
|
@@ -85639,9 +85644,8 @@ function getResultMetadataAnnotation(field2, resultMetadata) {
|
|
|
85639
85644
|
hasAny = true;
|
|
85640
85645
|
}
|
|
85641
85646
|
}
|
|
85642
|
-
|
|
85643
|
-
|
|
85644
|
-
addDrillFiltersTag(tag, drillFilters);
|
|
85647
|
+
if (resultMetadata.filterList) {
|
|
85648
|
+
addDrillFiltersTag(tag, resultMetadata.filterList);
|
|
85645
85649
|
hasAny = true;
|
|
85646
85650
|
}
|
|
85647
85651
|
if (resultMetadata.fieldKind === "dimension") {
|
|
@@ -85658,6 +85662,8 @@ function addDrillFiltersTag(tag, drillFilters) {
|
|
|
85658
85662
|
var _a;
|
|
85659
85663
|
for (let i = 0; i < drillFilters.length; i++) {
|
|
85660
85664
|
const filter2 = drillFilters[i];
|
|
85665
|
+
if (filter2.expressionType !== "scalar" || filter2.isSourceFilter)
|
|
85666
|
+
continue;
|
|
85661
85667
|
tag.set(["drill_filters", i, "code"], filter2.code);
|
|
85662
85668
|
if (filter2.drillView) {
|
|
85663
85669
|
tag.set(["drill_filters", i, "drill_view"], filter2.drillView);
|
|
@@ -85713,16 +85719,15 @@ function identifierCode(name) {
|
|
|
85713
85719
|
return `\`${escapeIdentifier(name)}\``;
|
|
85714
85720
|
}
|
|
85715
85721
|
function getResultStructMetadataAnnotation(field2, resultMetadata) {
|
|
85716
|
-
var _a, _b
|
|
85722
|
+
var _a, _b;
|
|
85717
85723
|
const tag = malloy_tag_1$1.Tag.withPrefix("#(malloy) ");
|
|
85718
85724
|
let hasAny = false;
|
|
85719
85725
|
if (resultMetadata.limit !== void 0) {
|
|
85720
85726
|
tag.set(["limit"], resultMetadata.limit);
|
|
85721
85727
|
hasAny = true;
|
|
85722
85728
|
}
|
|
85723
|
-
|
|
85724
|
-
|
|
85725
|
-
addDrillFiltersTag(tag, drillFilters);
|
|
85729
|
+
if (resultMetadata.filterList) {
|
|
85730
|
+
addDrillFiltersTag(tag, resultMetadata.filterList);
|
|
85726
85731
|
hasAny = true;
|
|
85727
85732
|
}
|
|
85728
85733
|
if (resultMetadata.drillable) {
|
|
@@ -85732,8 +85737,8 @@ function getResultStructMetadataAnnotation(field2, resultMetadata) {
|
|
|
85732
85737
|
if (resultMetadata.orderBy) {
|
|
85733
85738
|
for (let i = 0; i < resultMetadata.orderBy.length; i++) {
|
|
85734
85739
|
const orderBy = resultMetadata.orderBy[i];
|
|
85735
|
-
const orderByField = typeof orderBy.field === "number" ? (
|
|
85736
|
-
const direction = (
|
|
85740
|
+
const orderByField = typeof orderBy.field === "number" ? (_a = field2.fields[orderBy.field - 1].as) !== null && _a !== void 0 ? _a : field2.fields[orderBy.field - 1].name : orderBy.field;
|
|
85741
|
+
const direction = (_b = orderBy.dir) !== null && _b !== void 0 ? _b : null;
|
|
85737
85742
|
tag.set(["ordered_by", i, orderByField], direction);
|
|
85738
85743
|
}
|
|
85739
85744
|
hasAny = true;
|
|
@@ -87000,7 +87005,7 @@ var malloy = {};
|
|
|
87000
87005
|
var version = {};
|
|
87001
87006
|
Object.defineProperty(version, "__esModule", { value: true });
|
|
87002
87007
|
version.MALLOY_VERSION = void 0;
|
|
87003
|
-
version.MALLOY_VERSION = "0.0.
|
|
87008
|
+
version.MALLOY_VERSION = "0.0.287";
|
|
87004
87009
|
Object.defineProperty(malloy, "__esModule", { value: true });
|
|
87005
87010
|
malloy.InMemoryModelCache = malloy.CacheManager = malloy.CSVWriter = malloy.JSONWriter = malloy.DataWriter = malloy.DataRecord = malloy.DataArray = malloy.Result = malloy.ExploreMaterializer = malloy.PreparedResultMaterializer = malloy.QueryMaterializer = malloy.ModelMaterializer = malloy.SingleConnectionRuntime = malloy.ConnectionRuntime = malloy.Runtime = malloy.ExploreField = malloy.JoinRelationship = malloy.QueryField = malloy.Query = malloy.StringField = malloy.UnsupportedField = malloy.JSONField = malloy.BooleanField = malloy.NumberField = malloy.TimestampField = malloy.DateField = malloy.TimestampTimeframe = malloy.DateTimeframe = malloy.AtomicField = malloy.AtomicFieldType = malloy.Explore = malloy.SourceRelationship = malloy.FixedConnectionMap = malloy.InMemoryURLReader = malloy.EmptyURLReader = malloy.PreparedResult = malloy.DocumentCompletion = malloy.DocumentSymbol = malloy.DocumentPosition = malloy.DocumentRange = malloy.DocumentTablePath = malloy.Parse = malloy.PreparedQuery = malloy.Model = malloy.MalloyError = malloy.Malloy = void 0;
|
|
87006
87011
|
const lang_1$1 = lang;
|
|
@@ -91230,6 +91235,44 @@ Object.defineProperty(connection, "__esModule", { value: true });
|
|
|
91230
91235
|
return annotation_12.annotationToTaglines;
|
|
91231
91236
|
} });
|
|
91232
91237
|
})(dist$2);
|
|
91238
|
+
const LEGACY_CHART_TAGS = ["bar_chart", "line_chart"];
|
|
91239
|
+
const VIZ_CHART_TYPES = ["bar", "line"];
|
|
91240
|
+
function legacyTagToVizType(legacyTag) {
|
|
91241
|
+
const legacyMap = {
|
|
91242
|
+
"bar_chart": "bar",
|
|
91243
|
+
"line_chart": "line",
|
|
91244
|
+
"table": "table",
|
|
91245
|
+
"dashboard": "dashboard"
|
|
91246
|
+
};
|
|
91247
|
+
return legacyMap[legacyTag] ?? legacyTag;
|
|
91248
|
+
}
|
|
91249
|
+
function convertLegacyToVizTag(tag) {
|
|
91250
|
+
var _a;
|
|
91251
|
+
if (tag.has("viz")) {
|
|
91252
|
+
return tag;
|
|
91253
|
+
}
|
|
91254
|
+
const properties = tag.properties ?? {};
|
|
91255
|
+
const tagNamesInOrder = Object.keys(properties).reverse();
|
|
91256
|
+
const legacyChartTag = tagNamesInOrder.find(
|
|
91257
|
+
(name) => LEGACY_CHART_TAGS.includes(name) && !properties[name].deleted
|
|
91258
|
+
);
|
|
91259
|
+
if (legacyChartTag) {
|
|
91260
|
+
const legacyTagObject = tag.tag(legacyChartTag);
|
|
91261
|
+
tag.set(["viz"], legacyTagToVizType(legacyChartTag));
|
|
91262
|
+
if ((_a = tag.properties) == null ? void 0 : _a["viz"]) {
|
|
91263
|
+
tag.properties["viz"].properties = legacyTagObject == null ? void 0 : legacyTagObject.properties;
|
|
91264
|
+
}
|
|
91265
|
+
return tag;
|
|
91266
|
+
}
|
|
91267
|
+
return tag;
|
|
91268
|
+
}
|
|
91269
|
+
function getChartTypeFromNormalizedTag(normalizedTag) {
|
|
91270
|
+
const vizType = normalizedTag.text("viz");
|
|
91271
|
+
if (vizType && VIZ_CHART_TYPES.includes(vizType)) {
|
|
91272
|
+
return vizType;
|
|
91273
|
+
}
|
|
91274
|
+
return void 0;
|
|
91275
|
+
}
|
|
91233
91276
|
function getDataTree(result, plugins = []) {
|
|
91234
91277
|
const fields = [];
|
|
91235
91278
|
for (const field2 of result.schema.fields) {
|
|
@@ -91371,7 +91414,15 @@ const RENDER_TAG_LIST = [
|
|
|
91371
91414
|
"segment_map"
|
|
91372
91415
|
];
|
|
91373
91416
|
function shouldRenderAs(field2, parent, tagOverride) {
|
|
91374
|
-
const tag =
|
|
91417
|
+
const tag = convertLegacyToVizTag(
|
|
91418
|
+
renderTagFromAnnotations(field2.annotations)
|
|
91419
|
+
);
|
|
91420
|
+
const vizType = tag.text("viz");
|
|
91421
|
+
if (vizType) {
|
|
91422
|
+
if (vizType === "table") return "table";
|
|
91423
|
+
if (vizType === "dashboard") return "dashboard";
|
|
91424
|
+
if (VIZ_CHART_TYPES.includes(vizType)) return "chart";
|
|
91425
|
+
}
|
|
91375
91426
|
const properties = tag.properties ?? {};
|
|
91376
91427
|
const tagNamesInOrder = Object.keys(properties).reverse();
|
|
91377
91428
|
for (const tagName of tagNamesInOrder) {
|
|
@@ -91394,7 +91445,7 @@ class FieldBase {
|
|
|
91394
91445
|
this.parent = parent;
|
|
91395
91446
|
this.valueSet = /* @__PURE__ */ new Set();
|
|
91396
91447
|
this._pluginData = /* @__PURE__ */ new Map();
|
|
91397
|
-
this.tag =
|
|
91448
|
+
this.tag = renderTagFromAnnotations(this.field.annotations);
|
|
91398
91449
|
this.metadataTag = tagFor(this.field, "#(malloy) ");
|
|
91399
91450
|
this.path = parent ? parent.isArray() ? [...parent.path] : [...parent.path, field2.name] : [];
|
|
91400
91451
|
this.renderAs = shouldRenderAs(field2, parent);
|
|
@@ -92687,6 +92738,13 @@ function tagFromAnnotations(annotations, prefix = "# ") {
|
|
|
92687
92738
|
const tagLines = ((_a = annotations == null ? void 0 : annotations.map((a2) => a2.value)) == null ? void 0 : _a.filter((l2) => l2.startsWith(prefix))) ?? [];
|
|
92688
92739
|
return dist$4.Tag.fromTagLines(tagLines).tag ?? new dist$4.Tag();
|
|
92689
92740
|
}
|
|
92741
|
+
function renderTagFromAnnotations(annotations) {
|
|
92742
|
+
var _a, _b;
|
|
92743
|
+
const defaultTagLines = ((_a = annotations == null ? void 0 : annotations.map((a2) => a2.value)) == null ? void 0 : _a.filter((l2) => l2.startsWith("# "))) ?? [];
|
|
92744
|
+
const renderTagLines = ((_b = annotations == null ? void 0 : annotations.map((a2) => a2.value)) == null ? void 0 : _b.filter((l2) => l2.startsWith("#r "))) ?? [];
|
|
92745
|
+
const allLines = [...defaultTagLines, ...renderTagLines];
|
|
92746
|
+
return dist$4.Tag.fromTagLines(allLines).tag ?? new dist$4.Tag();
|
|
92747
|
+
}
|
|
92690
92748
|
function formatTimeUnit(value2, unit2, options = {}) {
|
|
92691
92749
|
let unitString = unit2.toString();
|
|
92692
92750
|
if (options.terse) {
|
|
@@ -92818,15 +92876,15 @@ function notUndefined$1(x2) {
|
|
|
92818
92876
|
return x2 !== void 0;
|
|
92819
92877
|
}
|
|
92820
92878
|
function getBarChartSettings(explore, tagOverride) {
|
|
92821
|
-
const
|
|
92822
|
-
|
|
92823
|
-
const interactive2 = !tag.has("tooltip");
|
|
92824
|
-
const isSpark = (chart == null ? void 0 : chart.text("size")) === "spark" || tag.text("size") === "spark";
|
|
92825
|
-
if (!chart) {
|
|
92879
|
+
const normalizedTag = convertLegacyToVizTag(explore.tag);
|
|
92880
|
+
if (normalizedTag.text("viz") !== "bar") {
|
|
92826
92881
|
throw new Error(
|
|
92827
|
-
"Tried to render a
|
|
92882
|
+
"Tried to render a bar chart, but no viz=bar tag was found"
|
|
92828
92883
|
);
|
|
92829
92884
|
}
|
|
92885
|
+
const vizTag = normalizedTag.tag("viz");
|
|
92886
|
+
const interactive2 = !normalizedTag.has("tooltip");
|
|
92887
|
+
const isSpark = vizTag.text("size") === "spark" || normalizedTag.text("size") === "spark";
|
|
92830
92888
|
const xChannel = {
|
|
92831
92889
|
fields: [],
|
|
92832
92890
|
type: null
|
|
@@ -92842,43 +92900,45 @@ function getBarChartSettings(explore, tagOverride) {
|
|
|
92842
92900
|
function getField2(ref2) {
|
|
92843
92901
|
return explore.pathTo(explore.fieldAt([ref2]));
|
|
92844
92902
|
}
|
|
92845
|
-
const isStack2 =
|
|
92846
|
-
if (
|
|
92847
|
-
xChannel.fields.push(getField2(
|
|
92903
|
+
const isStack2 = vizTag.has("stack");
|
|
92904
|
+
if (vizTag.text("x")) {
|
|
92905
|
+
xChannel.fields.push(getField2(vizTag.text("x")));
|
|
92848
92906
|
}
|
|
92849
|
-
if (
|
|
92850
|
-
yChannel.fields.push(getField2(
|
|
92851
|
-
} else if (
|
|
92852
|
-
yChannel.fields.push(...
|
|
92907
|
+
if (vizTag.text("y")) {
|
|
92908
|
+
yChannel.fields.push(getField2(vizTag.text("y")));
|
|
92909
|
+
} else if (vizTag.textArray("y")) {
|
|
92910
|
+
yChannel.fields.push(...vizTag.textArray("y").map(getField2));
|
|
92853
92911
|
}
|
|
92854
|
-
if (
|
|
92855
|
-
seriesChannel.fields.push(getField2(
|
|
92912
|
+
if (vizTag.text("series")) {
|
|
92913
|
+
seriesChannel.fields.push(getField2(vizTag.text("series")));
|
|
92856
92914
|
}
|
|
92857
92915
|
const embeddedX = [];
|
|
92858
92916
|
const embeddedY = [];
|
|
92859
92917
|
const embeddedSeries = [];
|
|
92860
|
-
|
|
92861
|
-
|
|
92862
|
-
|
|
92863
|
-
|
|
92864
|
-
|
|
92865
|
-
|
|
92866
|
-
|
|
92867
|
-
|
|
92868
|
-
|
|
92869
|
-
|
|
92870
|
-
|
|
92871
|
-
|
|
92872
|
-
|
|
92873
|
-
|
|
92874
|
-
|
|
92875
|
-
|
|
92876
|
-
|
|
92877
|
-
|
|
92878
|
-
|
|
92879
|
-
|
|
92880
|
-
|
|
92881
|
-
|
|
92918
|
+
if (!vizTag.has("disableEmbedded")) {
|
|
92919
|
+
walkFields(explore, (field2) => {
|
|
92920
|
+
const tag = field2.tag;
|
|
92921
|
+
const pathTo = explore.pathTo(field2);
|
|
92922
|
+
if (tag.has("x")) {
|
|
92923
|
+
embeddedX.push(pathTo);
|
|
92924
|
+
}
|
|
92925
|
+
if (tag.has("y")) {
|
|
92926
|
+
embeddedY.push(pathTo);
|
|
92927
|
+
}
|
|
92928
|
+
if (tag.has("series")) {
|
|
92929
|
+
embeddedSeries.push(pathTo);
|
|
92930
|
+
}
|
|
92931
|
+
});
|
|
92932
|
+
embeddedX.forEach((path2) => {
|
|
92933
|
+
xChannel.fields.push(path2);
|
|
92934
|
+
});
|
|
92935
|
+
embeddedY.forEach((path2) => {
|
|
92936
|
+
yChannel.fields.push(path2);
|
|
92937
|
+
});
|
|
92938
|
+
embeddedSeries.forEach((path2) => {
|
|
92939
|
+
seriesChannel.fields.push(path2);
|
|
92940
|
+
});
|
|
92941
|
+
}
|
|
92882
92942
|
const dimensions2 = explore.fields.filter(
|
|
92883
92943
|
(f2) => f2.isBasic() && f2.wasDimension()
|
|
92884
92944
|
);
|
|
@@ -199932,11 +199992,11 @@ function getLimitedData({
|
|
|
199932
199992
|
}
|
|
199933
199993
|
function generateBarChartVegaSpec(explore, metadata2) {
|
|
199934
199994
|
var _a;
|
|
199935
|
-
const tag = explore.tag;
|
|
199936
|
-
const chartTag = tag.tag("
|
|
199995
|
+
const tag = convertLegacyToVizTag(explore.tag);
|
|
199996
|
+
const chartTag = tag.tag("viz");
|
|
199937
199997
|
if (!chartTag)
|
|
199938
199998
|
throw new Error(
|
|
199939
|
-
"Bar chart should only be rendered for bar_chart or bar tag"
|
|
199999
|
+
"Bar chart should only be rendered for bar_chart or viz=bar tag"
|
|
199940
200000
|
);
|
|
199941
200001
|
const settings = getBarChartSettings(explore);
|
|
199942
200002
|
const xFieldPath = settings.xChannel.fields.at(0);
|
|
@@ -199983,7 +200043,7 @@ function generateBarChartVegaSpec(explore, metadata2) {
|
|
|
199983
200043
|
metadata: metadata2,
|
|
199984
200044
|
xField,
|
|
199985
200045
|
yField,
|
|
199986
|
-
chartType: "
|
|
200046
|
+
chartType: "bar",
|
|
199987
200047
|
getYMinMax: () => [yDomainMin, yDomainMax],
|
|
199988
200048
|
independentY: chartTag.has("y", "independent")
|
|
199989
200049
|
// TODO implement this so can calculate data limits here
|
|
@@ -200585,7 +200645,7 @@ function generateBarChartVegaSpec(explore, metadata2) {
|
|
|
200585
200645
|
plotHeight: chartSettings.plotHeight,
|
|
200586
200646
|
totalWidth: chartSettings.totalWidth,
|
|
200587
200647
|
totalHeight: chartSettings.totalHeight,
|
|
200588
|
-
chartType: "
|
|
200648
|
+
chartType: "bar",
|
|
200589
200649
|
chartTag,
|
|
200590
200650
|
mapMalloyDataToChartData,
|
|
200591
200651
|
getTooltipData: (item, view2) => {
|
|
@@ -200663,16 +200723,30 @@ function generateBarChartVegaSpec(explore, metadata2) {
|
|
|
200663
200723
|
}
|
|
200664
200724
|
};
|
|
200665
200725
|
}
|
|
200726
|
+
const defaultSettings = {
|
|
200727
|
+
size: "fill",
|
|
200728
|
+
line_chart: {
|
|
200729
|
+
zero_baseline: false
|
|
200730
|
+
}
|
|
200731
|
+
};
|
|
200666
200732
|
function getLineChartSettings(explore, tagOverride) {
|
|
200667
|
-
const
|
|
200668
|
-
|
|
200669
|
-
if (!chart) {
|
|
200733
|
+
const normalizedTag = convertLegacyToVizTag(tagOverride ?? explore.tag);
|
|
200734
|
+
if (normalizedTag.text("viz") !== "line") {
|
|
200670
200735
|
throw new Error(
|
|
200671
|
-
"Malloy Line Chart: Tried to render a line chart, but no
|
|
200736
|
+
"Malloy Line Chart: Tried to render a line chart, but no viz=line tag was found"
|
|
200672
200737
|
);
|
|
200673
200738
|
}
|
|
200674
|
-
const
|
|
200675
|
-
|
|
200739
|
+
const vizTag = normalizedTag.tag("viz");
|
|
200740
|
+
let zeroBaseline = defaultSettings.line_chart.zero_baseline;
|
|
200741
|
+
if (vizTag.has("zero_baseline")) {
|
|
200742
|
+
const value2 = vizTag.text("zero_baseline");
|
|
200743
|
+
if (value2 === "false") {
|
|
200744
|
+
zeroBaseline = false;
|
|
200745
|
+
} else if (value2 === "true" || value2 === null || value2 === void 0 || value2 === "") {
|
|
200746
|
+
zeroBaseline = true;
|
|
200747
|
+
}
|
|
200748
|
+
}
|
|
200749
|
+
const interactive2 = !normalizedTag.has("tooltip");
|
|
200676
200750
|
const xChannel = {
|
|
200677
200751
|
fields: [],
|
|
200678
200752
|
type: null
|
|
@@ -200688,42 +200762,44 @@ function getLineChartSettings(explore, tagOverride) {
|
|
|
200688
200762
|
function getField2(ref2) {
|
|
200689
200763
|
return explore.pathTo(explore.fieldAt([ref2]));
|
|
200690
200764
|
}
|
|
200691
|
-
if (
|
|
200692
|
-
xChannel.fields.push(getField2(
|
|
200765
|
+
if (vizTag.text("x")) {
|
|
200766
|
+
xChannel.fields.push(getField2(vizTag.text("x")));
|
|
200693
200767
|
}
|
|
200694
|
-
if (
|
|
200695
|
-
yChannel.fields.push(getField2(
|
|
200696
|
-
} else if (
|
|
200697
|
-
yChannel.fields.push(...
|
|
200768
|
+
if (vizTag.text("y")) {
|
|
200769
|
+
yChannel.fields.push(getField2(vizTag.text("y")));
|
|
200770
|
+
} else if (vizTag.textArray("y")) {
|
|
200771
|
+
yChannel.fields.push(...vizTag.textArray("y").map(getField2));
|
|
200698
200772
|
}
|
|
200699
|
-
if (
|
|
200700
|
-
seriesChannel.fields.push(getField2(
|
|
200773
|
+
if (vizTag.text("series")) {
|
|
200774
|
+
seriesChannel.fields.push(getField2(vizTag.text("series")));
|
|
200701
200775
|
}
|
|
200702
200776
|
const embeddedX = [];
|
|
200703
200777
|
const embeddedY = [];
|
|
200704
200778
|
const embeddedSeries = [];
|
|
200705
|
-
|
|
200706
|
-
|
|
200707
|
-
|
|
200708
|
-
|
|
200709
|
-
|
|
200710
|
-
|
|
200711
|
-
|
|
200712
|
-
|
|
200713
|
-
|
|
200714
|
-
|
|
200715
|
-
|
|
200716
|
-
|
|
200717
|
-
|
|
200718
|
-
|
|
200719
|
-
|
|
200720
|
-
|
|
200721
|
-
|
|
200722
|
-
|
|
200723
|
-
|
|
200724
|
-
|
|
200725
|
-
|
|
200726
|
-
|
|
200779
|
+
if (!vizTag.has("disableEmbedded")) {
|
|
200780
|
+
walkFields(explore, (field2) => {
|
|
200781
|
+
const tag = field2.tag;
|
|
200782
|
+
const pathTo = explore.pathTo(field2);
|
|
200783
|
+
if (tag.has("x")) {
|
|
200784
|
+
embeddedX.push(pathTo);
|
|
200785
|
+
}
|
|
200786
|
+
if (tag.has("y")) {
|
|
200787
|
+
embeddedY.push(pathTo);
|
|
200788
|
+
}
|
|
200789
|
+
if (tag.has("series")) {
|
|
200790
|
+
embeddedSeries.push(pathTo);
|
|
200791
|
+
}
|
|
200792
|
+
});
|
|
200793
|
+
embeddedX.forEach((path2) => {
|
|
200794
|
+
xChannel.fields.push(path2);
|
|
200795
|
+
});
|
|
200796
|
+
embeddedY.forEach((path2) => {
|
|
200797
|
+
yChannel.fields.push(path2);
|
|
200798
|
+
});
|
|
200799
|
+
embeddedSeries.forEach((path2) => {
|
|
200800
|
+
seriesChannel.fields.push(path2);
|
|
200801
|
+
});
|
|
200802
|
+
}
|
|
200727
200803
|
const dimensions2 = explore.fields.filter(
|
|
200728
200804
|
(f2) => f2.isBasic() && f2.wasDimension()
|
|
200729
200805
|
);
|
|
@@ -200798,11 +200874,11 @@ function generateLineChartVegaSpec(explore, metadata2) {
|
|
|
200798
200874
|
"Malloy Line Chart: Trying to render a line chart when Line chart series plugin not found"
|
|
200799
200875
|
);
|
|
200800
200876
|
}
|
|
200801
|
-
const tag = explore.tag;
|
|
200802
|
-
const chartTag = tag.tag("
|
|
200877
|
+
const tag = convertLegacyToVizTag(explore.tag);
|
|
200878
|
+
const chartTag = tag.tag("viz");
|
|
200803
200879
|
if (!chartTag)
|
|
200804
200880
|
throw new Error(
|
|
200805
|
-
"Malloy Line Chart:
|
|
200881
|
+
"Malloy Line Chart: Tried to render a line chart, but no viz=line tag was found"
|
|
200806
200882
|
);
|
|
200807
200883
|
const settings = getLineChartSettings(explore, tag);
|
|
200808
200884
|
const xFieldPath = settings.xChannel.fields.at(0);
|
|
@@ -200857,7 +200933,7 @@ function generateLineChartVegaSpec(explore, metadata2) {
|
|
|
200857
200933
|
metadata: metadata2,
|
|
200858
200934
|
xField,
|
|
200859
200935
|
yField,
|
|
200860
|
-
chartType: "
|
|
200936
|
+
chartType: "line",
|
|
200861
200937
|
getYMinMax: () => [yDomainMin, yDomainMax],
|
|
200862
200938
|
independentY: chartTag.has("y", "independent") || isLimitingSeries
|
|
200863
200939
|
});
|
|
@@ -201516,7 +201592,7 @@ function generateLineChartVegaSpec(explore, metadata2) {
|
|
|
201516
201592
|
plotHeight: chartSettings.plotHeight,
|
|
201517
201593
|
totalWidth: chartSettings.totalWidth,
|
|
201518
201594
|
totalHeight: chartSettings.totalHeight,
|
|
201519
|
-
chartType: "
|
|
201595
|
+
chartType: "line",
|
|
201520
201596
|
chartTag,
|
|
201521
201597
|
mapMalloyDataToChartData,
|
|
201522
201598
|
getTooltipData(item, view2) {
|
|
@@ -201616,9 +201692,6 @@ function generateLineChartVegaSpec(explore, metadata2) {
|
|
|
201616
201692
|
}
|
|
201617
201693
|
};
|
|
201618
201694
|
}
|
|
201619
|
-
const defaultSettings = {
|
|
201620
|
-
size: "fill"
|
|
201621
|
-
};
|
|
201622
201695
|
function getResultMetadata(root2, options = { parentSize: { width: 0, height: 0 } }) {
|
|
201623
201696
|
const rootTag = root2.field.tag;
|
|
201624
201697
|
const rootSizingStrategy = rootTag.has("size") && rootTag.text("size") !== "fill" ? "fixed" : defaultSettings.size;
|
|
@@ -201645,13 +201718,9 @@ function populateAllVegaSpecs(root2, metadata2, options) {
|
|
|
201645
201718
|
}
|
|
201646
201719
|
});
|
|
201647
201720
|
}
|
|
201648
|
-
const CHART_TAG_LIST = ["bar_chart", "line_chart"];
|
|
201649
201721
|
function shouldRenderChartAs(tag) {
|
|
201650
|
-
const
|
|
201651
|
-
|
|
201652
|
-
return tagNamesInOrder.find(
|
|
201653
|
-
(name) => CHART_TAG_LIST.includes(name) && !properties[name].deleted
|
|
201654
|
-
);
|
|
201722
|
+
const normalizedTag = convertLegacyToVizTag(tag);
|
|
201723
|
+
return getChartTypeFromNormalizedTag(normalizedTag);
|
|
201655
201724
|
}
|
|
201656
201725
|
function populateVegaSpec(field2, metadata2, options) {
|
|
201657
201726
|
var _a, _b, _c, _d, _e;
|
|
@@ -201663,9 +201732,9 @@ function populateVegaSpec(field2, metadata2, options) {
|
|
|
201663
201732
|
runtime: null
|
|
201664
201733
|
};
|
|
201665
201734
|
try {
|
|
201666
|
-
if (chartType === "
|
|
201735
|
+
if (chartType === "bar") {
|
|
201667
201736
|
vegaChartProps = generateBarChartVegaSpec(field2, metadata2);
|
|
201668
|
-
} else if (chartType === "
|
|
201737
|
+
} else if (chartType === "line") {
|
|
201669
201738
|
vegaChartProps = generateLineChartVegaSpec(field2, metadata2);
|
|
201670
201739
|
}
|
|
201671
201740
|
} catch (error2) {
|