Hi,
I'm trying to display a scatter plot so that the X and Y axes have the same distance between each of the major ticks (i.e. so that a circle plotted across both axes is a circle, not an oval). However I'd like to ensure that the plot fills the screen which inevitably means more of the X or Y axes will be shown depending on whether it's portrait or landscape.
I've only found that I can set the maximum and minimum values for the X and Y axes using SfCharts, which is fine if the plot is square, but when it's oblong (like the screen), the scale and X and Y axes differs.
Is there a way to set SfCharts so that it will always use the same distance scale on each axes, if necessary displaying more of horizontal or vertical axis if required?
Thanks,
Oliver.
Hi,
Thank you very much for your help and feedback.
However, this isn't quite what I was after (but thank you for your help!).
What I'd like ideally is for the actual values on each axis are the same distance on each axis, so for the example you've provided, the following would be displayed - e.g. if 18.2 if the maximum length space available on the x axis (although I can see you could fit a bit more in), that value would be the same distance up on the y axis, plus any additional space available.
I've added example values in red on the attached.
Does that make sense?
All the best,
Oliver.
Hi Oliver,
Sorry for the misunderstanding. We have achieved your requirement with the help of changing the Height and Width request of the chart in series rendered event. Also, we have attached the modified sample for your reference.
Output:
Note: If the chart title or legend is used in the chart, we must manually set an additional height or width dependent on the title or legend size.
Thanks,
Manivannan E
Hi Manivannan,
Thank you for your note - however again this isn't quite what I'm trying to achieve. I've drawn the attached diagram to show in more detail. I've included an annotated version of your example, and also a screenshot from my app.
In particular
Attachment: Archive_1c2cdda0.zip
|
protected override void OnSizeAllocated(double width, double height)
{
base.OnSizeAllocated(width, height);
if (actualMaximum == 0)
return;
UpdateRange();
}
void sfChart_SeriesRendered(System.Object sender, System.EventArgs e)
{
actualMaximum = primaryAxis.VisibleMaximum;
UpdateRange();
}
void UpdateRange()
{
var chartWidth = sfChart.Width;
var chartHeight = sfChart.Height;
if (chartHeight > chartWidth)
{
primaryAxis.Maximum = actualMaximum;
secondaryAxis.Maximum = actualMaximum * chartHeight / chartWidth;
}
else
{
secondaryAxis.Maximum = actualMaximum;
primaryAxis.Maximum = actualMaximum * chartWidth / chartHeight;
}
} |
Hi,
Thank you very much for your reply - I'll check this out over the next week.
Oliver.