@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
|
@@ -27471,7 +27471,7 @@ ${spaces}}`;
|
|
|
27471
27471
|
return new Tag(structuredClone(this));
|
|
27472
27472
|
}
|
|
27473
27473
|
static escapeString(str) {
|
|
27474
|
-
return str.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
27474
|
+
return str.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n");
|
|
27475
27475
|
}
|
|
27476
27476
|
static escapeProp(str) {
|
|
27477
27477
|
return str.replace(/\\/g, "\\\\").replace(/`/g, "\\`");
|
|
@@ -53601,7 +53601,8 @@ ${left} `;
|
|
|
53601
53601
|
code: this.exprSrc,
|
|
53602
53602
|
e: { node: "false" },
|
|
53603
53603
|
expressionType: "scalar",
|
|
53604
|
-
fieldUsage: exprVal.fieldUsage
|
|
53604
|
+
fieldUsage: exprVal.fieldUsage,
|
|
53605
|
+
isSourceFilter: false
|
|
53605
53606
|
};
|
|
53606
53607
|
}
|
|
53607
53608
|
const stableFilter = this.getStableFilter();
|
|
@@ -53611,7 +53612,8 @@ ${left} `;
|
|
|
53611
53612
|
e: exprVal.value,
|
|
53612
53613
|
expressionType: exprVal.expressionType,
|
|
53613
53614
|
fieldUsage: exprVal.fieldUsage,
|
|
53614
|
-
stableFilter
|
|
53615
|
+
stableFilter,
|
|
53616
|
+
isSourceFilter: false
|
|
53615
53617
|
};
|
|
53616
53618
|
return exprCond;
|
|
53617
53619
|
}
|
|
@@ -53934,6 +53936,7 @@ ${left} `;
|
|
|
53934
53936
|
const exprCond = {
|
|
53935
53937
|
node: "filterCondition",
|
|
53936
53938
|
code: filter2.exprSrc,
|
|
53939
|
+
isSourceFilter: false,
|
|
53937
53940
|
e: collectedWheres === void 0 ? fExpr.value : {
|
|
53938
53941
|
node: "and",
|
|
53939
53942
|
kids: { left: collectedWheres, right: fExpr.value }
|
|
@@ -56445,7 +56448,10 @@ ${left} `;
|
|
|
56445
56448
|
if ((0, malloy_types_1$u.expressionIsCalculation)(fc.expressionType)) {
|
|
56446
56449
|
el.logError("aggregate-in-source-filter", "Can't use aggregate computations in top level filters");
|
|
56447
56450
|
} else {
|
|
56448
|
-
filterList.push(
|
|
56451
|
+
filterList.push({
|
|
56452
|
+
...fc,
|
|
56453
|
+
isSourceFilter: true
|
|
56454
|
+
});
|
|
56449
56455
|
moreFilters = true;
|
|
56450
56456
|
}
|
|
56451
56457
|
}
|
|
@@ -85622,7 +85628,6 @@ ${cooked}`;
|
|
|
85622
85628
|
return result;
|
|
85623
85629
|
}
|
|
85624
85630
|
function getResultMetadataAnnotation(field2, resultMetadata) {
|
|
85625
|
-
var _a;
|
|
85626
85631
|
const tag = malloy_tag_1$1.Tag.withPrefix("#(malloy) ");
|
|
85627
85632
|
let hasAny = false;
|
|
85628
85633
|
if (resultMetadata.referenceId !== void 0) {
|
|
@@ -85643,9 +85648,8 @@ ${cooked}`;
|
|
|
85643
85648
|
hasAny = true;
|
|
85644
85649
|
}
|
|
85645
85650
|
}
|
|
85646
|
-
|
|
85647
|
-
|
|
85648
|
-
addDrillFiltersTag(tag, drillFilters);
|
|
85651
|
+
if (resultMetadata.filterList) {
|
|
85652
|
+
addDrillFiltersTag(tag, resultMetadata.filterList);
|
|
85649
85653
|
hasAny = true;
|
|
85650
85654
|
}
|
|
85651
85655
|
if (resultMetadata.fieldKind === "dimension") {
|
|
@@ -85662,6 +85666,8 @@ ${cooked}`;
|
|
|
85662
85666
|
var _a;
|
|
85663
85667
|
for (let i2 = 0; i2 < drillFilters.length; i2++) {
|
|
85664
85668
|
const filter2 = drillFilters[i2];
|
|
85669
|
+
if (filter2.expressionType !== "scalar" || filter2.isSourceFilter)
|
|
85670
|
+
continue;
|
|
85665
85671
|
tag.set(["drill_filters", i2, "code"], filter2.code);
|
|
85666
85672
|
if (filter2.drillView) {
|
|
85667
85673
|
tag.set(["drill_filters", i2, "drill_view"], filter2.drillView);
|
|
@@ -85717,16 +85723,15 @@ ${cooked}`;
|
|
|
85717
85723
|
return `\`${escapeIdentifier(name)}\``;
|
|
85718
85724
|
}
|
|
85719
85725
|
function getResultStructMetadataAnnotation(field2, resultMetadata) {
|
|
85720
|
-
var _a, _b
|
|
85726
|
+
var _a, _b;
|
|
85721
85727
|
const tag = malloy_tag_1$1.Tag.withPrefix("#(malloy) ");
|
|
85722
85728
|
let hasAny = false;
|
|
85723
85729
|
if (resultMetadata.limit !== void 0) {
|
|
85724
85730
|
tag.set(["limit"], resultMetadata.limit);
|
|
85725
85731
|
hasAny = true;
|
|
85726
85732
|
}
|
|
85727
|
-
|
|
85728
|
-
|
|
85729
|
-
addDrillFiltersTag(tag, drillFilters);
|
|
85733
|
+
if (resultMetadata.filterList) {
|
|
85734
|
+
addDrillFiltersTag(tag, resultMetadata.filterList);
|
|
85730
85735
|
hasAny = true;
|
|
85731
85736
|
}
|
|
85732
85737
|
if (resultMetadata.drillable) {
|
|
@@ -85736,8 +85741,8 @@ ${cooked}`;
|
|
|
85736
85741
|
if (resultMetadata.orderBy) {
|
|
85737
85742
|
for (let i2 = 0; i2 < resultMetadata.orderBy.length; i2++) {
|
|
85738
85743
|
const orderBy = resultMetadata.orderBy[i2];
|
|
85739
|
-
const orderByField = typeof orderBy.field === "number" ? (
|
|
85740
|
-
const direction = (
|
|
85744
|
+
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;
|
|
85745
|
+
const direction = (_b = orderBy.dir) !== null && _b !== void 0 ? _b : null;
|
|
85741
85746
|
tag.set(["ordered_by", i2, orderByField], direction);
|
|
85742
85747
|
}
|
|
85743
85748
|
hasAny = true;
|
|
@@ -87004,7 +87009,7 @@ ${cooked}`;
|
|
|
87004
87009
|
var version = {};
|
|
87005
87010
|
Object.defineProperty(version, "__esModule", { value: true });
|
|
87006
87011
|
version.MALLOY_VERSION = void 0;
|
|
87007
|
-
version.MALLOY_VERSION = "0.0.
|
|
87012
|
+
version.MALLOY_VERSION = "0.0.287";
|
|
87008
87013
|
Object.defineProperty(malloy, "__esModule", { value: true });
|
|
87009
87014
|
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;
|
|
87010
87015
|
const lang_1$1 = lang;
|
|
@@ -91234,6 +91239,44 @@ ${errText}`, errors2);
|
|
|
91234
91239
|
return annotation_12.annotationToTaglines;
|
|
91235
91240
|
} });
|
|
91236
91241
|
})(dist$2);
|
|
91242
|
+
const LEGACY_CHART_TAGS = ["bar_chart", "line_chart"];
|
|
91243
|
+
const VIZ_CHART_TYPES = ["bar", "line"];
|
|
91244
|
+
function legacyTagToVizType(legacyTag) {
|
|
91245
|
+
const legacyMap = {
|
|
91246
|
+
"bar_chart": "bar",
|
|
91247
|
+
"line_chart": "line",
|
|
91248
|
+
"table": "table",
|
|
91249
|
+
"dashboard": "dashboard"
|
|
91250
|
+
};
|
|
91251
|
+
return legacyMap[legacyTag] ?? legacyTag;
|
|
91252
|
+
}
|
|
91253
|
+
function convertLegacyToVizTag(tag) {
|
|
91254
|
+
var _a;
|
|
91255
|
+
if (tag.has("viz")) {
|
|
91256
|
+
return tag;
|
|
91257
|
+
}
|
|
91258
|
+
const properties = tag.properties ?? {};
|
|
91259
|
+
const tagNamesInOrder = Object.keys(properties).reverse();
|
|
91260
|
+
const legacyChartTag = tagNamesInOrder.find(
|
|
91261
|
+
(name) => LEGACY_CHART_TAGS.includes(name) && !properties[name].deleted
|
|
91262
|
+
);
|
|
91263
|
+
if (legacyChartTag) {
|
|
91264
|
+
const legacyTagObject = tag.tag(legacyChartTag);
|
|
91265
|
+
tag.set(["viz"], legacyTagToVizType(legacyChartTag));
|
|
91266
|
+
if ((_a = tag.properties) == null ? void 0 : _a["viz"]) {
|
|
91267
|
+
tag.properties["viz"].properties = legacyTagObject == null ? void 0 : legacyTagObject.properties;
|
|
91268
|
+
}
|
|
91269
|
+
return tag;
|
|
91270
|
+
}
|
|
91271
|
+
return tag;
|
|
91272
|
+
}
|
|
91273
|
+
function getChartTypeFromNormalizedTag(normalizedTag) {
|
|
91274
|
+
const vizType = normalizedTag.text("viz");
|
|
91275
|
+
if (vizType && VIZ_CHART_TYPES.includes(vizType)) {
|
|
91276
|
+
return vizType;
|
|
91277
|
+
}
|
|
91278
|
+
return void 0;
|
|
91279
|
+
}
|
|
91237
91280
|
function getDataTree(result, plugins = []) {
|
|
91238
91281
|
const fields = [];
|
|
91239
91282
|
for (const field2 of result.schema.fields) {
|
|
@@ -91375,7 +91418,15 @@ ${errText}`, errors2);
|
|
|
91375
91418
|
"segment_map"
|
|
91376
91419
|
];
|
|
91377
91420
|
function shouldRenderAs(field2, parent, tagOverride) {
|
|
91378
|
-
const tag =
|
|
91421
|
+
const tag = convertLegacyToVizTag(
|
|
91422
|
+
renderTagFromAnnotations(field2.annotations)
|
|
91423
|
+
);
|
|
91424
|
+
const vizType = tag.text("viz");
|
|
91425
|
+
if (vizType) {
|
|
91426
|
+
if (vizType === "table") return "table";
|
|
91427
|
+
if (vizType === "dashboard") return "dashboard";
|
|
91428
|
+
if (VIZ_CHART_TYPES.includes(vizType)) return "chart";
|
|
91429
|
+
}
|
|
91379
91430
|
const properties = tag.properties ?? {};
|
|
91380
91431
|
const tagNamesInOrder = Object.keys(properties).reverse();
|
|
91381
91432
|
for (const tagName of tagNamesInOrder) {
|
|
@@ -91398,7 +91449,7 @@ ${errText}`, errors2);
|
|
|
91398
91449
|
this.parent = parent;
|
|
91399
91450
|
this.valueSet = /* @__PURE__ */ new Set();
|
|
91400
91451
|
this._pluginData = /* @__PURE__ */ new Map();
|
|
91401
|
-
this.tag =
|
|
91452
|
+
this.tag = renderTagFromAnnotations(this.field.annotations);
|
|
91402
91453
|
this.metadataTag = tagFor(this.field, "#(malloy) ");
|
|
91403
91454
|
this.path = parent ? parent.isArray() ? [...parent.path] : [...parent.path, field2.name] : [];
|
|
91404
91455
|
this.renderAs = shouldRenderAs(field2, parent);
|
|
@@ -92691,6 +92742,13 @@ ${expressions.map((entry2) => ` ${entry2}`).join(",\n")}
|
|
|
92691
92742
|
const tagLines = ((_a = annotations == null ? void 0 : annotations.map((a2) => a2.value)) == null ? void 0 : _a.filter((l2) => l2.startsWith(prefix))) ?? [];
|
|
92692
92743
|
return dist$4.Tag.fromTagLines(tagLines).tag ?? new dist$4.Tag();
|
|
92693
92744
|
}
|
|
92745
|
+
function renderTagFromAnnotations(annotations) {
|
|
92746
|
+
var _a, _b;
|
|
92747
|
+
const defaultTagLines = ((_a = annotations == null ? void 0 : annotations.map((a2) => a2.value)) == null ? void 0 : _a.filter((l2) => l2.startsWith("# "))) ?? [];
|
|
92748
|
+
const renderTagLines = ((_b = annotations == null ? void 0 : annotations.map((a2) => a2.value)) == null ? void 0 : _b.filter((l2) => l2.startsWith("#r "))) ?? [];
|
|
92749
|
+
const allLines = [...defaultTagLines, ...renderTagLines];
|
|
92750
|
+
return dist$4.Tag.fromTagLines(allLines).tag ?? new dist$4.Tag();
|
|
92751
|
+
}
|
|
92694
92752
|
function formatTimeUnit(value2, unit2, options = {}) {
|
|
92695
92753
|
let unitString = unit2.toString();
|
|
92696
92754
|
if (options.terse) {
|
|
@@ -92822,15 +92880,15 @@ ${expressions.map((entry2) => ` ${entry2}`).join(",\n")}
|
|
|
92822
92880
|
return x2 !== void 0;
|
|
92823
92881
|
}
|
|
92824
92882
|
function getBarChartSettings(explore, tagOverride) {
|
|
92825
|
-
const
|
|
92826
|
-
|
|
92827
|
-
const interactive2 = !tag.has("tooltip");
|
|
92828
|
-
const isSpark = (chart == null ? void 0 : chart.text("size")) === "spark" || tag.text("size") === "spark";
|
|
92829
|
-
if (!chart) {
|
|
92883
|
+
const normalizedTag = convertLegacyToVizTag(explore.tag);
|
|
92884
|
+
if (normalizedTag.text("viz") !== "bar") {
|
|
92830
92885
|
throw new Error(
|
|
92831
|
-
"Tried to render a
|
|
92886
|
+
"Tried to render a bar chart, but no viz=bar tag was found"
|
|
92832
92887
|
);
|
|
92833
92888
|
}
|
|
92889
|
+
const vizTag = normalizedTag.tag("viz");
|
|
92890
|
+
const interactive2 = !normalizedTag.has("tooltip");
|
|
92891
|
+
const isSpark = vizTag.text("size") === "spark" || normalizedTag.text("size") === "spark";
|
|
92834
92892
|
const xChannel = {
|
|
92835
92893
|
fields: [],
|
|
92836
92894
|
type: null
|
|
@@ -92846,43 +92904,45 @@ ${expressions.map((entry2) => ` ${entry2}`).join(",\n")}
|
|
|
92846
92904
|
function getField2(ref2) {
|
|
92847
92905
|
return explore.pathTo(explore.fieldAt([ref2]));
|
|
92848
92906
|
}
|
|
92849
|
-
const isStack2 =
|
|
92850
|
-
if (
|
|
92851
|
-
xChannel.fields.push(getField2(
|
|
92907
|
+
const isStack2 = vizTag.has("stack");
|
|
92908
|
+
if (vizTag.text("x")) {
|
|
92909
|
+
xChannel.fields.push(getField2(vizTag.text("x")));
|
|
92852
92910
|
}
|
|
92853
|
-
if (
|
|
92854
|
-
yChannel.fields.push(getField2(
|
|
92855
|
-
} else if (
|
|
92856
|
-
yChannel.fields.push(...
|
|
92911
|
+
if (vizTag.text("y")) {
|
|
92912
|
+
yChannel.fields.push(getField2(vizTag.text("y")));
|
|
92913
|
+
} else if (vizTag.textArray("y")) {
|
|
92914
|
+
yChannel.fields.push(...vizTag.textArray("y").map(getField2));
|
|
92857
92915
|
}
|
|
92858
|
-
if (
|
|
92859
|
-
seriesChannel.fields.push(getField2(
|
|
92916
|
+
if (vizTag.text("series")) {
|
|
92917
|
+
seriesChannel.fields.push(getField2(vizTag.text("series")));
|
|
92860
92918
|
}
|
|
92861
92919
|
const embeddedX = [];
|
|
92862
92920
|
const embeddedY = [];
|
|
92863
92921
|
const embeddedSeries = [];
|
|
92864
|
-
|
|
92865
|
-
|
|
92866
|
-
|
|
92867
|
-
|
|
92868
|
-
|
|
92869
|
-
|
|
92870
|
-
|
|
92871
|
-
|
|
92872
|
-
|
|
92873
|
-
|
|
92874
|
-
|
|
92875
|
-
|
|
92876
|
-
|
|
92877
|
-
|
|
92878
|
-
|
|
92879
|
-
|
|
92880
|
-
|
|
92881
|
-
|
|
92882
|
-
|
|
92883
|
-
|
|
92884
|
-
|
|
92885
|
-
|
|
92922
|
+
if (!vizTag.has("disableEmbedded")) {
|
|
92923
|
+
walkFields(explore, (field2) => {
|
|
92924
|
+
const tag = field2.tag;
|
|
92925
|
+
const pathTo = explore.pathTo(field2);
|
|
92926
|
+
if (tag.has("x")) {
|
|
92927
|
+
embeddedX.push(pathTo);
|
|
92928
|
+
}
|
|
92929
|
+
if (tag.has("y")) {
|
|
92930
|
+
embeddedY.push(pathTo);
|
|
92931
|
+
}
|
|
92932
|
+
if (tag.has("series")) {
|
|
92933
|
+
embeddedSeries.push(pathTo);
|
|
92934
|
+
}
|
|
92935
|
+
});
|
|
92936
|
+
embeddedX.forEach((path2) => {
|
|
92937
|
+
xChannel.fields.push(path2);
|
|
92938
|
+
});
|
|
92939
|
+
embeddedY.forEach((path2) => {
|
|
92940
|
+
yChannel.fields.push(path2);
|
|
92941
|
+
});
|
|
92942
|
+
embeddedSeries.forEach((path2) => {
|
|
92943
|
+
seriesChannel.fields.push(path2);
|
|
92944
|
+
});
|
|
92945
|
+
}
|
|
92886
92946
|
const dimensions2 = explore.fields.filter(
|
|
92887
92947
|
(f2) => f2.isBasic() && f2.wasDimension()
|
|
92888
92948
|
);
|
|
@@ -199936,11 +199996,11 @@ ${expressions.map((entry2) => ` ${entry2}`).join(",\n")}
|
|
|
199936
199996
|
}
|
|
199937
199997
|
function generateBarChartVegaSpec(explore, metadata2) {
|
|
199938
199998
|
var _a;
|
|
199939
|
-
const tag = explore.tag;
|
|
199940
|
-
const chartTag = tag.tag("
|
|
199999
|
+
const tag = convertLegacyToVizTag(explore.tag);
|
|
200000
|
+
const chartTag = tag.tag("viz");
|
|
199941
200001
|
if (!chartTag)
|
|
199942
200002
|
throw new Error(
|
|
199943
|
-
"Bar chart should only be rendered for bar_chart or bar tag"
|
|
200003
|
+
"Bar chart should only be rendered for bar_chart or viz=bar tag"
|
|
199944
200004
|
);
|
|
199945
200005
|
const settings = getBarChartSettings(explore);
|
|
199946
200006
|
const xFieldPath = settings.xChannel.fields.at(0);
|
|
@@ -199987,7 +200047,7 @@ ${expressions.map((entry2) => ` ${entry2}`).join(",\n")}
|
|
|
199987
200047
|
metadata: metadata2,
|
|
199988
200048
|
xField,
|
|
199989
200049
|
yField,
|
|
199990
|
-
chartType: "
|
|
200050
|
+
chartType: "bar",
|
|
199991
200051
|
getYMinMax: () => [yDomainMin, yDomainMax],
|
|
199992
200052
|
independentY: chartTag.has("y", "independent")
|
|
199993
200053
|
// TODO implement this so can calculate data limits here
|
|
@@ -200589,7 +200649,7 @@ ${expressions.map((entry2) => ` ${entry2}`).join(",\n")}
|
|
|
200589
200649
|
plotHeight: chartSettings.plotHeight,
|
|
200590
200650
|
totalWidth: chartSettings.totalWidth,
|
|
200591
200651
|
totalHeight: chartSettings.totalHeight,
|
|
200592
|
-
chartType: "
|
|
200652
|
+
chartType: "bar",
|
|
200593
200653
|
chartTag,
|
|
200594
200654
|
mapMalloyDataToChartData,
|
|
200595
200655
|
getTooltipData: (item, view2) => {
|
|
@@ -200667,16 +200727,30 @@ ${expressions.map((entry2) => ` ${entry2}`).join(",\n")}
|
|
|
200667
200727
|
}
|
|
200668
200728
|
};
|
|
200669
200729
|
}
|
|
200730
|
+
const defaultSettings = {
|
|
200731
|
+
size: "fill",
|
|
200732
|
+
line_chart: {
|
|
200733
|
+
zero_baseline: false
|
|
200734
|
+
}
|
|
200735
|
+
};
|
|
200670
200736
|
function getLineChartSettings(explore, tagOverride) {
|
|
200671
|
-
const
|
|
200672
|
-
|
|
200673
|
-
if (!chart) {
|
|
200737
|
+
const normalizedTag = convertLegacyToVizTag(tagOverride ?? explore.tag);
|
|
200738
|
+
if (normalizedTag.text("viz") !== "line") {
|
|
200674
200739
|
throw new Error(
|
|
200675
|
-
"Malloy Line Chart: Tried to render a line chart, but no
|
|
200740
|
+
"Malloy Line Chart: Tried to render a line chart, but no viz=line tag was found"
|
|
200676
200741
|
);
|
|
200677
200742
|
}
|
|
200678
|
-
const
|
|
200679
|
-
|
|
200743
|
+
const vizTag = normalizedTag.tag("viz");
|
|
200744
|
+
let zeroBaseline = defaultSettings.line_chart.zero_baseline;
|
|
200745
|
+
if (vizTag.has("zero_baseline")) {
|
|
200746
|
+
const value2 = vizTag.text("zero_baseline");
|
|
200747
|
+
if (value2 === "false") {
|
|
200748
|
+
zeroBaseline = false;
|
|
200749
|
+
} else if (value2 === "true" || value2 === null || value2 === void 0 || value2 === "") {
|
|
200750
|
+
zeroBaseline = true;
|
|
200751
|
+
}
|
|
200752
|
+
}
|
|
200753
|
+
const interactive2 = !normalizedTag.has("tooltip");
|
|
200680
200754
|
const xChannel = {
|
|
200681
200755
|
fields: [],
|
|
200682
200756
|
type: null
|
|
@@ -200692,42 +200766,44 @@ ${expressions.map((entry2) => ` ${entry2}`).join(",\n")}
|
|
|
200692
200766
|
function getField2(ref2) {
|
|
200693
200767
|
return explore.pathTo(explore.fieldAt([ref2]));
|
|
200694
200768
|
}
|
|
200695
|
-
if (
|
|
200696
|
-
xChannel.fields.push(getField2(
|
|
200769
|
+
if (vizTag.text("x")) {
|
|
200770
|
+
xChannel.fields.push(getField2(vizTag.text("x")));
|
|
200697
200771
|
}
|
|
200698
|
-
if (
|
|
200699
|
-
yChannel.fields.push(getField2(
|
|
200700
|
-
} else if (
|
|
200701
|
-
yChannel.fields.push(...
|
|
200772
|
+
if (vizTag.text("y")) {
|
|
200773
|
+
yChannel.fields.push(getField2(vizTag.text("y")));
|
|
200774
|
+
} else if (vizTag.textArray("y")) {
|
|
200775
|
+
yChannel.fields.push(...vizTag.textArray("y").map(getField2));
|
|
200702
200776
|
}
|
|
200703
|
-
if (
|
|
200704
|
-
seriesChannel.fields.push(getField2(
|
|
200777
|
+
if (vizTag.text("series")) {
|
|
200778
|
+
seriesChannel.fields.push(getField2(vizTag.text("series")));
|
|
200705
200779
|
}
|
|
200706
200780
|
const embeddedX = [];
|
|
200707
200781
|
const embeddedY = [];
|
|
200708
200782
|
const embeddedSeries = [];
|
|
200709
|
-
|
|
200710
|
-
|
|
200711
|
-
|
|
200712
|
-
|
|
200713
|
-
|
|
200714
|
-
|
|
200715
|
-
|
|
200716
|
-
|
|
200717
|
-
|
|
200718
|
-
|
|
200719
|
-
|
|
200720
|
-
|
|
200721
|
-
|
|
200722
|
-
|
|
200723
|
-
|
|
200724
|
-
|
|
200725
|
-
|
|
200726
|
-
|
|
200727
|
-
|
|
200728
|
-
|
|
200729
|
-
|
|
200730
|
-
|
|
200783
|
+
if (!vizTag.has("disableEmbedded")) {
|
|
200784
|
+
walkFields(explore, (field2) => {
|
|
200785
|
+
const tag = field2.tag;
|
|
200786
|
+
const pathTo = explore.pathTo(field2);
|
|
200787
|
+
if (tag.has("x")) {
|
|
200788
|
+
embeddedX.push(pathTo);
|
|
200789
|
+
}
|
|
200790
|
+
if (tag.has("y")) {
|
|
200791
|
+
embeddedY.push(pathTo);
|
|
200792
|
+
}
|
|
200793
|
+
if (tag.has("series")) {
|
|
200794
|
+
embeddedSeries.push(pathTo);
|
|
200795
|
+
}
|
|
200796
|
+
});
|
|
200797
|
+
embeddedX.forEach((path2) => {
|
|
200798
|
+
xChannel.fields.push(path2);
|
|
200799
|
+
});
|
|
200800
|
+
embeddedY.forEach((path2) => {
|
|
200801
|
+
yChannel.fields.push(path2);
|
|
200802
|
+
});
|
|
200803
|
+
embeddedSeries.forEach((path2) => {
|
|
200804
|
+
seriesChannel.fields.push(path2);
|
|
200805
|
+
});
|
|
200806
|
+
}
|
|
200731
200807
|
const dimensions2 = explore.fields.filter(
|
|
200732
200808
|
(f2) => f2.isBasic() && f2.wasDimension()
|
|
200733
200809
|
);
|
|
@@ -200802,11 +200878,11 @@ ${expressions.map((entry2) => ` ${entry2}`).join(",\n")}
|
|
|
200802
200878
|
"Malloy Line Chart: Trying to render a line chart when Line chart series plugin not found"
|
|
200803
200879
|
);
|
|
200804
200880
|
}
|
|
200805
|
-
const tag = explore.tag;
|
|
200806
|
-
const chartTag = tag.tag("
|
|
200881
|
+
const tag = convertLegacyToVizTag(explore.tag);
|
|
200882
|
+
const chartTag = tag.tag("viz");
|
|
200807
200883
|
if (!chartTag)
|
|
200808
200884
|
throw new Error(
|
|
200809
|
-
"Malloy Line Chart:
|
|
200885
|
+
"Malloy Line Chart: Tried to render a line chart, but no viz=line tag was found"
|
|
200810
200886
|
);
|
|
200811
200887
|
const settings = getLineChartSettings(explore, tag);
|
|
200812
200888
|
const xFieldPath = settings.xChannel.fields.at(0);
|
|
@@ -200861,7 +200937,7 @@ ${expressions.map((entry2) => ` ${entry2}`).join(",\n")}
|
|
|
200861
200937
|
metadata: metadata2,
|
|
200862
200938
|
xField,
|
|
200863
200939
|
yField,
|
|
200864
|
-
chartType: "
|
|
200940
|
+
chartType: "line",
|
|
200865
200941
|
getYMinMax: () => [yDomainMin, yDomainMax],
|
|
200866
200942
|
independentY: chartTag.has("y", "independent") || isLimitingSeries
|
|
200867
200943
|
});
|
|
@@ -201520,7 +201596,7 @@ ${expressions.map((entry2) => ` ${entry2}`).join(",\n")}
|
|
|
201520
201596
|
plotHeight: chartSettings.plotHeight,
|
|
201521
201597
|
totalWidth: chartSettings.totalWidth,
|
|
201522
201598
|
totalHeight: chartSettings.totalHeight,
|
|
201523
|
-
chartType: "
|
|
201599
|
+
chartType: "line",
|
|
201524
201600
|
chartTag,
|
|
201525
201601
|
mapMalloyDataToChartData,
|
|
201526
201602
|
getTooltipData(item, view2) {
|
|
@@ -201620,9 +201696,6 @@ ${expressions.map((entry2) => ` ${entry2}`).join(",\n")}
|
|
|
201620
201696
|
}
|
|
201621
201697
|
};
|
|
201622
201698
|
}
|
|
201623
|
-
const defaultSettings = {
|
|
201624
|
-
size: "fill"
|
|
201625
|
-
};
|
|
201626
201699
|
function getResultMetadata(root2, options = { parentSize: { width: 0, height: 0 } }) {
|
|
201627
201700
|
const rootTag = root2.field.tag;
|
|
201628
201701
|
const rootSizingStrategy = rootTag.has("size") && rootTag.text("size") !== "fill" ? "fixed" : defaultSettings.size;
|
|
@@ -201649,13 +201722,9 @@ ${expressions.map((entry2) => ` ${entry2}`).join(",\n")}
|
|
|
201649
201722
|
}
|
|
201650
201723
|
});
|
|
201651
201724
|
}
|
|
201652
|
-
const CHART_TAG_LIST = ["bar_chart", "line_chart"];
|
|
201653
201725
|
function shouldRenderChartAs(tag) {
|
|
201654
|
-
const
|
|
201655
|
-
|
|
201656
|
-
return tagNamesInOrder.find(
|
|
201657
|
-
(name) => CHART_TAG_LIST.includes(name) && !properties[name].deleted
|
|
201658
|
-
);
|
|
201726
|
+
const normalizedTag = convertLegacyToVizTag(tag);
|
|
201727
|
+
return getChartTypeFromNormalizedTag(normalizedTag);
|
|
201659
201728
|
}
|
|
201660
201729
|
function populateVegaSpec(field2, metadata2, options) {
|
|
201661
201730
|
var _a, _b, _c, _d, _e;
|
|
@@ -201667,9 +201736,9 @@ ${expressions.map((entry2) => ` ${entry2}`).join(",\n")}
|
|
|
201667
201736
|
runtime: null
|
|
201668
201737
|
};
|
|
201669
201738
|
try {
|
|
201670
|
-
if (chartType === "
|
|
201739
|
+
if (chartType === "bar") {
|
|
201671
201740
|
vegaChartProps = generateBarChartVegaSpec(field2, metadata2);
|
|
201672
|
-
} else if (chartType === "
|
|
201741
|
+
} else if (chartType === "line") {
|
|
201673
201742
|
vegaChartProps = generateLineChartVegaSpec(field2, metadata2);
|
|
201674
201743
|
}
|
|
201675
201744
|
} catch (error2) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/render",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.287",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/module/index.umd.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"generate-flow": "ts-node ../../scripts/gen-flow.ts"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@malloydata/malloy": "0.0.
|
|
45
|
-
"@malloydata/malloy-interfaces": "0.0.
|
|
46
|
-
"@malloydata/malloy-tag": "0.0.
|
|
44
|
+
"@malloydata/malloy": "0.0.287",
|
|
45
|
+
"@malloydata/malloy-interfaces": "0.0.287",
|
|
46
|
+
"@malloydata/malloy-tag": "0.0.287",
|
|
47
47
|
"@tanstack/solid-virtual": "^3.10.4",
|
|
48
48
|
"component-register": "^0.8.6",
|
|
49
49
|
"lodash": "^4.17.20",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"vega-lite": "^5.2.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@malloydata/db-duckdb": "0.0.
|
|
59
|
+
"@malloydata/db-duckdb": "0.0.287",
|
|
60
60
|
"@storybook/addon-essentials": "^8.5.8",
|
|
61
61
|
"@storybook/addon-interactions": "^8.5.8",
|
|
62
62
|
"@storybook/addon-links": "^8.5.8",
|