ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  CDML img tag not displaying an image
Posted by Ryan Gray on Mar-11-2023 05:40
Attachments:
I am trying to put a symbol next to an XY chart label, but it is coming out blank. I am using the code from the simple bar chart in the documentation, and copying the img symbol example for CDML, also in the documentation. Here is the code and I also attached the final chart. I believe I am using chart director version 5.0. I have tried putting other CDML tags on the text like <*underline=1*> and this all works fine so I know that CDML can be applied to these labels, just wondering why the img does not work.

  protected void Page_Load(object sender, EventArgs e)
        {
            // The data for the bar chart
            double[] data = { 85, 156, 179.5, 211, 123 };

            // The labels for the bar chart
            string[] labels = { "Mon<*img=@Triangle,color=00CC00,width=7,height=10*>", "Tue", "Wed", "Thu", "Fri" };

            // Create a XYChart object of size 250 x 250 pixels
            XYChart c = new XYChart(250, 250);

            // Set the plotarea at (30, 20) and of size 200 x 200 pixels
            c.setPlotArea(30, 20, 200, 200);

            // Add a bar chart layer using the given data
            c.addBarLayer(data);

            // Set the labels on the x axis.
            c.xAxis().setLabels(labels);

            // Output the chart
            WebChartViewer1.Image = c.makeWebImage(Chart.PNG);

            // Include tool tip for the chart
            WebChartViewer1.ImageMap = c.getHTMLImageMap("", "", "title='{xLabel}: {value} GBytes'");
        }
chart_with_no_triangle_symbol.png

  Re: CDML img tag not displaying an image
Posted by Peter Kwan on Mar-11-2023 20:13
Hi Ryan,

The CDML shape was introduced in ChartDirector 5.1.

https://www.advsofteng.com/release51.html

I have tried your code in my machine (running ChartDirector 7), and I can see the green triangle, so I believe the code is correct. It is probably due to the ChartDirector 5.0 version you are using.

You can try to update the ChartDirector 5.1 to see if it works. This update is free of charge if your license can use ChartDirector 5.0. In the simplest case, you just need to replace your "netchartdir.dll" with the one that comes with ChartDirector 5.1.

https://www.advsofteng.com/download_archive.html

Best Regards
Peter Kwan