|
{
// add your additional code here
}).PrimaryXAxis(px => px.ValueType(Syncfusion.EJ2.Charts.ValueType.Category)
.LabelPlacement(Syncfusion.EJ2.Charts.LabelPlacement.OnTicks) // add your additional code here.Render() |
Hi,
is there any news regarding this topic? I would like to achieve the same thing like Steven but in Angular.
Regards,
Szilard
Hi Szilard,
We suggest you to use different x axis for each series with one axis labelPlacement as BetweenTicks and another one as OnTicks. We have prepared sample based on your requirement. Please check with the below snippet and screenshot.
|
<ejs-chart [axes]='axis'> <e-series-collection> <e-series xAxisName='xAxis'> </e-series> </e-series-collection> </ejs-chart> public axis: Object = [{ visible: false, labelPlacement: 'OnTicks', name: 'xAxis' }]; public primaryXAxis: Object = { labelPlacement: 'BetweenTicks' }; |
Sample : https://stackblitz.com/edit/angular-4pwgzf
Kindly revert us if you have any concerns.
Regards,
Durga Gopalakrishnan.
Hi Durga,
thank you for your response. Your sample is working like a charm, I just tried to implement it into my code but unfortunately it doesn't work. I set the labelPlacement for the primaryXAxis to BetweenTicks and added an additional axis for the StepLine chart and set the labelPlacement to OnTicks, but it doesn't work. I tried to set the labelPlacement of the additional axis to OnTicks than to BetweenTicks but there is no difference so I suppose there is something wrong with my additional axis.
Note: I'm using the StepLine chart with the additional axis in *ngFor. Could this be something that doesn't let the additional axis to react to the labelPlacement change?
Here you have an example:
<ejs-chart [primaryXAxis]="primaryXAxis" [primaryYAxis]="primaryYAxis" ... [axes]="axisPlot">
<e-series-collection>
<e-series *ngFor="let chart of charts"... xName="x" yName="y"> </e-series>
<e-series *ngFor="let plotLine of plotLines" .... type="StepLine" xName="x" yName="value"
xAxisName="xAxisPlot"> </e-series>
</e-series-collection>
</ejs-chart>
.ts file:
primaryXAxis: object = [{
valueType: 'Category',
rangePadding: 'Additional',
labelPlacement: 'BetweenTicks',
edgeLabelPlacement: 'Shift',
}]
public axisPlot: Object = [{
valueType: 'Category',
visible: false,
labelPlacement: 'BetweenTicks',
name: 'xAxisPlot',
}];
Hi Szilard,
Most welcome. We have prepared sample with ngFor for series collection. Please check with the below snippet and sample.
|
app.component.html <ejs-chart> <e-series-collection> <e-series *ngFor="let row of dataTotal" [dataSource]='row.data' [type]='row.type' [xAxisName]='row.axisName' [name]='row.seriesName'> </e-series> </e-series-collection> </ejs-chart>
app.component.ts public dataTotal: Object[] = [ { data : [ { x: new Date(1975, 0, 1), y: 16 }, //… ], seriesName: 'China', axisName:'primaryXAxis', type:'Column' }, { data : [ { x: new Date(1975, 0, 1), y: 10 }, //… ], seriesName:'Australia', axisName:'xAxis', type: 'StepLine' } ]; |
Sample : https://stackblitz.com/edit/angular-4pwgzf-ytizxe
Kindly revert us if you have any concerns.
Regards,
Durga Gopalakrishnan.