Rotate HeatMapChart (place origin of co-ordinates to the upper right corner)


https://www.nevron.com/Forum/Topic10692.aspx
Print Topic | Close Window

By joern kunze - 8 Years Ago
Hi Experts,

I want to rotate a HeatMapChart (NHeatMapSeries), so that the origin of co-ordinates is in the upper right corner.

With a SurfaceChart this can be done using:
 nChartControl1.Charts[0].Projection.Rotation = 180;
- but with the HeatMapChart it doesnt work.

Than I tried to use:
nChartControl1.Charts[0].SetPredefinedChartStyle(PredefinedChartStyle.HorizontalRight);
- than I am "half way" there. But I need to rotate the Chart not just 90 degrees but 180 degrees.
How can I do this?

Thanks for your help,
Joern
By Nevron Support - 8 Years Ago
Hi Joern,
You can easily rotate the chart by 180 degrees using the ViewerRotation property:
chart.Projection.ViewerRotation = 180;
Alternatively you can achieve the same effect using axis docking (dock the horizontal axis to the top) and the vertical axis to the right and then flipping the axes using the ScaleConfigurator.Invert property.
Hope this helps - let us know if you meet any problems.
By joern kunze - 8 Years Ago
... your proposal was exactly what I tried already - without success:
chart.Projection.ViewerRotation = 180; //doesnt work with HeatMapChart - at least for my example

But now I found a solution:

   //Rotate 2d-Chart 180 degrees
    nChartControl1.Charts[0].Axis(StandardAxis.PrimaryX).ScaleConfigurator.Invert = true;
    nChartControl1.Charts[0].Axis(StandardAxis.PrimaryX).Anchor = new NDockAxisAnchor(AxisDockZone.FrontTop, false);

    nChartControl1.Charts[0].Axis(StandardAxis.PrimaryY).ScaleConfigurator.Invert = true;
    nChartControl1.Charts[0].Axis(StandardAxis.PrimaryY).Anchor = new NDockAxisAnchor(AxisDockZone.FrontRight, false);

    nChartControl1.Refresh();

Thanks for the help anyway,
best regards,
Joern
By Nevron Support - 8 Years Ago
Hi Joern,
You probably applied Rotation, not ViewerRotation and that's why it did not work. Anyway the anchor / invert approach is probably better...
By joern kunze - 8 Years Ago
... you are quite right! I did not read carefully enough...
But anyway, both ways are working - so problem is solved. Thanks a lot!

Best regards,
Joern