Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.10 #521

Merged
merged 5 commits into from
Dec 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Samples/VizImage/vizImage.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" ></script>

<!-- Extensions Library (this will be hosted on a CDN eventually) -->
<script src="../../lib/tableau.extensions.1.latest.js"></script>
<script src="../../lib/tableau.extensions.1.latest.min.js"></script>

<!-- Our extension's code -->
<script src="./vizImage.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion Samples/VizImage2/VizImage2.trex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<author name="tableau" email="[email protected]" organization="tableau" website="https://www.tableau.com"/>
<min-api-version>1.6</min-api-version>
<source-location>
<url>http://localhost:8765/Samples/VizImage/vizImage2.html</url>
<url>http://localhost:8765/Samples/VizImage2/vizImage2.html</url>
</source-location>
<icon>iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAlhJREFUOI2Nkt9vy1EYh5/3bbsvRSySCZbIxI+ZCKsN2TKtSFyIrV2WuRCJuBiJWxfuxCVXbvwFgiEtposgLFJElnbU1SxIZIIRJDKTrdu+53Uhra4mce7Oe57Pcz7JOULFisViwZ+29LAzOSjQYDgz1ZcCvWuXV11MJpN+OS/lm6179teqH0yDqxPTCyKSA8DcDsyOmOprnCaeP7459pdgy969i0LTC3IO/RQMyoHcQN+3cnljW3dNIFC47qDaK3g7BwdTkwBaBELT4ZPOUVWgKl4ZBnjxJPUlMDnTDrp0pmr6RHFeEjjcUUXPDGeSEwDN0Xg8sivxMhJNjGzbHd8PkM3eHRfkrBM5NkcQaY2vUnTlrDIA0NoaX+KLXFFlowr14tvVpqb2MICzmQcKqxvbumv+NAhZGCCIPwEw6QWXKYRL/VUXO0+rAUJiPwAk5MIlgVfwPjjHLCL1APmHN94ZdqeYN+NW/mn6I4BvwQYchcLnwFhJMDiYmlRxAzjpKWZkYkUCcZ2I61wi37tLbYyjiN0fHk5Oz3nGSLSzBbNHCF35R7f6K1/hN9PRhek11FrymfQQQKB4+Gl05P2qNRtmETlXW7e+b2z01dfycGNbfFMAbqNyKp9Jp4rzOT8RYFs0njJkc2iqsCObvTsOsDWWqA5C1uFy+Uz/oXJeKwVT4h0RmPUXhi79vuC0Ku6yOffTK3g9lfxfDQAisY516sg5kfOCiJk7HoLt2cf9b/9LANAc7dznm98PagG1fUOZ9IP5uMB8Q4CPoyNvausapkTt3rNMuvdf3C/o6+czhtdwmwAAAABJRU5ErkJggg==</icon>
</dashboard-extension>
Expand Down
3 changes: 1 addition & 2 deletions Samples/VizImage2/vizImage2.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" >
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" ></script>

<!-- Extensions Library (this will be hosted on a CDN eventually) -->
<script src="./lib/tableau.extensions.1.latest.js"></script>
<script src="../../lib/tableau.extensions.1.latest.min.js"></script>

<!-- Our extension's code -->
<script src="./vizImage2.js"></script>
Expand Down
122 changes: 61 additions & 61 deletions Samples/VizImage2/vizImage2.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,80 +4,80 @@
(function () {
$(document).ready(function () {
tableau.extensions.initializeAsync().then(function () {
addVizImage(tableau.MarkType.Bar, tableau.MarkType.Bar, 'tableau20_10_0' );
addVizImage(tableau.MarkType.Bar, tableau.MarkType.Bar, 'tableau20_10_0');

let markSelector1 = $('#mark-select1');
let markSelector2 = $('#mark-select2');
let colorSelector = $('#color-select');
const markSelector1 = $('#mark-select1');
const markSelector2 = $('#mark-select2');
const colorSelector = $('#color-select');

markSelector1.prop('disabled', false);
markSelector2.prop('disabled', false);
colorSelector.prop('disabled', false);

// updating viz images with new values upon a selector change.
markSelector1.change(function () {
addVizImage(markSelector1.val(), markSelector2.val(), colorSelector.val() );
addVizImage(markSelector1.val(), markSelector2.val(), colorSelector.val());
});
markSelector2.change(function () {
addVizImage(markSelector1.val(), markSelector2.val(), colorSelector.val() );
addVizImage(markSelector1.val(), markSelector2.val(), colorSelector.val());
});
colorSelector.change(function () {
addVizImage(markSelector1.val(), markSelector2.val(), colorSelector.val());
});
});
});
});

function addVizImage (markType1, markType2, colorType) {
function addVizImage (markType1, markType2, colorType) {
const vizInputSpec = {
version: 2,
description: 'Example QQConcat viz',
data: {
values: [
{ Segment: 'Consumer', ShipMode: 'First Class', Category: 'Technology', Profit: 11560.75, Sales: 61089.43 },
{ Segment: 'Corporate', ShipMode: 'First Class', Category: 'Technology', Profit: 7235.75, Sales: 39201.43 },
{ Segment: 'Home Office', ShipMode: 'First Class', Category: 'Technology', Profit: 8706.75, Sales: 39074.43 },
{ Segment: 'Consumer', ShipMode: 'First Class', Category: 'Office Supplies', Profit: 7734.74, Sales: 48200.43 },
{ Segment: 'Corporate', ShipMode: 'First Class', Category: 'Office Supplies', Profit: 6299.74, Sales: 31579.43 },
{ Segment: 'Home Office', ShipMode: 'First Class', Category: 'Office Supplies', Profit: 4366.74, Sales: 21552.43 },
{ Segment: 'Consumer', ShipMode: 'First Class', Category: 'Furniture', Profit: 2078.74, Sales: 49880.43 },
{ Segment: 'Corporate', ShipMode: 'First Class', Category: 'Furniture', Profit: 929.75, Sales: 35077.43 },
{ Segment: 'Home Office', ShipMode: 'First Class', Category: 'Furniture', Profit: 58.74, Sales: 25773.43 },
{ Segment: 'Consumer', ShipMode: 'Second Class', Category: 'Technology', Profit: 14430.75, Sales: 72942.43 },
{ Segment: 'Corporate', ShipMode: 'Second Class', Category: 'Technology', Profit: 6819.74, Sales: 41912.43 },
{ Segment: 'Home Office', ShipMode: 'Second Class', Category: 'Technology', Profit: 4902.75, Sales: 27366.43 },
{ Segment: 'Consumer', ShipMode: 'Second Class', Category: 'Office Supplies', Profit: 9752.74, Sales: 71757.43 },
{ Segment: 'Corporate', ShipMode: 'Second Class', Category: 'Office Supplies', Profit: 9809.74, Sales: 62810.43 },
{ Segment: 'Home Office', ShipMode: 'Second Class', Category: 'Office Supplies', Profit: 7506.74, Sales: 26115.43 },
{ Segment: 'Consumer', ShipMode: 'Second Class', Category: 'Furniture', Profit: 763.74, Sales: 86799.43 },
{ Segment: 'Corporate', ShipMode: 'Second Class', Category: 'Furniture', Profit: 1596.74, Sales: 41403.43 },
{ Segment: 'Home Office', ShipMode: 'Second Class', Category: 'Furniture', Profit: 1865.74, Sales: 28086.43 },
],
version: 2,
description: 'Example QQConcat viz',
data: {
values: [
{ Segment: 'Consumer', ShipMode: 'First Class', Category: 'Technology', Profit: 11560.75, Sales: 61089.43 },
{ Segment: 'Corporate', ShipMode: 'First Class', Category: 'Technology', Profit: 7235.75, Sales: 39201.43 },
{ Segment: 'Home Office', ShipMode: 'First Class', Category: 'Technology', Profit: 8706.75, Sales: 39074.43 },
{ Segment: 'Consumer', ShipMode: 'First Class', Category: 'Office Supplies', Profit: 7734.74, Sales: 48200.43 },
{ Segment: 'Corporate', ShipMode: 'First Class', Category: 'Office Supplies', Profit: 6299.74, Sales: 31579.43 },
{ Segment: 'Home Office', ShipMode: 'First Class', Category: 'Office Supplies', Profit: 4366.74, Sales: 21552.43 },
{ Segment: 'Consumer', ShipMode: 'First Class', Category: 'Furniture', Profit: 2078.74, Sales: 49880.43 },
{ Segment: 'Corporate', ShipMode: 'First Class', Category: 'Furniture', Profit: 929.75, Sales: 35077.43 },
{ Segment: 'Home Office', ShipMode: 'First Class', Category: 'Furniture', Profit: 58.74, Sales: 25773.43 },
{ Segment: 'Consumer', ShipMode: 'Second Class', Category: 'Technology', Profit: 14430.75, Sales: 72942.43 },
{ Segment: 'Corporate', ShipMode: 'Second Class', Category: 'Technology', Profit: 6819.74, Sales: 41912.43 },
{ Segment: 'Home Office', ShipMode: 'Second Class', Category: 'Technology', Profit: 4902.75, Sales: 27366.43 },
{ Segment: 'Consumer', ShipMode: 'Second Class', Category: 'Office Supplies', Profit: 9752.74, Sales: 71757.43 },
{ Segment: 'Corporate', ShipMode: 'Second Class', Category: 'Office Supplies', Profit: 9809.74, Sales: 62810.43 },
{ Segment: 'Home Office', ShipMode: 'Second Class', Category: 'Office Supplies', Profit: 7506.74, Sales: 26115.43 },
{ Segment: 'Consumer', ShipMode: 'Second Class', Category: 'Furniture', Profit: 763.74, Sales: 86799.43 },
{ Segment: 'Corporate', ShipMode: 'Second Class', Category: 'Furniture', Profit: 1596.74, Sales: 41403.43 },
{ Segment: 'Home Office', ShipMode: 'Second Class', Category: 'Furniture', Profit: 1865.74, Sales: 28086.43 }
]
},
vizlayout: {
title: 'Example Combination Chart',
size: { width: 800, height: 600 },
showcolorlegend: true,
showsizelegend: false,
showrowsgridline: false
},
columns: [
{ field: 'ShipMode', type: tableau.VizImageEncodingType.Discrete },
{ field: 'Sales', type: tableau.VizImageEncodingType.Continuous },
{ field: 'Profit', type: tableau.VizImageEncodingType.Continuous }
],
rows: [{ field: 'Segment', type: tableau.VizImageEncodingType.Discrete }],
encodingaxis: 'columns',
defaultencoding: { mark: tableau.MarkType.Bar },
encodings: [
{
mark: markType1
},
vizlayout: {
title: 'Example Combination Chart',
size: {width: 800, height: 600},
showcolorlegend: true,
showsizelegend:false,
showrowsgridline: false,
},
columns: [
{ field: 'ShipMode', type: tableau.VizImageEncodingType.Discrete },
{ field: 'Sales', type: tableau.VizImageEncodingType.Continuous },
{ field: 'Profit', type: tableau.VizImageEncodingType.Continuous },
],
rows: [{ field: 'Segment', type: tableau.VizImageEncodingType.Discrete }],
encodingaxis: 'columns',
defaultencoding: { mark: tableau.MarkType.Bar },
encodings: [
{
mark: markType1,
},
{
{
mark: markType2,
color: { field: 'Category', type: tableau.VizImageEncodingType.Discrete, palette: { name: colorType } },
},
],
};
color: { field: 'Category', type: tableau.VizImageEncodingType.Discrete, palette: { name: colorType } }
}
]
};

// defaulting values if null.
if (markType1 === null) {
Expand All @@ -88,24 +88,24 @@
}
if (colorType === null) {
vizInputSpec.colorType = 'tableau20_10_0';
}
}

// making call to create viz image from the input specifications.
tableau.extensions.createVizImageAsync(vizInputSpec).then(function (svg) {
var blob = new Blob([svg], { type: 'image/svg+xml' });
var url = URL.createObjectURL(blob);
var image = document.createElement('img');
const blob = new Blob([svg], { type: 'image/svg+xml' });
const url = URL.createObjectURL(blob);
const image = document.createElement('img');
image.src = url;
image.style.maxWidth = '100%';
image.style.maxHeight = '100%';
image.className = 'center-block';
var vizApiElement = document.getElementById('viz-container');
const vizApiElement = document.getElementById('viz-container');
// clearing UI and adding in new viz.
vizApiElement.innerHTML = '';
vizApiElement.appendChild(image);
image.addEventListener('load', function () { return URL.revokeObjectURL(url); }, { once: true });
}, function (err) {
console.log(err);
});
});
}
})();
2 changes: 1 addition & 1 deletion docs/assets/js/search.js

Large diffs are not rendered by default.

Loading