I have a chart that is built using Microsoft Chart Controls and would like to add our company's logo to the corner. Is this possible to do with MCC?
Is there any reason you don't want to simply put a PictureBox control near the corner of the chart? That seems like that simplest solution to me.
To add an image, use ImageAnnotation.
ImageAnnotation logo = new ImageAnnotation();
logo.X = 75;
logo.Y = 60;
logo.Image = "imagePath";
chart.Annotations.Add(logo);
Related
I have an app I need to build with Xamarin for iOS. I'm using Xamarin.Forms at the moment.
The app is a custom view of a garden that I will need to place plant markers on in the admin at a touch. I cannot find a way to composite these images in a way I can drive the display from a database and make the markers clickable.
Any help or guidance is appreciated.
In this case you need to use AbsoluteLayout
var layout = new AbsoluteLayout();
var image = new Image { Source = "foo.png" };
AbsoluteLayout.SetLayoutBounds (image , new Rectangle (.5, 1, .5, .1));
//("X, Y, Width, Height")
layout.Children.Add (bottomLabel);
Content = layout;
here just a sample of placing image from c#, you can customize this to your requirement
Link to how it looks like http://puu.sh/hc4aJ/1cb4c189b0.png
I have multiple charts in my form and they can have different Y-axis labels. But when I add those different axis labels this happens. I haven't found any option to set a margin or something so that the graphs will be aligned.
Every graph has the same location and size settings.
chart.Size = new Size(1000, 190);
chart.Location = new Point(0, 0);
Anybody got a solution?
If all chart areas are in the same chart, you can use the AlignWithChartArea-Property.
chartArea1.AlignWithChartArea = "ChartArea2";
I am using the Microsoft Chart Controls Chart class in System.Web.UI.DataVisualization.Charting and have a problem with a line series looking very jagged.
I am setting up my chart like so:
chart.AntiAliasing = AntiAliasingStyles.All;
chart.TextAntiAliasingQuality = TextAntiAliasingQuality.High;
chart.BackColor = Color.White;
And my series is a basic SeriesChartType.Line type. I am rendering as a PNG (have also tried BMP and JPG), but the end result it still like the below. I have also tried increasing the line width, but this just makes it more obvious. Is it possible to smooth out the line?
I have a windows forms application that displays a chart compose by two chart areas, one for price/dates and the second displays volume/price, both should get the same amount of datapoints to draw in each chart area, the issue I have at the moment is that both charts are not aligned vertically so they are not very clear for the user, I added the following properties to volumen chart area:
volumeChartArea.AlignWithChartArea = CHART_AREA_PRICES;
volumeChartArea.AlignmentStyle = AreaAlignmentStyles.All;
volumeChartArea.AlignmentOrientation = AreaAlignmentOrientations.Vertical;
But they still don't look correct, what could it be the solution to fix this issue?
Many thanks in advance.
something like this maybe?
if (this.chrtMain.ChartAreas.Count > 0)
{
ca.AlignmentOrientation = AreaAlignmentOrientations.Vertical;
ca.AlignWithChartArea = this.chrtMain.ChartAreas[0].Name;
}
All chart areas will be aligned as they are added this way.
I have a problem with exporting a chart. I use the ChartFX chart with
chart.ExportImageSize = new Size(600, 450);
and if the size of the image is larger than this (1127, 537), it cuts the right and the bottom border in the exported image.
For exporting, I use simple
chart.Export(FileFormat.Bitmap);
No custom controls are used in exporting the chart, and the chart looks normal in the application (borders all around, and I use simple black border).
Few interesting things I realized trying to solve this.
First I have no border
chart.Border = new SimpleBorder(SimpleBorderType.None, cOffice2007BackColor);
Than, I add the new border object just to export the chart with the border.
chart.Border = new SimpleBorder(SimpleBorderType.Color, Color.Black);
chart.Export(FileFormat.Bitmap);
Than I revert the border. And, it exports the chart with the new border, but it doesn't resize the border. If it's larger than ExportImageSize, I see only left and top border, and if it's smaller, I get a part of the chart that goes outside the borders.
So, I set the the border to begin with, and only change the color for the exporting.
One more realization, explicitly setting the ExportImageSize can lead to some interesting side-effects. Even dough your plot looks really good, it sometimes cuts the legend, if it is to large