Closed skateinmars closed 11 years ago
Hi @skateinmars conceptually you are definitely on the right track. I would suggest having a look at the specification. While the explanations are often less then helpful, the schema declarations are very helpful indeed.
for example, page 4060 in Part 1 Fundamentals and Markup language reference:
<xsd:complexType name="CT_BubbleChart">
<xsd:sequence>
<xsd:element name="varyColors" type="CT_Boolean" minOccurs="0" maxOccurs="1"/>
<xsd:element name="ser" type="CT_BubbleSer" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="dLbls" type="CT_DLbls" minOccurs="0" maxOccurs="1"/>
<xsd:element name="bubble3D" type="CT_Boolean" minOccurs="0" maxOccurs="1"/>
<xsd:element name="bubbleScale" type="CT_BubbleScale" minOccurs="0" maxOccurs="1"/>
<xsd:element name="showNegBubbles" type="CT_Boolean" minOccurs="0" maxOccurs="1"/>
<xsd:element name="sizeRepresents" type="CT_SizeRepresents" minOccurs="0" maxOccurs="1"/>
<xsd:element name="axId" type="CT_UnsignedInt" minOccurs="2" maxOccurs="2"/>
<xsd:element name="extLst" type="CT_ExtensionList" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
Thanks for the tips. I managed to generate a bubble chart, though I didn't include every possible optional elements (bubble3D, bubbleScale...)
Basically the BubbleSeries is almost identical to the ScatterSeries, the change being in the initialize
method:
@bubbleSize = NumDataSource.new({:tag_name => :bubbleSize, :data => options[:bubbleSize]}) unless options[:bubbleSize].nil?
There is also a small change needed in NumDataSource, and a BubbleChart class.
I'm planning to do a pull request for this, but I'm wondering if my BubbleSeries and BubbleChart classes should inherit from the base Series and Chart classes or I can directly inherit from ScatterSeries/ScatterChart?
Hi @skateinmars
Keep at it!!
BubbleChart should definitely inherit from Chart, and generate its own series data as the specification is different.
Thanks, the pull request https://github.com/randym/axlsx/pull/254 should be complete now!
Sorry mate, I'll try to get to this later tonight. Thanks for your patience.
Hello,
I want to add bubble charts support to Axlsx. This is a type of scatter chart (which is already supported) but has a third value (besides x and y coordinates) that determines the size of the point (named bubbleSize in the XML).
I can't seem to find any readable documentation about this in the spec so for now I'm manually converting a generated scatter chart to a bubble chart in LibreOffice and checking the diff between the two XML chart files. This is incredibly inefficient though. The main change needed seems to be a
<c:bubbleSize>
that has to be added in the<c:bubbleChart>
tag.On the code side, I'm guessing we need to add a
BubbleChart
class and maybe aBubbleSeries
class? The API should look like this:Am I on the right track here? Do you have any (usable) resource concerning the spec?
Anyway, thanks for this library, this is a great time saver.