コード例 #1
0
        public override Image GetImage(int width = 200, int height = 200)
        {
            Bitmap bmp;

            using (var ms = new MemoryStream())
            {
                flexChart1.SaveImage(ms, ImageFormat.Png, flexChart1.Width, flexChart1.Height);
                bmp = new Bitmap(ms);
            }
            return(bmp);
        }
コード例 #2
0
        void flexChart_MouseMove(object sender, MouseEventArgs e)
        {
            var hitTestInfo = flexChart.HitTest(e.Location);

            if (hitTestInfo != null && hitTestInfo.Item != null && hitTestInfo.Distance <= MAX_DIST)
            {
                var item = hitTestInfo.Item as FlexPoint;
                // Get Detailed data for the data point hit
                var data = from order in _orders
                           where order.ShippedCountry.Equals(item.XValue)
                           group order by order.OrderDate.Year into newGroup
                           orderby newGroup.Key
                           select new
                {
                    Year   = newGroup.Key,
                    Amount = newGroup.Sum(order => order.Amount)
                };

                //Prepare chart for the data point hit
                var chart = new FlexChart();
                chart.DataSource     = data;
                chart.Footer.Content = Tooltips.Resources.AppResources.OrderChartFooter + item.XValue;
                chart.BindingX       = "Year";
                chart.Font           = new Font("Segoe UI", flexChart.Font.Size);
                Series orderAmountSeries = new Series {
                    Name = "Amount", Binding = "Amount"
                };
                orderAmountSeries.Style.FillColor = ColorTranslator.FromHtml("#DA3E52");
                chart.Series.Add(orderAmountSeries);
                chart.Legend.Position    = Position.None;
                chart.AxisX.MajorUnit    = 1;
                chart.DataLabel.Content  = "{y}";
                chart.DataLabel.Position = LabelPosition.Top;
                using (var ms = new MemoryStream())
                {
                    //Save the chart to C1SuperTooltip's Images collection
                    chart.SaveImage(ms, ImageFormat.Png, 400, 300);
                    var img       = Image.FromStream(ms);
                    var imageName = item.XValue + ".png";
                    c1SuperTooltip1.Images.Add(imageName, img);
                }

                string html = "<img src='res://" + item.XValue + ".png'/>";
                c1SuperTooltip1.SetToolTip(flexChart, html);
            }
            else
            {
                c1SuperTooltip1.Hide();
                c1SuperTooltip1.Images.Clear();
            }
        }
コード例 #3
0
        private void FlexChart1_MouseMove(object sender, MouseEventArgs e)
        {
            var hitInfo = flexChart1.HitTest(e.Location);

            if (hitInfo != null && hitInfo.Item != null && hitInfo.Distance <= MAX_DIST)
            {
                var item    = hitInfo.Item as CountrySalesOrders;
                var subData = from order in item.Orders
                              group order by order.Date.Year into newGroup
                              orderby newGroup.Key
                              select new
                {
                    Date   = newGroup.Key,
                    Amount = newGroup.Sum(x => x.Amount)
                };
                var chart = new FlexChart();
                chart.DataSource        = subData;
                chart.BindingX          = "Date";
                chart.Header.Content    = "Yearly Values : " + item.Name;
                chart.Header.Style.Font = StyleInfo.AxisTitleFont;

                var series = new Series()
                {
                    Binding = "Amount"
                };
                series.Style.FillColor = ColorTranslator.FromHtml("#DA3E52");
                chart.Series.Add(series);

                chart.DataLabel.Content  = "{y}";
                chart.DataLabel.Position = LabelPosition.Top;
                using (var ms = new MemoryStream())
                {
                    //Save the chart to C1SuperTooltip's Images collection
                    chart.SaveImage(ms, ImageFormat.Png, 400, 300);
                    var img       = Image.FromStream(ms);
                    var imageName = item.Name + ".png";
                    _c1SuperTooltip.Images.Add(imageName, img);
                }
                var html = "<img src='res://" + item.Name + ".png'/>";
                _c1SuperTooltip.SetToolTip(flexChart1, html);
            }
            else
            {
                _c1SuperTooltip.Hide();
                _c1SuperTooltip.Images.Clear();
            }
        }