private getValueAxisValues()

in src/visual.ts [1438:1517]


    private getValueAxisValues(instances: VisualObjectInstance[]): void {
        const scaleOptions: string[] = [axisScale.log, axisScale.linear],
            logPossible: boolean = !!this.axes.y1.isLogScaleAllowed;

        const instance: VisualObjectInstance = {
            selector: null,
            properties: {},
            objectName: "valueAxis",
            validValues: {
                axisScale: scaleOptions,
                secAxisScale: scaleOptions
            }
        };

        instance.properties["show"] = this.valueAxisProperties && this.valueAxisProperties["show"] != null
            ? this.valueAxisProperties["show"]
            : true;

        if (!this.yAxisIsCategorical) {
            instance.properties["position"] = this.valueAxisProperties && this.valueAxisProperties["position"] != null
                ? this.valueAxisProperties["position"]
                : axisPosition.left;
        }

        instance.properties["axisScale"] = (this.valueAxisProperties && this.valueAxisProperties["axisScale"] != null && logPossible)
            ? this.valueAxisProperties["axisScale"]
            : axisScale.linear;

        instance.properties["start"] = this.valueAxisProperties
            ? this.valueAxisProperties["start"]
            : null;

        instance.properties["end"] = this.valueAxisProperties
            ? this.valueAxisProperties["end"]
            : null;

        instance.properties["showAxisTitle"] = this.valueAxisProperties && this.valueAxisProperties["showAxisTitle"] != null
            ? this.valueAxisProperties["showAxisTitle"]
            : false;

        instance.properties["fontSize"] = this.valueAxisProperties && this.valueAxisProperties["fontSize"] != null
            ? this.valueAxisProperties["fontSize"]
            : MekkoChart.DefaultLabelFontSizeInPt;

        instances
            .push(instance);

        instances
            .push({
                selector: null,
                properties: {
                    axisStyle: this.valueAxisProperties && this.valueAxisProperties["axisStyle"] != null
                        ? this.valueAxisProperties["axisStyle"]
                        : axisStyle.showTitleOnly,
                    labelColor: this.valueAxisProperties && this.valueAxisProperties["labelColor"]
                        ? this.valueAxisProperties["labelColor"]
                        : MekkoChart.DefaultSettings.valueAxis.labelColor
                },
                objectName: "valueAxis",
                validValues: {
                    axisStyle: this.valueAxisHasUnitType
                        ? [
                            axisStyle.showTitleOnly,
                            axisStyle.showUnitOnly,
                            axisStyle.showBoth
                        ]
                        : [axisStyle.showTitleOnly]
                },
            });

        if (this.layers.length === 2) {
            instance.properties["secShow"] = this.valueAxisProperties && this.valueAxisProperties["secShow"] != null
                ? this.valueAxisProperties["secShow"]
                : this.y2AxisExists;

            if (instance.properties["secShow"]) {
                instance.properties["axisLabel"] = "";
            }
        }
    }