Hi,
I'm trying to save the ultra winchart with 300DPI like so:
('fs' above is a file stream) But, when I read the same image back (thru code), it shows the DPI as 96. How can I save the chart in 300DPI?
(BTW, how do I insert an image from a folder in this post? Clicking the above image icon asks for an URL)
Thanks
I've tried this and when I save the image in Gif format it shows 96, but when I save the image in Png for example it seems ok. I'm not sure what is the problem with Gif format, but this is something related to .NET framework.
You can upload image - click "Reply" button (not "Quick Reply") - Options - Add/Update button, after that just post the message.
Thanks for the reply. I'll try saving in png & check that out.
I've also attached an image of the chart. As you can seein the image, there is lot of space on the right & at the bottom (the blue transparent area is the full image of the chart). Please let me know how to make sure chart saves properly without these spaces.
I guess you need to update with the latest hotfixes (or version).
I have a problem with the axis label fonts in all resolutions except 96dpi.
Axis labels text is somehow scaled with the resolution. In resolutions bigger then 96dpi my letters are bigger, with 300dpi enormously big which makes it unreadable and with all resolutions smaller then 96dpi letters are smaller?
I made a test chart as a user control which inherits from UltraWinChart (Code included)
public partial class TestChartControl : UltraChart { public TestChartControl() { InitializeComponent(); } }
Designer code:
partial class TestChartControl { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { Infragistics.UltraChart.Resources.Appearance.PaintElement paintElement1 = new Infragistics.UltraChart.Resources.Appearance.PaintElement(); Infragistics.UltraChart.Resources.Appearance.TimeAxisAppearance timeAxisAppearance1 = new Infragistics.UltraChart.Resources.Appearance.TimeAxisAppearance(); Infragistics.UltraChart.Resources.Appearance.NumericTimeSeries numericTimeSeries1 = new Infragistics.UltraChart.Resources.Appearance.NumericTimeSeries(); Infragistics.UltraChart.Resources.Appearance.PaintElement paintElement2 = new Infragistics.UltraChart.Resources.Appearance.PaintElement(); Infragistics.UltraChart.Resources.Appearance.NumericTimeDataPoint numericTimeDataPoint1 = new Infragistics.UltraChart.Resources.Appearance.NumericTimeDataPoint(); Infragistics.UltraChart.Resources.Appearance.PaintElement paintElement3 = new Infragistics.UltraChart.Resources.Appearance.PaintElement(); Infragistics.UltraChart.Resources.Appearance.NumericTimeDataPoint numericTimeDataPoint2 = new Infragistics.UltraChart.Resources.Appearance.NumericTimeDataPoint(); Infragistics.UltraChart.Resources.Appearance.PaintElement paintElement4 = new Infragistics.UltraChart.Resources.Appearance.PaintElement(); Infragistics.UltraChart.Resources.Appearance.NumericTimeDataPoint numericTimeDataPoint3 = new Infragistics.UltraChart.Resources.Appearance.NumericTimeDataPoint(); Infragistics.UltraChart.Resources.Appearance.PaintElement paintElement5 = new Infragistics.UltraChart.Resources.Appearance.PaintElement(); Infragistics.UltraChart.Resources.Appearance.NumericTimeDataPoint numericTimeDataPoint4 = new Infragistics.UltraChart.Resources.Appearance.NumericTimeDataPoint(); Infragistics.UltraChart.Resources.Appearance.PaintElement paintElement6 = new Infragistics.UltraChart.Resources.Appearance.PaintElement(); Infragistics.UltraChart.Resources.Appearance.NumericTimeDataPoint numericTimeDataPoint5 = new Infragistics.UltraChart.Resources.Appearance.NumericTimeDataPoint(); Infragistics.UltraChart.Resources.Appearance.PaintElement paintElement7 = new Infragistics.UltraChart.Resources.Appearance.PaintElement(); Infragistics.UltraChart.Resources.Appearance.NumericTimeDataPoint numericTimeDataPoint6 = new Infragistics.UltraChart.Resources.Appearance.NumericTimeDataPoint(); Infragistics.UltraChart.Resources.Appearance.PaintElement paintElement8 = new Infragistics.UltraChart.Resources.Appearance.PaintElement(); Infragistics.UltraChart.Resources.Appearance.ScatterChartAppearance scatterChartAppearance1 = new Infragistics.UltraChart.Resources.Appearance.ScatterChartAppearance(); ((System.ComponentModel.ISupportInitialize)(this)).BeginInit(); this.SuspendLayout(); // // 'UltraChart' properties's serialization: Since 'ChartType' changes the way axes look, // 'ChartType' must be persisted ahead of any Axes change made in design time. // this.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.ScatterChart; // // TestChartControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Axis.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(248)))), ((int)(((byte)(220))))); paintElement1.ElementType = Infragistics.UltraChart.Shared.Styles.PaintElementType.None; paintElement1.Fill = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(248)))), ((int)(((byte)(220))))); this.Axis.PE = paintElement1; this.Axis.X.Labels.HorizontalAlign = System.Drawing.StringAlignment.Near; this.Axis.X.Labels.ItemFormatString = "<DATA_VALUE:MMM.yyyy>"; this.Axis.X.Labels.Orientation = Infragistics.UltraChart.Shared.Styles.TextOrientation.VerticalLeftFacing; this.Axis.X.Labels.SeriesLabels.FormatString = ""; this.Axis.X.Labels.SeriesLabels.HorizontalAlign = System.Drawing.StringAlignment.Near; this.Axis.X.Labels.SeriesLabels.Orientation = Infragistics.UltraChart.Shared.Styles.TextOrientation.VerticalLeftFacing; this.Axis.X.Labels.SeriesLabels.VerticalAlign = System.Drawing.StringAlignment.Center; this.Axis.X.Labels.VerticalAlign = System.Drawing.StringAlignment.Center; this.Axis.X.MajorGridLines.AlphaLevel = ((byte)(255)); this.Axis.X.MajorGridLines.Color = System.Drawing.Color.Gainsboro; this.Axis.X.MajorGridLines.DrawStyle = Infragistics.UltraChart.Shared.Styles.LineDrawStyle.Dot; this.Axis.X.MajorGridLines.Visible = true; this.Axis.X.MinorGridLines.AlphaLevel = ((byte)(255)); this.Axis.X.MinorGridLines.Color = System.Drawing.Color.LightGray; this.Axis.X.MinorGridLines.DrawStyle = Infragistics.UltraChart.Shared.Styles.LineDrawStyle.Dot; this.Axis.X.MinorGridLines.Visible = false; this.Axis.X.TickmarkInterval = 10; this.Axis.X.TickmarkIntervalType = Infragistics.UltraChart.Shared.Styles.AxisIntervalType.Weeks; this.Axis.X.TickmarkStyle = Infragistics.UltraChart.Shared.Styles.AxisTickStyle.Smart; timeAxisAppearance1.TimeAxisStyle = Infragistics.UltraChart.Shared.Styles.RulerGenre.Discrete; this.Axis.X.TimeAxisStyle = timeAxisAppearance1; this.Axis.X.Visible = true; this.Axis.X2.Labels.HorizontalAlign = System.Drawing.StringAlignment.Far; this.Axis.X2.Labels.ItemFormatString = "<DATA_VALUE:00.##>"; this.Axis.X2.Labels.Orientation = Infragistics.UltraChart.Shared.Styles.TextOrientation.VerticalLeftFacing; this.Axis.X2.Labels.SeriesLabels.FormatString = ""; this.Axis.X2.Labels.SeriesLabels.HorizontalAlign = System.Drawing.StringAlignment.Far; this.Axis.X2.Labels.SeriesLabels.Orientation = Infragistics.UltraChart.Shared.Styles.TextOrientation.VerticalLeftFacing; this.Axis.X2.Labels.SeriesLabels.VerticalAlign = System.Drawing.StringAlignment.Center; this.Axis.X2.Labels.VerticalAlign = System.Drawing.StringAlignment.Center; this.Axis.X2.MajorGridLines.AlphaLevel = ((byte)(255)); this.Axis.X2.MajorGridLines.Color = System.Drawing.Color.Gainsboro; this.Axis.X2.MajorGridLines.DrawStyle = Infragistics.UltraChart.Shared.Styles.LineDrawStyle.Dot; this.Axis.X2.MajorGridLines.Visible = true; this.Axis.X2.MinorGridLines.AlphaLevel = ((byte)(255)); this.Axis.X2.MinorGridLines.Color = System.Drawing.Color.LightGray; this.Axis.X2.MinorGridLines.DrawStyle = Infragistics.UltraChart.Shared.Styles.LineDrawStyle.Dot; this.Axis.X2.MinorGridLines.Visible = false; this.Axis.X2.Visible = false; this.Axis.Y.Labels.HorizontalAlign = System.Drawing.StringAlignment.Far; this.Axis.Y.Labels.ItemFormatString = "<DATA_VALUE:0%>"; this.Axis.Y.Labels.Orientation = Infragistics.UltraChart.Shared.Styles.TextOrientation.Horizontal; this.Axis.Y.Labels.SeriesLabels.FormatString = ""; this.Axis.Y.Labels.SeriesLabels.HorizontalAlign = System.Drawing.StringAlignment.Far; this.Axis.Y.Labels.SeriesLabels.Orientation = Infragistics.UltraChart.Shared.Styles.TextOrientation.VerticalLeftFacing; this.Axis.Y.Labels.SeriesLabels.VerticalAlign = System.Drawing.StringAlignment.Center; this.Axis.Y.Labels.VerticalAlign = System.Drawing.StringAlignment.Center; this.Axis.Y.MajorGridLines.AlphaLevel = ((byte)(255)); this.Axis.Y.MajorGridLines.Color = System.Drawing.Color.Gainsboro; this.Axis.Y.MajorGridLines.DrawStyle = Infragistics.UltraChart.Shared.Styles.LineDrawStyle.Dot; this.Axis.Y.MajorGridLines.Visible = true; this.Axis.Y.MinorGridLines.AlphaLevel = ((byte)(255)); this.Axis.Y.MinorGridLines.Color = System.Drawing.Color.LightGray; this.Axis.Y.MinorGridLines.DrawStyle = Infragistics.UltraChart.Shared.Styles.LineDrawStyle.Dot; this.Axis.Y.MinorGridLines.Visible = false; this.Axis.Y.RangeMax = 1.1; this.Axis.Y.RangeType = Infragistics.UltraChart.Shared.Styles.AxisRangeType.Custom; this.Axis.Y.TickmarkInterval = 0.2; this.Axis.Y.TickmarkStyle = Infragistics.UltraChart.Shared.Styles.AxisTickStyle.Smart; this.Axis.Y.Visible = true; this.Axis.Y2.Labels.HorizontalAlign = System.Drawing.StringAlignment.Near; this.Axis.Y2.Labels.ItemFormatString = "<DATA_VALUE:00.##>"; this.Axis.Y2.Labels.Orientation = Infragistics.UltraChart.Shared.Styles.TextOrientation.Horizontal; this.Axis.Y2.Labels.SeriesLabels.FormatString = ""; this.Axis.Y2.Labels.SeriesLabels.HorizontalAlign = System.Drawing.StringAlignment.Near; this.Axis.Y2.Labels.SeriesLabels.Orientation = Infragistics.UltraChart.Shared.Styles.TextOrientation.Horizontal; this.Axis.Y2.Labels.SeriesLabels.VerticalAlign = System.Drawing.StringAlignment.Center; this.Axis.Y2.Labels.VerticalAlign = System.Drawing.StringAlignment.Center; this.Axis.Y2.MajorGridLines.AlphaLevel = ((byte)(255)); this.Axis.Y2.MajorGridLines.Color = System.Drawing.Color.Gainsboro; this.Axis.Y2.MajorGridLines.DrawStyle = Infragistics.UltraChart.Shared.Styles.LineDrawStyle.Dot; this.Axis.Y2.MajorGridLines.Visible = true; this.Axis.Y2.MinorGridLines.AlphaLevel = ((byte)(255)); this.Axis.Y2.MinorGridLines.Color = System.Drawing.Color.LightGray; this.Axis.Y2.MinorGridLines.DrawStyle = Infragistics.UltraChart.Shared.Styles.LineDrawStyle.Dot; this.Axis.Y2.MinorGridLines.Visible = false; this.Axis.Y2.Visible = false; this.Axis.Z.Labels.HorizontalAlign = System.Drawing.StringAlignment.Near; this.Axis.Z.Labels.ItemFormatString = ""; this.Axis.Z.Labels.Orientation = Infragistics.UltraChart.Shared.Styles.TextOrientation.Horizontal; this.Axis.Z.Labels.SeriesLabels.HorizontalAlign = System.Drawing.StringAlignment.Near; this.Axis.Z.Labels.SeriesLabels.Orientation = Infragistics.UltraChart.Shared.Styles.TextOrientation.Horizontal; this.Axis.Z.Labels.SeriesLabels.VerticalAlign = System.Drawing.StringAlignment.Center; this.Axis.Z.Labels.VerticalAlign = System.Drawing.StringAlignment.Center; this.Axis.Z.MajorGridLines.AlphaLevel = ((byte)(255)); this.Axis.Z.MajorGridLines.Color = System.Drawing.Color.Gainsboro; this.Axis.Z.MajorGridLines.DrawStyle = Infragistics.UltraChart.Shared.Styles.LineDrawStyle.Dot; this.Axis.Z.MajorGridLines.Visible = true; this.Axis.Z.MinorGridLines.AlphaLevel = ((byte)(255)); this.Axis.Z.MinorGridLines.Color = System.Drawing.Color.LightGray; this.Axis.Z.MinorGridLines.DrawStyle = Infragistics.UltraChart.Shared.Styles.LineDrawStyle.Dot; this.Axis.Z.MinorGridLines.Visible = false; this.Axis.Z.Visible = false; this.Axis.Z2.Labels.HorizontalAlign = System.Drawing.StringAlignment.Near; this.Axis.Z2.Labels.ItemFormatString = ""; this.Axis.Z2.Labels.Orientation = Infragistics.UltraChart.Shared.Styles.TextOrientation.Horizontal; this.Axis.Z2.Labels.SeriesLabels.HorizontalAlign = System.Drawing.StringAlignment.Near; this.Axis.Z2.Labels.SeriesLabels.Orientation = Infragistics.UltraChart.Shared.Styles.TextOrientation.Horizontal; this.Axis.Z2.Labels.SeriesLabels.VerticalAlign = System.Drawing.StringAlignment.Center; this.Axis.Z2.Labels.VerticalAlign = System.Drawing.StringAlignment.Center; this.Axis.Z2.MajorGridLines.AlphaLevel = ((byte)(255)); this.Axis.Z2.MajorGridLines.Color = System.Drawing.Color.Gainsboro; this.Axis.Z2.MajorGridLines.DrawStyle = Infragistics.UltraChart.Shared.Styles.LineDrawStyle.Dot; this.Axis.Z2.MajorGridLines.Visible = true; this.Axis.Z2.MinorGridLines.AlphaLevel = ((byte)(255)); this.Axis.Z2.MinorGridLines.Color = System.Drawing.Color.LightGray; this.Axis.Z2.MinorGridLines.DrawStyle = Infragistics.UltraChart.Shared.Styles.LineDrawStyle.Dot; this.Axis.Z2.MinorGridLines.Visible = false; this.Axis.Z2.Visible = false; this.ColorModel.AlphaLevel = ((byte)(150)); this.ColorModel.ModelStyle = Infragistics.UltraChart.Shared.Styles.ColorModels.CustomLinear; numericTimeSeries1.Data.TimeValueColumn = null; numericTimeSeries1.Data.ValueColumn = null; numericTimeSeries1.Key = "Time Series"; paintElement2.Fill = System.Drawing.Color.Cyan; paintElement2.Stroke = System.Drawing.Color.Red; numericTimeSeries1.PEs.AddRange(new Infragistics.UltraChart.Resources.Appearance.PaintElement[] { paintElement2}); numericTimeDataPoint1.Label = "September 2008"; numericTimeDataPoint1.NumericValue = 1; paintElement3.ElementType = Infragistics.UltraChart.Shared.Styles.PaintElementType.None; numericTimeDataPoint1.PE = paintElement3; numericTimeDataPoint1.TimeValue = new System.DateTime(2008, 9, 1, 0, 0, 0, 0); numericTimeDataPoint2.Label = "December 2008"; numericTimeDataPoint2.NumericValue = 0.5444; paintElement4.ElementType = Infragistics.UltraChart.Shared.Styles.PaintElementType.None; numericTimeDataPoint2.PE = paintElement4; numericTimeDataPoint2.TimeValue = new System.DateTime(2008, 12, 1, 0, 0, 0, 0); numericTimeDataPoint3.Label = "March 2009"; numericTimeDataPoint3.NumericValue = 0.3783; paintElement5.ElementType = Infragistics.UltraChart.Shared.Styles.PaintElementType.None; numericTimeDataPoint3.PE = paintElement5; numericTimeDataPoint3.TimeValue = new System.DateTime(2009, 3, 1, 0, 0, 0, 0); numericTimeDataPoint4.Label = "June 2009"; numericTimeDataPoint4.NumericValue = 0.3932; paintElement6.ElementType = Infragistics.UltraChart.Shared.Styles.PaintElementType.None; numericTimeDataPoint4.PE = paintElement6; numericTimeDataPoint4.TimeValue = new System.DateTime(2009, 6, 1, 0, 0, 0, 0); numericTimeDataPoint5.Label = "September 2009"; numericTimeDataPoint5.NumericValue = 0.6583; paintElement7.ElementType = Infragistics.UltraChart.Shared.Styles.PaintElementType.None; numericTimeDataPoint5.PE = paintElement7; numericTimeDataPoint5.TimeValue = new System.DateTime(2009, 9, 1, 0, 0, 0, 0); numericTimeDataPoint6.Label = "December 2009"; numericTimeDataPoint6.NumericValue = 0.9499; paintElement8.ElementType = Infragistics.UltraChart.Shared.Styles.PaintElementType.None; numericTimeDataPoint6.PE = paintElement8; numericTimeDataPoint6.TimeValue = new System.DateTime(2009, 12, 1, 0, 0, 0, 0); numericTimeSeries1.Points.Add(numericTimeDataPoint1); numericTimeSeries1.Points.Add(numericTimeDataPoint2); numericTimeSeries1.Points.Add(numericTimeDataPoint3); numericTimeSeries1.Points.Add(numericTimeDataPoint4); numericTimeSeries1.Points.Add(numericTimeDataPoint5); numericTimeSeries1.Points.Add(numericTimeDataPoint6); this.CompositeChart.Series.AddRange(new Infragistics.UltraChart.Data.Series.ISeries[] { numericTimeSeries1}); this.Data.ZeroAligned = true; this.Name = "TestChartControl"; scatterChartAppearance1.ConnectWithLines = true; scatterChartAppearance1.Icon = Infragistics.UltraChart.Shared.Styles.SymbolIcon.Square; scatterChartAppearance1.IconSize = Infragistics.UltraChart.Shared.Styles.SymbolIconSize.Medium; scatterChartAppearance1.LineAppearance.SplineTension = 0F; scatterChartAppearance1.LineAppearance.Thickness = 1; this.ScatterChart = scatterChartAppearance1; this.Size = new System.Drawing.Size(609, 403); ((System.ComponentModel.ISupportInitialize)(this)).EndInit(); this.ResumeLayout(false); } #endregion }
All I'm doing is saving it with:
System.IO.FileStream fs = new System.IO.FileStream(@"c:\testchart.png", System.IO.FileMode.Create, System.IO.FileAccess.Write);tc.SaveTo(fs, System.Drawing.Imaging.ImageFormat.Png, tc.Size, new SizeF(300, 300));
Btw. I am using UltraWinChart v2009.1
Thanks,
M.
This is a normal behavior. With increasing the resolution the texts are scaled too. You can reproduce this with increasing the Windows resolution.
I know it is the normal behavior in windows, but definitely not the one I've expected with a chart image. What I did in the meantime is set the font size to:
tc.Axis.X.Labels.Font = new Font(tc.Axis.X.Labels.Font.Name, tc.Axis.X.Labels.Font.Size * 96/300, tc.Axis.X.Labels.Font.Style);
but it would be nice to have a parameter which would do that automatically for all text elements on chart.
This is a good suggestion, thanks. We'll try adding something like this.
Are there any new developments regarding the quality of the generated image? It seems that several people asked about it in the past years. I am currently using the 2013 Version but I would upgrade if there is a fix.
All I want is have the chart on display to save as a good quality jpg looking exactly the same.
Are there other workarounds than the one mentioned above? It seems to me that increasing the resolution will require to generate a second chart in which all the fonts and extents for axis and legends will get readjusted; it will probably take some time to get it right for all the cases involved.
Thanks!