pict-section-form 1.4.3 → 1.4.4
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.
|
@@ -109,6 +109,8 @@ Raw -> Address (overrides) -> Solver (merges) -> Final Configuration
|
|
|
109
109
|
|
|
110
110
|
`ValueLabels` turns one dataset's point value labels off (or on, under
|
|
111
111
|
`"Datasets": "OptIn"`); see [Point Value Labels](#point-value-labels).
|
|
112
|
+
A dataset in `ChartDatasetsRaw` or at `ChartDatasetsAddress` takes the same
|
|
113
|
+
`ValueLabels` key, alongside its Chart.js properties.
|
|
112
114
|
|
|
113
115
|
### Point Value Labels
|
|
114
116
|
|
package/package.json
CHANGED
|
@@ -464,7 +464,9 @@ class CustomInputHandler extends libPictSectionInputExtension
|
|
|
464
464
|
{
|
|
465
465
|
continue;
|
|
466
466
|
}
|
|
467
|
-
|
|
467
|
+
// Raw and Address datasets reach Chart.js as written, so they carry the flag as ValueLabels
|
|
468
|
+
const tmpFlag = (typeof (tmpDataset.pictValueLabels) === 'boolean') ? tmpDataset.pictValueLabels : tmpDataset.ValueLabels;
|
|
469
|
+
const tmpIncluded = (tmpFlag === true) || (tmpAllDatasets && (tmpFlag !== false));
|
|
468
470
|
if (!tmpIncluded)
|
|
469
471
|
{
|
|
470
472
|
continue;
|
|
@@ -810,6 +810,24 @@ suite('Pict-Provider-Input-Chart', () =>
|
|
|
810
810
|
Expect(tmpLabels.map((pLabel) => pLabel.Text)).to.deep.equal([ '20' ]);
|
|
811
811
|
});
|
|
812
812
|
|
|
813
|
+
test('ValueLabels on a Raw dataset is honoured, under All and under OptIn', () =>
|
|
814
|
+
{
|
|
815
|
+
const tmpPict = new libPict();
|
|
816
|
+
const tmpProvider = new libChartInput(tmpPict, {});
|
|
817
|
+
tmpPict.providers.DynamicSolver = { runSolver: () => [ 10 ] };
|
|
818
|
+
const tmpConfiguration = tmpProvider.getInputChartConfiguration({ }, {
|
|
819
|
+
Name: 'C', Hash: 'C', DataType: 'Object',
|
|
820
|
+
Macro: { RawHTMLID: 'C', InputFullProperties: '', InputChangeHandler: '', ControlAttr: '' },
|
|
821
|
+
PictForm: { InputType: 'Chart', ChartType: 'line',
|
|
822
|
+
ChartDatasetsRaw: [ { label: 'Target', data: [ 20 ], ValueLabels: false }, { label: 'Goal', data: [ 30 ], ValueLabels: true } ],
|
|
823
|
+
ChartDatasetsSolvers: [ { Label: 'Sold', DataSolver: 'x' } ] },
|
|
824
|
+
}, {});
|
|
825
|
+
const tmpChart = drawnChart(tmpConfiguration.data.datasets);
|
|
826
|
+
const fTexts = (pValueLabels) => tmpProvider._collectChartValueLabels(tmpChart, labelConfiguration(pValueLabels), measure).map((pLabel) => pLabel.Text);
|
|
827
|
+
Expect(fTexts(true)).to.deep.equal([ '30', '10' ]);
|
|
828
|
+
Expect(fTexts({ Datasets: 'OptIn' })).to.deep.equal([ '30' ]);
|
|
829
|
+
});
|
|
830
|
+
|
|
813
831
|
test('Color: Dataset draws each label in its series colour', () =>
|
|
814
832
|
{
|
|
815
833
|
const tmpChart = drawnChart([ { data: [ 10 ], borderColor: '#E03131' } ]);
|