Jump to content
Software FX Community

AlexeyRedko

Members
  • Posts

    32
  • Joined

  • Last visited

AlexeyRedko's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hi, My chart should support font size changing, therefore the font size has to be scalable. When the size is a bit bigger it spread over axis X values. I'm looking for workaround to resolve that issue (instead of limit the size). Tx
  2. Hi, I have a PDF report generator that contains many charts. That reason lead me to create only one chart and clear its properties before I export it to an image each time. What I got is a report with only one chart (the first one), so I sieve all my custom method and I found that AxesY.Clear() lead to 'Object reference not set to an instance of an object.' exception when I'm trying to export (any other chart properties clear method not damaging). Sample code: [color= rgb(43, 145, 175);]Chart[/color] WPFChart = [color= blue;]new[/color] [color= rgb(43, 145, 175);]Chart[/color](); [color= green;]// First chart fill[/color] [color= rgb(43, 145, 175);]SeriesAttributes[/color] SA = [color= blue;]new[/color] [color= rgb(43, 145, 175);]SeriesAttributes[/color](); SA.ItemsSource = [color= blue;]new[/color] [color= rgb(43, 145, 175);]List[/color]<[color= blue;]double[/color]>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; SA.Stroke = [color= rgb(43, 145, 175);]Brushes[/color].Red; SA.StrokeThickness = 2d; SA.Gallery = [color= rgb(43, 145, 175);]Gallery[/color].Line; WPFChart.Series.Add(SA); [color= green;]// Clear chart [/color] WPFChart.Series.Clear(); WPFChart.AxesY.Clear(); [color= green;]// Second chart fill[/color] SA = [color= blue;]new[/color] [color= rgb(43, 145, 175);]SeriesAttributes[/color](); SA.ItemsSource = [color= blue;]new[/color] [color= rgb(43, 145, 175);]List[/color]<[color= blue;]double[/color]>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; SA.Stroke = [color= rgb(43, 145, 175);]Brushes[/color].Red; SA.StrokeThickness = 2d; SA.Gallery = [color= rgb(43, 145, 175);]Gallery[/color].Line; WPFChart.Series.Add(SA); [color= green;]// Export chart to file[/color] [color= blue;]string[/color] FilePath = [color= rgb(163, 21, 21);]@"C:\Temp\TestWPFChart.png"[/color]; [color= blue;]if[/color] ([color= rgb(43, 145, 175);]File[/color].Exists(FilePath)) [color= rgb(43, 145, 175);]File[/color].Delete(FilePath); [color= blue;]using[/color] ([color= rgb(43, 145, 175);]FileStream[/color] FS = [color= blue;]new[/color] [color= rgb(43, 145, 175);]FileStream[/color](FilePath, [color= rgb(43, 145, 175);]FileMode[/color].CreateNew)) { WPFChart.Export([color= rgb(43, 145, 175);]FileFormat[/color].Png, FS); // Export crush!!! } I'm looking for some workaround or ideas. Thanks, Alexey
  3. Hi, I'm trying to convert a chart to image (format is not the issue now), by export to stream and then create an image. This chart includes annotation (such as line and rectangle), and I set the chart size (width and height) before the export process start. The results of the export is chart without the annotation. If I'm using the Measure and Arrange methods the chart looks fine as a control but the Export process failed when I'm running on different thread. Sometimes I get "object reference not set to an instance of an object" fail message and sometimes I get an error that report on threading issue (cannot set object not form the thread its belong to). Note that the chart is local on its own thread. If I'm not adding any annotation and use only the Width and Height properties the export process not fail. Thanks
  4. Answer: Changing of those Legend properties should be made in the custom element constructor...
  5. Hello, I'm trying to replace the legend of the WPF ChartFX at the bottom with no succeed. My code: LegendBox.DockBorder = [color= rgb(43, 145, 175);]DockBorder[/color].None; [color= rgb(43, 145, 175);]DockPanel[/color].SetDock([color= blue;]this[/color].LegendBox, [color= rgb(43, 145, 175);]Dock[/color].Bottom); Is it the right way ? Any idea ?
  6. Thanks for response . I'll try to expain my problem.We have some reports produced in pdf .We want to put the charts into the our reports but the problem when we using export to bitmap we have two problems: 1.Bitmap files are large(when we define high resolution). 2.The quality of picture is rather lousy(if we don't define high resolution mannually). XAML sounds great but what can I do with it in my case ? I can't insert XAML into pdf or even into component that creates PDF files. Anyway I'd like to know if there is option to export chart as a picture with good quality but the picture won't be too large? Is the export of Vector based format file was met these requirements?
  7. Hello! I'd like to perfom export to Metafile and Vector-based image format. There was a option to export to Metafile in older(Winforms) version of chart fx, but not in wpf. Is it possible to do it in wpf , if not please can you provide any work around to this issue?
  8. Hello ChartFx team! I have a common question about what is the best way to be intergrated with chart fx. As far as I understand (from my little experience) wpf chart fx is rather good for working with "static" data (I mean there is no interaction with chart).Here I can use benefits of wpf binding model.The problem that my case is little complicated: The chart has to support dynamic loading of data,each series may be located on different pane ,the color of series can be changed from outside,drag and drop series from pane to pane ,adding annotations by user and programmaticly,special axis x and axis y formatting and sometimes drawing custom grid lines. Frankly speaking I implemented most of the functionality programmaticly, without using the wpf binding model ,but now I have a question if it is realy right way or anyway I should take "wpf" aproach using databinding and behavior.
  9. Hello. Is it possible to locate bar toward the tick on axis x? For example the marker or tick of axis is in the centre of the bar (like 123) and I'd like to locate the bar from left of the tick (like _123) or from the right of the tick (like _123)
  10. Hello! In sample application "Annotations" I see example for toggling points labels.There is option to show X values instead of Y . For example I have series with points (1,1) ,(3,2),(3,3).If I use your sample I'll see the point labels 1,3,3 and I want to see 1,2,3. Thanks.
  11. Thanks,I'll check this issue
  12. Hello AndreG! (Sorry .I don't know your name) May be I didn't explain myself clearly,but this is the point.I set SetAttachWidht to 100 units of axis x and I expect that my triangle will be bounded between 10 to 110 units on axis x.But instead of this I get triangle that bounded between 10 and 1000 units and I suppose that this is uncorrect.I hope you understand me.
  13. Thanks to your response! I reviewed my code and I think I understood the problem.When I draw the polygon there is no need to use the ValueToPixel method .It is enough to create the polygon and to use AttachHeight and AttachWidth methods .It works fine but only for non logarithmic axes.In case I use logarithmic one I have a problem.In my code I want to set annotation for example triangle with coordinates (2,10) (4,10) (4,100) (see the code below).I create the triangle and use AtthachHeight(pol,2) AttachWidth(pol ,90). Triangle is streched as I wanted.Everything is allright. Now I set the chart.AxisX.LogBase = 10.0 and I get trianle with width more than 90. There are two scenarios: 1.I don't use the AtthachHeight and AttachWidth properly - so If it is the case please explain me how to do it . 2.This is the bug. Actually after some research I discoverd if I set AttachWidth (pol,100/10) instead of AttachWidth (pol,100-10) I get the desirable result.Frankly speaking from point of view of simple user it is a little buggy becouse I don't think I have to ajust my own data according to LogBase of Axis this is the code : Xaml < Window x:Class="CustomSteps.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525" xmlns:cfx="http://schemas.softwarefx.com/chartfx/wpf/80"> <Grid> <cfx:Chart Name="chart" /></Grid> </ Window> Code behind: namespace CustomSteps { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { private Annotations _annotations;public MainWindow() { InitializeComponent(); ReloadData(); } public struct MyPoint { public double X { get;set; } public double Y { get;set; } public DateTime Time { get;set; } } private void ReloadData() { MyPoint[] data1 = new MyPoint[21]; FillData(data1, 1); SeriesAttributes sa1 = new SeriesAttributes(); sa1.ItemsSource = data1; chart.Series.Add(sa1); Pane pane = new Pane();Axis ax1 = new Axis(); ax1.Min = 0; ax1.Max = 10; this.chart.Panes.Add(pane); pane.Series.Add(sa1); sa1.AxisY = ax1; sa1.AxisX = chart.AxisX; sa1.BindingPathX = "X";sa1.BindingPath = "Y"; pane.AxesY.Add(ax1); sa1.Gallery = Gallery.Curve;chart.AxisX.DataPath = "X";chart.AxisX = new Axis(); chart.AxisX.LogBase = 10; chart.AxisX.GetLabel += new AxisLabelEventHandler(AxisX_GetLabel); chart.PanesPanel = new StackPanePanel(); AddAnnotations(sa1); } private void AddAnnotations(SeriesAttributes Ser) { Polygon pol = new Polygon(); pol.Stretch = Stretch.Fill; pol.Fill = Brushes.Red;pol.Stroke = Brushes.Red; pol.StrokeThickness = 2; pol.Opacity = 0.5; Point p1 = new Point(0, 0); Point p2 = new Point(0, 1);Point p3 = new Point(1, 1); pol.Points = new PointCollection() { p1, p2, p3}; if (_annotations == null) { _annotations = new Annotations();this.chart.Extensions.Add(_annotations); } _annotations.Children.Add(pol); Annotations.SetAxisY(pol, Ser.AxisY); Annotations.SetAxisX(pol, this.chart.AxisX);Annotations.SetAttachX(pol, 10); Annotations.SetAttachY(pol, 4);Annotations.SetAttachHeight(pol, 2); //without log 10 - looks like right //with log 10 looks wrongAnnotations.SetAttachWidth(pol, 100);Annotations.SetSeries(pol, Ser); } void AxisX_GetLabel(object sender, AxisLabelEventArgs e) { Trace.TraceInformation("{0}",e.Text); } private void FillData(MyPoint[] data1, double factor) { for (int i = 0; i < data1.Length; i++) { data1.Y = i; data1.X = i*10; } } } }
×
×
  • Create New...